Skip to content
Snippets Groups Projects
Commit 972d264e authored by George Marchment's avatar George Marchment
Browse files

Started adding upper bound for the whiles

parent f607cf91
No related branches found
No related tags found
No related merge requests found
Pipeline #14627 failed
......@@ -209,10 +209,14 @@ class Call(Executor):
#Step 1 -> get parameters
tab_params, start, next_param = [], 0, None
temp_param = param
while(start!=-1):
timeout = 0
while(start!=-1 and timeout<constant.WHILE_UPPER_BOUND):
temp_param = temp_param[start:]
next_param, start = get_next_param(temp_param)
tab_params.append(next_param.strip())
timeout+=1
if(timeout>=constant.WHILE_UPPER_BOUND):
raise BioFlowInsightError(f"The WHILE_UPPER_BOUND was exceeded. BioFlow-Insight was unable to extract the parameters for the call '{self.get_code(get_OG=True)}'. Make sure the workflow uses correct Nextflow syntaxe (https://www.nextflow.io/docs/latest/index.html).", type="Unable to extract call parameters")
#Step 2 -> analyse paramters
for param in tab_params:
......
......@@ -45,8 +45,8 @@ class Code:
quote_single, quote_double = False, False
triple_single, triple_double = False, False
while(start<len(code)):
timeout = 0
while(start<len(code) and timeout<constant.WHILE_UPPER_BOUND):
checked_triple = False
if(start+3<=len(code)):
if(code[start:start+3]=="'''" and not quote_single and not quote_double and not triple_single and not triple_double):
......@@ -116,6 +116,9 @@ class Code:
start+=1
timeout+=1
if(timeout>=constant.WHILE_UPPER_BOUND):
raise BioFlowInsightError(f"The WHILE_UPPER_BOUND was exceeded. BioFlow-Insight was unable to turn a single line condition into a multi line condition. Make sure the workflow uses correct Nextflow syntaxe (https://www.nextflow.io/docs/latest/index.html).", type="Unable to turn single line condition into multi line")
......@@ -128,7 +131,8 @@ class Code:
def remove_things_inside_map(self, code):
index = 0
searching = True
while(searching):
timeout = 0
while(searching and timeout<constant.WHILE_UPPER_BOUND):
searching = False
#TODO -> do the same with flatMap -> 668
for word in ["map", "flatMap"]:
......@@ -153,6 +157,10 @@ class Code:
searching = True
index+=1
break
timeout+=1
if(timeout>=constant.WHILE_UPPER_BOUND):
raise BioFlowInsightError(f"The WHILE_UPPER_BOUND was exceeded. BioFlow-Insight was unable to extract the inside of a 'map' operator. Make sure the workflow uses correct Nextflow syntaxe (https://www.nextflow.io/docs/latest/index.html).", type="Unable to extract the inside of a 'map' operator")
return code
......
import re
import subprocess
import os
from .constant import WHILE_UPPER_BOUND
from . import constant
from .bioflowinsighterror import BioFlowInsightError
......@@ -936,7 +936,7 @@ def extract_conditions(code, only_get_inside = True):
timeout = 0
while(start<len(code) and timeout < WHILE_UPPER_BOUND):
while(start<len(code) and timeout < constant.WHILE_UPPER_BOUND):
checked_triple = False
if(start+3<=len(code)):
if(code[start:start+3]=="'''" and not quote_single and not quote_double and not triple_single and not triple_double):
......@@ -1061,7 +1061,7 @@ def extract_conditions(code, only_get_inside = True):
start+=1
timeout+=1
if(timeout>=WHILE_UPPER_BOUND):
if(timeout>=constant.WHILE_UPPER_BOUND):
raise BioFlowInsightError("The WHILE_UPPER_BOUND was exceeded. BioFlow-Insight was unable to extarct the conditions. Make sure the workflow uses correct Nextflow syntaxe (https://www.nextflow.io/docs/latest/index.html).", type="Unable to extract conditions")
for c in conditions_dico:
start, end = conditions_dico[c]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment