mapaction/mapactionpy_controller

View on GitHub

Showing 18 of 23 total issues

File recipe_layer.py has 263 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging
import os
# import shapefile
import fiona
import glob
Severity: Minor
Found in mapactionpy_controller/recipe_layer.py - About 2 hrs to fix

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

        nr_dict = {
            'name_to_validate': name_result.name_to_validate,
            'is_parsable': name_result.is_parsable,
            'valid_clause_list': [
                {'valid_clause': clause_msg} for clause_msg in sorted(valid_clause_list)],
    Severity: Major
    Found in mapactionpy_controller/task_renderer.py and 1 other location - About 2 hrs to fix
    mapactionpy_controller/task_renderer.py on lines 202..208

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

    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

        nr_dict = {
            'name_to_validate': ncr.name_to_validate,
            'is_parsable': ncr.is_parsable,
            'valid_clause_list': [
                {'valid_clause': clause_msg} for clause_msg in sorted(valid_clause_list)],
    Severity: Major
    Found in mapactionpy_controller/task_renderer.py and 1 other location - About 2 hrs to fix
    mapactionpy_controller/task_renderer.py on lines 151..157

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

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

    def layer_reg_ex_adapter(recipe_lyr, cmf):
        """
        Creates context data to support human readable intepritation of the regex used to
        seach for datasets.
        The key to this adapter is the fact that in most cases the layer's `reg_ex` property
    Severity: Minor
    Found in mapactionpy_controller/task_renderer.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 parse_feedback has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse_feedback(status, msg, step, **kwargs):
        """
        This is called once per step execution.
        It provides a hook into print messages to the terminal, log files and the JIRA Client.
        """
    Severity: Minor
    Found in mapactionpy_controller/main_stack.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 _get_version_number has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_version_number():
        travis_build = environ.get('TRAVIS_BUILD_NUMBER')
        travis_tag = environ.get('TRAVIS_TAG')
        repo_slug = environ.get('TRAVIS_REPO_SLUG')
        if repo_slug:
    Severity: Minor
    Found in setup.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 __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, cmf, extension, verify_on_creation=True):
            """
            Positional Arguments:
                * cmf: Either a CrashMoveFolder object or a path to a cmf_description.json file. If it
                       is a CrashMoveFolder object and cmf.verify_paths() returns False then an
    Severity: Minor
    Found in mapactionpy_controller/layer_properties.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 __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, nc_json_path):
            self.nc_json_path = nc_json_path
            self._clause_validation = {}
    
            with open(self.nc_json_path) as json_file:
    Severity: Minor
    Found in mapactionpy_controller/name_convention.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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Confirmed

        def __init__(self, func, fail_threshold, running_msg, complete_msg, fail_msg):
    Severity: Minor
    Found in mapactionpy_controller/steps.py - About 35 mins to fix

      Function _get_requires_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def _get_requires_list():
          # Items for which the version does not need to be pinned to support py2.7
          requires = [
              'chevron',
              'dicttoxml',
      Severity: Minor
      Found in setup.py - About 35 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 search_issue_by_unique_summary has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def search_issue_by_unique_summary(self, search_summary, op_id):
              # Default if `op_id` is None
              jql_op_id = 'operational_id is EMPTY'
              if op_id:
                  jql_op_id = 'operational_id ~ "{}"'.format(op_id)
      Severity: Minor
      Found in mapactionpy_controller/jira_tasks.py - About 25 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_known_values has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _init_known_values(self, csv_path, csv_file, lookup_field):
              csv_reader = csv.DictReader(
                  csv_file, delimiter=',', quotechar='"')
      
              if lookup_field in csv_reader.fieldnames:
      Severity: Minor
      Found in mapactionpy_controller/name_clause_validators.py - About 25 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

      TODO found
      Confirmed

              # TODO read these in from a config file
      Severity: Minor
      Found in mapactionpy_controller/jira_tasks.py by fixme

      TODO found
      Open

              # TODO: This results in calling `os.path.join` twice for certain files
      Severity: Minor
      Found in mapactionpy_controller/plugin_base.py by fixme

      TODO found
      Open

              # TODO re-enable "Have the input files changed?"
      Severity: Minor
      Found in mapactionpy_controller/plugin_base.py by fixme

      TODO found
      Open

          # TODO: asmith 2020/03/03
      Severity: Minor
      Found in mapactionpy_controller/plugin_base.py by fixme

      TODO found
      Open

                  # TODO: This is hackish. It should really be evident from the DataClauseValues object

      TODO found
      Open

                  # TODO Review is it is possible in the case of warnings, to pass back an updated
      Severity: Minor
      Found in mapactionpy_controller/steps.py by fixme
      Severity
      Category
      Status
      Source
      Language