KarrLab/wc_rules

View on GitHub

Showing 49 of 74 total issues

Function make_edge_token has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def make_edge_token(_class1,ref1,attr1,_class2,ref2,attr2,action):
Severity: Major
Found in wc_rules/matcher/token.py - About 50 mins to fix

    Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, name='', reactants=dict(), helpers=dict(), actions=[], factories=dict(),rate_prefix='', parameters = []):
    Severity: Major
    Found in wc_rules/modeling/rule.py - About 50 mins to fix

      Function duplicate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def duplicate(self,varmap={},include=None):
              if include is None:
                  include = self.keys()
      
              newnodes = dict()
      Severity: Minor
      Found in wc_rules/graph/collections.py - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function collect_dependencies has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def collect_dependencies(self,deps):
              if not isinstance(deps,list):
                  deps = [deps]
              while len(deps)>0:
                  x = deps.pop(0)
      Severity: Minor
      Found in wc_rules/expressions/dependency.py - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Avoid deeply nested control flow statements.
      Open

                          if getattr(term,'data','')=='multiply':
                              insert_this.append(Tree(data='divide',children=[]))
                          elif getattr(term,'data','')=='divide':
                              insert_this.append(Tree(data='multiply',children=[]))
                          else:
      Severity: Major
      Found in wc_rules/expressions/parse.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if getattr(term,'data','')=='add':
                                insert_this.append(Tree(data='subtract',children=[]))
                            elif getattr(term,'data','')=='subtract':
                                insert_this.append(Tree(data='add',children=[]))
                            else:
        Severity: Major
        Found in wc_rules/expressions/parse.py - About 45 mins to fix

          Function attach_actions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def attach_actions(self):
                  self.attach_removenode_method()
                  for attr,value in self.__class__.Meta.local_attributes.items():
                      if attr == 'id':
                          continue
          Severity: Minor
          Found in wc_rules/schema/actions.py - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function function_call has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def function_call(self,args):
                  d,s = dict(args), ''
                  if 'function_name' in d and 'args' not in d:
                      d['args'] = ''
                  keys = sorted(d.keys())
          Severity: Minor
          Found in wc_rules/expressions/parse.py - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function pprint has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def pprint(self,nodes=None,channels=None):
                  s = []
                  if nodes is None:
                      nodes = self.get_nodes()
                  if channels is None:
          Severity: Minor
          Found in wc_rules/matcher/print_methods.py - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Function add_node_variable has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def add_node_variable(self,name,default_value=None,executable=None,parameters={},caches={},subtype=None):
          Severity: Minor
          Found in wc_rules/matcher/add_methods.py - About 45 mins to fix

            Function check_numeric_value has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def check_numeric_value(value,attr,_class,_min=None,_max=None):
            Severity: Minor
            Found in wc_rules/schema/attributes.py - About 35 mins to fix

              Function add_node_pattern has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def add_node_pattern(self,pattern,cache=None,subtype='default',executables=[],caches={}):
              Severity: Minor
              Found in wc_rules/matcher/add_methods.py - About 35 mins to fix

                Function visualize_node has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def visualize_node(node,idx,label,size=20,font={'size':20,'face':'arial'}):
                Severity: Minor
                Found in wc_rules/graph/vis.py - About 35 mins to fix

                  Function add_channel_transform has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def add_channel_transform(self,source,target,datamap,actionmap,filter_data=lambda data: True):
                  Severity: Minor
                  Found in wc_rules/matcher/add_methods.py - About 35 mins to fix

                    Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __init__(self,keywords,builtins,fn,code,deps):
                    Severity: Minor
                    Found in wc_rules/expressions/executable.py - About 35 mins to fix

                      Function cyclic_form has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def cyclic_form(self,simple=False):
                              values, orbits = list(self.sources), []
                              while values:
                                  orb = [values.pop(0)]
                                  while values:
                      Severity: Minor
                      Found in wc_rules/graph/permutations.py - About 35 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function visualize_graph_container has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def visualize_graph_container(g,asdict=False):
                          nodes,edges = [],[]
                          for idx,node in g.iter_nodes():
                              classname = node.__class__.__name__
                              size = 20
                      Severity: Minor
                      Found in wc_rules/graph/vis.py - About 35 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function orbits has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def orbits(self):
                              orbindex = index_dict(self.generators[0].sources)
                              for g in self.generators:
                                  for cyc in g.cyclic_form():
                                      if len(cyc) > 1:
                      Severity: Minor
                      Found in wc_rules/graph/permutations.py - About 35 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function partition_until_edge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def partition_until_edge(labeling,group,examined=set(),partitions=[]):
                          # input: canonically labeled graph
                          # repeatedly partition with partition_canonical_form until you obtain single-edge graphs
                          # output: examined set of labels (hashed versions), successive partitions of the graph
                          CL1, CL2 = partition_canonical_form(labeling,group)
                      Severity: Minor
                      Found in wc_rules/graph/graph_partitioning.py - About 25 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function iter_edges has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def iter_edges(self):
                              visited = set()
                              for idx,node in self.iter_nodes():
                                  for attr,node2 in node.iter_edges():
                                      edge = Edge.create(idx,attr,node2.id,node.get_related_name(attr))
                      Severity: Minor
                      Found in wc_rules/graph/collections.py - About 25 mins to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Severity
                      Category
                      Status
                      Source
                      Language