KarrLab/bcforms

View on GitHub

Showing 120 of 120 total issues

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

    def __init__(self, l_bond_atoms=None, r_bond_atoms=None, l_displaced_atoms=None, r_displaced_atoms=None,
Severity: Major
Found in bcforms/core.py - About 50 mins to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                @lark.v_args(inline=True)
                def inline_crosslink_stereo(self, *args):
                    return ('stereo', BondStereo[args[-2].value])
    Severity: Minor
    Found in bcforms/core.py and 1 other location - About 50 mins to fix
    bcforms/core.py on lines 1730..1732

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 36.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                @lark.v_args(inline=True)
                def inline_crosslink_order(self, *args):
                    return ('order', BondOrder[args[-2].value])
    Severity: Minor
    Found in bcforms/core.py and 1 other location - About 50 mins to fix
    bcforms/core.py on lines 1734..1736

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 36.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

        def get_genomic_image(self, seq_features=None, width=1200, cols=2, nt_per_track=80, **kwargs):
    Severity: Minor
    Found in bcforms/core.py - About 45 mins to fix

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

          def get_details(self):
              """ Get the full details of the crosslink in a dictionary
      
              Returns:
                  :obj:`dict`: detailed information of the crosslink
      Severity: Minor
      Found in bcforms/core.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

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

                          component_dict[args[0][0]] = args[0][1]
      Severity: Major
      Found in bcforms/core.py and 2 other locations - About 45 mins to fix
      bcforms/core.py on lines 1610..1610
      bcforms/core.py on lines 1614..1614

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 35.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  if 'stoichiometry' in subunit:
                      new_subunit['stoichiometry'] = subunit['stoichiometry']
                  else:
                      raise ValueError('`subunit` has no `stoichiometry`')
      Severity: Minor
      Found in bcforms/core.py and 1 other location - About 45 mins to fix
      bcforms/core.py on lines 1800..1803

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 35.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

          def __init__(self, l_bond_atoms=None, r_bond_atoms=None, l_displaced_atoms=None, r_displaced_atoms=None,
                       order=BondOrder.single, stereo=None,
                       comments=None):
              """
      
      
      Severity: Minor
      Found in bcforms/core.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 update_tab_name has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      function update_tab_name() {
          for (var i=0; i<num_subunits; i++) {
              if ($('#panel'+i).length) {
                  name = $('#name'+i+'').val()
                  if (name != null && name != '') {
      Severity: Minor
      Found in bcforms/web/app.js - 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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, id, stoichiometry, structure=None, formula=None, mol_wt=None, charge=None):
      Severity: Minor
      Found in bcforms/core.py - About 45 mins to fix

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

            def clean(self):
                """ Clean up the subunits and the crosslinks
        
                For example, convert `1 * a + 1 * a` to `2 * a`
        
        
        Severity: Minor
        Found in bcforms/core.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

                                for i_atom, atom in atom_type.items():
                                    atom_type[i_atom] = mol.GetAtom(atom)
        
                # mol.AddHydrogens()
        
        
        Severity: Major
        Found in bcforms/core.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if encoding == 'bpforms.ProteinForm':
                                      try:
                                          subunit_structure = bpforms.ProteinForm().from_str(subunit['structure'])
                                          sum_length += len(subunit_structure) * bc_form.get_subunit_attribute(subunit_id, 'stoichiometry')
                                          bc_form.set_subunit_attribute(subunit_id, 'structure', subunit_structure)
          Severity: Major
          Found in bcforms/rest.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if 'formula' in subunit:
                                        try:
                                            bc_form.set_subunit_attribute(subunit_id, 'formula', subunit['formula'])
                                        except Exception as error:
                                            flask_restplus.abort(400, 'Unable to parse formula', errors={'formula': str(error)})
            Severity: Major
            Found in bcforms/rest.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if next(subunit for subunit in self_subunits_subunits if subunit.id == atom.subunit).stoichiometry > 1:
                                          errors.append("crosslink {} contains multiple subunit '{}', so the subunit_idx of atom '{}[{}]' cannot be None".format(
                                              i_crosslink + 1, atom.subunit, atom_type, i_atom))
                                  elif atom.subunit_idx > next(subunit for subunit in self_subunits_subunits if subunit.id == atom.subunit).stoichiometry:
              Severity: Major
              Found in bcforms/core.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        for i_atom, atom in atom_type.items():
                                            atom_type[i_atom] = atom+n_atoms[i_subunit]
                            atom_maps.append(atom_map)
                Severity: Major
                Found in bcforms/core.py - About 45 mins to fix

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

                      def structure(self, value):
                          """ Set the structure of the subunit
                  
                          * setting structure will automaticall set formula, mol_wt, charge
                  
                  
                  Severity: Minor
                  Found in bcforms/core.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 is_equal has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def is_equal(self, other):
                          """ Check if two atoms are semantically equal (belong to the same subunit/monomer and
                          have the same element, position, and charge)
                  
                          Args:
                  Severity: Minor
                  Found in bcforms/core.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

                                          for i_atom, atom in atom_type.items():
                                              if atom is not None:
                                                  atom_type[i_atom] = atom.GetIdx()
                  
                  
                  Severity: Major
                  Found in bcforms/core.py - About 45 mins to fix

                    Similar blocks of code found in 3 locations. Consider refactoring.
                    Open

                                        component_dict[args[1][0]] = args[1][1]
                    Severity: Major
                    Found in bcforms/core.py and 2 other locations - About 45 mins to fix
                    bcforms/core.py on lines 1610..1610
                    bcforms/core.py on lines 1613..1613

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 35.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language