pacificclimate/modelmeta

View on GitHub

Showing 29 of 67 total issues

File index_netcdf.py has 1040 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding=utf-8

"""Functions for adding NetCDF files to the modelmeta database.

The root function is `index_netcdf_file`, which causes a NetCDF file to be
Severity: Major
Found in mm_cataloguer/index_netcdf.py - About 2 days to fix

    File v2.py has 464 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    Define v2 modelmeta database in SQLAlchemy using declarative base.
    """
    __all__ = '''
        Base
    Severity: Minor
    Found in modelmeta/v2.py - About 7 hrs to fix

      Function find_update_or_insert_cf_file has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      def find_update_or_insert_cf_file(sesh, cf):  # get.data.file.id
          """Find, update, or insert a NetCDF file in the modelmeta database,
          according to whether it is already present and up to date.
      
          :param sesh: modelmeta database session
      Severity: Minor
      Found in mm_cataloguer/index_netcdf.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 create has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def create(args):
          log.info("Using dsn: {}".format(args.dsn))
          log.info('Writing to file: {}'.format(args.outfile))
          log.info('Formatting for ncWMS version {}'.format(args.version))
      
      
      Severity: Minor
      Found in ncwms_configurator/__init__.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_element has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_element(element_name, atts={}, **kwargs):
          '''
          Generates a general xml element with provided name, attributes (dictionary), and basic
          children with text
          '''
      Severity: Minor
      Found in ncwms_configurator/__init__.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 nc_copy has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      def nc_copy(source_fp, dest_fp, time_dimension, time_indices, variables):
          print('nc_copy({source_fp}, {dest_fp}, {time_dimension}, {time_indices}, {variables})'.format(**locals()))
      
          with Dataset(source_fp) as source:
              with Dataset(dest_fp, mode='w') as dest:
      Severity: Minor
      Found in scripts/nc-copy-modify.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 __init__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self,
                       datasets=None,
                       threddsCatalog=None,
                       contact=None,
                       server=None,
      Severity: Minor
      Found in ncwms_configurator/__init__.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 data_file_query has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def data_file_query(
              session,
              print_queries=False,
              ensemble=None,
              multi_variable=None,
      Severity: Minor
      Found in mm_cataloguer/list.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 _list_dirpaths has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def _list_dirpaths(
      Severity: Major
      Found in mm_cataloguer/list.py - About 1 hr to fix

        Function _list_filepaths has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def _list_filepaths(
        Severity: Major
        Found in mm_cataloguer/list.py - About 1 hr to fix

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

          def insert_data_file_variable_gridded(
          Severity: Major
          Found in mm_cataloguer/index_netcdf.py - About 50 mins to fix

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

                def __init__(self,
            Severity: Major
            Found in ncwms_configurator/__init__.py - About 50 mins to fix

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

              def data_file_query(
              Severity: Minor
              Found in mm_cataloguer/list.py - About 45 mins to fix

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

                def find_station(sesh, cf, i, name, x, y):
                Severity: Minor
                Found in mm_cataloguer/index_netcdf.py - About 45 mins to fix

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

                  def insert_station(sesh, cf, i, name, x, y):
                  Severity: Minor
                  Found in mm_cataloguer/index_netcdf.py - About 45 mins to fix

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

                    def associate_ensemble_to_filepaths(
                    Severity: Minor
                    Found in mm_cataloguer/associate_ensemble.py - About 45 mins to fix

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

                      def associate_ensemble_to_filepath(
                      Severity: Minor
                      Found in mm_cataloguer/associate_ensemble.py - About 45 mins to fix

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

                        def find_or_insert_station(sesh, cf, i, name, x, y):
                        Severity: Minor
                        Found in mm_cataloguer/index_netcdf.py - About 45 mins to fix

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

                          def _list_filepaths(
                                  session,
                                  print_queries=False,
                                  count=False,
                                  ensemble=None,
                          Severity: Minor
                          Found in mm_cataloguer/list.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 main has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def main(
                          Severity: Minor
                          Found in mm_cataloguer/associate_ensemble.py - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language