broomyocymru/ditto

View on GitHub

Showing 7 of 13 total issues

Function oss_licenses has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

def oss_licenses():
    meta_files_to_check = ['PKG-INFO', 'METADATA']
    licenses = {}

    for installed_distribution in get_installed_distributions():
Severity: Minor
Found in ditto/core/util.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

Function submit has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def submit(self, data=None):
        if config.get("analytics.enabled") == "Y":
            mask_values = logger.get_masks()

            if data is None:
Severity: Minor
Found in ditto/core/analytics.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_file has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def get_file(file_path):
    if file_path.startswith('http'):
        fname = file_path.split('/')[-1]
        if not os.path.exists(get_cache_dir()):
            os.makedirs(get_cache_dir())
Severity: Minor
Found in ditto/core/cache.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 shell_run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def shell_run(cmd, cwd=os.getcwd(), check_call=True, ctx=None):
    p = Popen(cmd, shell=True, cwd=cwd, stdin=PIPE, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
    output = ""
    while True:
        next_line = p.stdout.readline()
Severity: Minor
Found in ditto/core/util.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 confluence_create has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def confluence_create(url, username, password, space, parent_page, page, html_file):
Severity: Major
Found in ditto/commands/cmd_confluence.py - About 50 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if lic not in licenses:
                            licenses[lic] = []
                        licenses[lic].append(installed_distribution.project_name)
    Severity: Major
    Found in ditto/core/util.py - About 45 mins to fix

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

      def confluence_update(url, username, password, space, page, html_file):
      Severity: Minor
      Found in ditto/commands/cmd_confluence.py - About 45 mins to fix
        Severity
        Category
        Status
        Source
        Language