rosswhitfield/javelin

View on GitHub

Showing 56 of 116 total issues

File versioneer.py has 1326 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# flake8: noqa
# Version: 0.18

"""The Versioneer - like a rocketeer, but for versions.

Severity: Major
Found in versioneer.py - About 3 days to fix

    File structure.py has 586 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    =========
    structure
    =========
    """
    Severity: Major
    Found in javelin/structure.py - About 1 day to fix

      File grid.py has 493 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """
      ====
      grid
      ====
      """
      Severity: Minor
      Found in javelin/grid.py - About 7 hrs to fix

        File fourier.py has 440 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """
        =======
        fourier
        =======
        
        
        Severity: Minor
        Found in javelin/fourier.py - About 6 hrs to fix

          File _version.py has 377 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # flake8: noqa
          # This file helps to compute a version number in source trees obtained from
          # git-archive tarball (such as those provided by githubs download-from-tag
          # feature). Distribution tarballs (built by setup.py sdist) and build
          # directories (produced by setup.py build) will contain a much shorter file
          Severity: Minor
          Found in javelin/_version.py - About 5 hrs to fix

            Structure has 35 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Structure:
                """The structure class is made up of a **unitcell** and a list of **atoms**
            
                Structure can be initialize using either another
                :class:`javelin.structure.Structure`, :class:`ase.Atoms` or
            Severity: Minor
            Found in javelin/structure.py - About 4 hrs to fix

              Function _calculate has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _calculate(self, atomic_numbers, positions, unitcell=None, use_ff=True):
                      if self._fast and not self._cython:
                          qx, qy, qz = self.grid.get_squashed_q_meshgrid()
                      else:
                          qx, qy, qz = self.grid.get_q_meshgrid()
              Severity: Minor
              Found in javelin/fourier.py - About 3 hrs 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

              Grid has 28 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Grid:
                  """Grid class to allow the Q-space grid to be defined in different
                  ways. The grid can be defined be either specifying the corners of
                  the volume or by the axis vectors.
              
              
              Severity: Minor
              Found in javelin/grid.py - About 3 hrs to fix

                Function do_setup has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                def do_setup():
                    """Main VCS-independent setup function for installing Versioneer."""
                    root = get_root()
                    try:
                        cfg = get_config_from_root(root)
                Severity: Minor
                Found in versioneer.py - About 2 hrs 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 calc has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    def calc(self, structure):
                        """Calculates the fourier transform
                
                        :param structure: The structure from which fourier transform
                        is calculated. The calculation work with any of the following
                Severity: Minor
                Found in javelin/fourier.py - About 2 hrs 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 get_versions has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                def get_versions(verbose=False):
                    """Get the project version from whatever source is available.
                
                    Returns dict with two keys: 'version' and 'full'.
                    """
                Severity: Minor
                Found in versioneer.py - About 2 hrs 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 run_command has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
                                env=None):
                    """Call the given command(s)."""
                    assert isinstance(commands, list)
                    p = None
                Severity: Minor
                Found in versioneer.py - About 2 hrs 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 run_command has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
                                env=None):
                    """Call the given command(s)."""
                    assert isinstance(commands, list)
                    p = None
                Severity: Minor
                Found in javelin/_version.py - About 2 hrs 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 get_neighbors has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get_neighbors(self, site=0, target_site=None, minD=0.01, maxD=1.1):
                        """
                
                
                        Return a :class:`javelin.neighborlist.NeighborList` for the given sites and distances
                Severity: Minor
                Found in javelin/structure.py - About 2 hrs 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 git_get_keywords has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                def git_get_keywords(versionfile_abs):
                    """Extract version information from the given file."""
                    # the code embedded in _version.py can just fetch the value of these
                    # keywords. When used from setup.py, we don't want to import _version.py,
                    # so we do it with a regexp instead. This function is not used from
                Severity: Minor
                Found in versioneer.py - About 2 hrs 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 get_atomic_number_symbol has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                def get_atomic_number_symbol(Z=None, symbol=None):
                    """This function returns a tuple of matching arrays of atomic numbers
                    (Z) and chemical symbols (symbol).
                
                    :param Z: atomic numbers
                Severity: Minor
                Found in javelin/utils.py - About 2 hrs 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 git_get_keywords has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                def git_get_keywords(versionfile_abs):
                    """Extract version information from the given file."""
                    # the code embedded in _version.py can just fetch the value of these
                    # keywords. When used from setup.py, we don't want to import _version.py,
                    # so we do it with a regexp instead. This function is not used from
                Severity: Minor
                Found in javelin/_version.py - About 2 hrs 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 run has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def run(self, structure, inplace=False):  # noqa: C901
                        """Execute the Monte Carlo routine. You must provide the structure to
                        modify as a parameter. This will by default this will return a
                        new :class:`javelin.structure.Structure` with the results, to
                        modify the provided structure in place set `inplace=True`
                Severity: Minor
                Found in javelin/mc.py - About 2 hrs 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 cell has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def cell(self, *args):
                        """Sets the unit cell with either 1, 3 or 6 parameters corresponding
                        to cubic ``a`` parameters, ``(a, b, c)`` or ``(a, b, c, alpha,
                        beta, gamma)``, where angles are in degrees
                
                
                Severity: Minor
                Found in javelin/unitcell.py - About 2 hrs 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 git_versions_from_keywords has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                def git_versions_from_keywords(keywords, tag_prefix, verbose):
                    """Get version information from git keywords."""
                    if not keywords:
                        raise NotThisMethod("no keywords at all, weird")
                    date = keywords.get("date")
                Severity: Minor
                Found in javelin/_version.py - About 2 hrs 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