aburrell/aacgmv2

View on GitHub

Showing 17 of 17 total issues

File wrapper.py has 455 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright (C) 2019 NRL 
# Author: Angeline Burrell
# Disclaimer: This code is under the MIT license, whose details can be found at
# the root in the LICENSE file
#
Severity: Minor
Found in aacgmv2/wrapper.py - About 6 hrs to fix

    Function convert_latlon_arr has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

    def convert_latlon_arr(in_lat, in_lon, height, dtime, method_code="G2A"):
        """Converts between geomagnetic coordinates and AACGM coordinates.
    
        Parameters
        ------------
    Severity: Minor
    Found in aacgmv2/wrapper.py - About 5 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

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

        if coeff_prefix is not False:
            # Use the default value, if one was not supplied (allow None to
            # comply with depricated behaviour)
            if coeff_prefix is True or coeff_prefix is None:
                coeff_prefix = aacgmv2.AACGM_v2_DAT_PREFIX
    Severity: Major
    Found in aacgmv2/wrapper.py and 1 other location - About 4 hrs to fix
    aacgmv2/wrapper.py on lines 151..161

    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 81.

    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 igrf_file is not False:
            # Use the default value, if one was not supplied (allow None to
            # comply with depricated behaviour)
            if igrf_file is True or igrf_file is None:
                igrf_file = aacgmv2.IGRF_COEFFS
    Severity: Major
    Found in aacgmv2/wrapper.py and 1 other location - About 4 hrs to fix
    aacgmv2/wrapper.py on lines 138..148

    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 81.

    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

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

        try:
            c_aacgmv2.set_datetime(dtime.year, dtime.month, dtime.day, dtime.hour,
                                   dtime.minute, dtime.second)
        except TypeError as terr:
            raise TypeError("unable to set time for {:}: {:}".format(dtime, terr))
    Severity: Major
    Found in aacgmv2/wrapper.py and 1 other location - About 3 hrs to fix
    aacgmv2/wrapper.py on lines 378..385

    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 69.

    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

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

        try:
            c_aacgmv2.set_datetime(dtime.year, dtime.month, dtime.day, dtime.hour,
                                   dtime.minute, dtime.second)
        except TypeError as terr:
            raise TypeError("unable to set time for {:}: {:}".format(dtime, terr))
    Severity: Major
    Found in aacgmv2/wrapper.py and 1 other location - About 3 hrs to fix
    aacgmv2/wrapper.py on lines 238..245

    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 69.

    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 'AACGM_v2_DAT_PREFIX' in _os.environ.keys():
        # Check and see if this environment variable is the same or different
        if not _os.environ['AACGM_v2_DAT_PREFIX'] == AACGM_v2_DAT_PREFIX:
            stderr.write("".join(["resetting environment variable ",
                                  "AACGM_v2_DAT_PREFIX in python script\n"]))
    Severity: Major
    Found in aacgmv2/__init__.py and 1 other location - About 2 hrs to fix
    aacgmv2/__init__.py on lines 87..92

    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 61.

    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 'IGRF_COEFFS' in _os.environ.keys():
        # Check and see if this environment variable is the same or different
        if not _os.environ['IGRF_COEFFS'] == IGRF_COEFFS:
            stderr.write("".join(["resetting environment variable IGRF_COEFFS in ",
                                  "python script\n"]))
    Severity: Major
    Found in aacgmv2/__init__.py and 1 other location - About 2 hrs to fix
    aacgmv2/__init__.py on lines 95..100

    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 61.

    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 set_coeff_path has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def set_coeff_path(igrf_file=False, coeff_prefix=False):
        """Sets the IGRF_COEFF and AACGMV_V2_DAT_PREFIX environment variables.
    
        Parameters
        -----------
    Severity: Minor
    Found in aacgmv2/wrapper.py - About 1 hr 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 main has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def main():
        """Entry point for the script"""
    
        desc = 'Converts between geographical coordinates, AACGM-v2, and MLT'
        parser = argparse.ArgumentParser(description=desc)
    Severity: Minor
    Found in aacgmv2/__main__.py - About 1 hr to fix

      Function convert has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def convert(lat, lon, alt, date=None, a2g=False, trace=False, allowtrace=False,
      Severity: Major
      Found in aacgmv2/deprecated.py - About 1 hr to fix

        Function convert_latlon has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def convert_latlon(in_lat, in_lon, height, dtime, method_code="G2A"):
            """Converts between geomagnetic coordinates and AACGM coordinates
        
            Parameters
            ------------
        Severity: Minor
        Found in aacgmv2/wrapper.py - About 55 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 get_aacgm_coord has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def get_aacgm_coord(glat, glon, height, dtime, method="TRACE"):
        Severity: Minor
        Found in aacgmv2/wrapper.py - About 35 mins to fix

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

          def get_aacgm_coord_arr(glat, glon, height, dtime, method="TRACE"):
          Severity: Minor
          Found in aacgmv2/wrapper.py - About 35 mins to fix

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

            def convert_latlon_arr(in_lat, in_lon, height, dtime, method_code="G2A"):
            Severity: Minor
            Found in aacgmv2/wrapper.py - About 35 mins to fix

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

              def convert_bool_to_bit(a2g=False, trace=False, allowtrace=False,
              Severity: Minor
              Found in aacgmv2/wrapper.py - About 35 mins to fix

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

                def convert_latlon(in_lat, in_lon, height, dtime, method_code="G2A"):
                Severity: Minor
                Found in aacgmv2/wrapper.py - About 35 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language