KarrLab/bpforms

View on GitHub

Showing 397 of 397 total issues

Avoid deeply nested control flow statements.
Open

                    for base in origin:
                        start_pos = seq.find(base) + 1
                        if start_pos > 0:
                            start_position = min(start_position, start_pos)

Severity: Major
Found in examples/pro.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if modification['monomer'] not in code_freq:
                            code_freq[modification['monomer']] = 0
                        canonical_code_freq[modification['residue']] += n_mods
    Severity: Major
    Found in examples/pro.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if start_position == 0:
                              protein['modified_errors'].append('Sequence does not contain residue {} for modification {}'.format(
                                  canonical_code, modification['monomer']))
                          else:
                              monomer2.start_position = start_position
      Severity: Major
      Found in examples/pro.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                for n in names:
                                    monomer = name_to_monomer.get(n.lower(), None)
                                    if monomer is not None:
                                        same_names.append((id, monomer.id, n))
                                        break
        Severity: Major
        Found in bpforms/alphabet/protein.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if code not in code_freq:
                                  code_freq[code] = 0
                              code_freq[code] += 1
          Severity: Major
          Found in examples/modomics.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if monomer is None:
                                    unsupported_codes.add(code)
                                    monomer = bpforms.Monomer(id=code)
                                else:
                                    monomer_codes[code] = monomer
            Severity: Major
            Found in examples/modomics.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if numpy.isinf(start_position):
                                      protein['modified_errors'].append('Sequence does not contain residues {} for modification {}'.format(
                                          ', '.join(origin), modification['monomer']))
                                  else:
                                      monomer2.start_position = start_position
              Severity: Major
              Found in examples/pro.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if modification['residue'] not in canonical_code_freq:
                                        canonical_code_freq[modification['residue']] = 0
                                    if modification['monomer'] not in code_freq:
                Severity: Major
                Found in examples/pro.py - About 45 mins to fix

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

                      def _default(self):
                          args = self.app.pargs
                          type = bpforms.util.get_form(args.alphabet)
                  
                          try:
                  Severity: Minor
                  Found in bpforms/__main__.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 identifier.ns == 'pdb-ccd':
                                              monomer = None
                                              break
                                  if monomer is not None and (
                  Severity: Major
                  Found in bpforms/alphabet/dna.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if len(entry.org_taxid) == 1:
                                            # does not include those whose taxid is 'unidentified' or 'synthetic'
                                            taxid = list(entry.org_taxid)[0]
                                            if taxid != 32630 and taxid != 32644:
                    
                    
                    Severity: Major
                    Found in examples/pdb_analysis.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if key == 'comment' and value.startswith('Category=organism-modification.'):
                                              proteins.append(protein)
                      
                              # save PRO in pickle format
                              with open(pkl_filename, 'wb') as file:
                      Severity: Major
                      Found in examples/pro.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if position >= processing['start'] and position <= processing['end']:
                                                processed_position = seq_len + position - processing['start'] + 1
                                                break
                                            seq_len += processing['end'] - processing['start'] + 1
                        Severity: Major
                        Found in examples/pro.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if key == 'Symbol':
                                                      id = child.text
                                                  elif key == 'Common name':
                                                      name = child.text
                                                  elif key == 'CA registry numbers' and child.text.startswith('ribonucleoside '):
                          Severity: Major
                          Found in bpforms/alphabet/rna.py - About 45 mins to fix

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

                                def build(self, ph=None, major_tautomer=False, dearomatize=False):
                                    """ Build alphabet
                            
                                    Args:
                                        ph (:obj:`float`, optional): pH at which to calculate the major protonation state of each monomeric form
                            Severity: Minor
                            Found in bpforms/alphabet/dna.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 monomer is None:
                                                    unsupported_codes.add(code)
                                                    monomer = bpforms.Monomer(id=code)
                                                else:
                                                    monomer_codes[code] = monomer
                            Severity: Major
                            Found in examples/modomics.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if monomer.comments:
                                                          monomer.comments += ' ' + comments
                                                      else:
                                                          monomer.comments = comments
                              
                              
                              Severity: Major
                              Found in bpforms/alphabet/dna.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        if identifier.ns == 'pdb-ccd':
                                                            monomer = None
                                                            break
                                                if monomer is not None and (\
                                Severity: Major
                                Found in bpforms/alphabet/rna.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      if protein['processing'][-1]['end'] == len(form.seq):
                                                          seq_features[0]['positions'].pop(len(seq_features[0]['positions']) - 1)
                                  
                                  
                                  Severity: Major
                                  Found in examples/pro.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if name is not None:
                                                                names.append(name)
                                    
                                    
                                    Severity: Major
                                    Found in bpforms/alphabet/protein.py - About 45 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language