shiwaforce/poco

View on GitHub
poco/services/environment_utils.py

Summary

Maintainability
A
45 mins
Test Coverage
C
76%

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

    def check_version(current_version, is_beta_tester, is_force_check):
        if (EnvironmentUtils.need_check() or is_force_check):
            # check pip
            p = Popen("pip install poco==", stdout=PIPE, stderr=PIPE, shell=True)
            out, err = p.communicate()
Severity: Minor
Found in poco/services/environment_utils.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

Continuation line under-indented for visual indent
Open

                                        "Please upgrade with: pip install poco==" + newest_version)
Severity: Minor
Found in poco/services/environment_utils.py by pep8

Continuation lines indentation.

Continuation lines should align wrapped elements either vertically
using Python's implicit line joining inside parentheses, brackets
and braces, or using a hanging indent.

When using a hanging indent these considerations should be applied:
- there should be no arguments on the first line, and
- further indentation should be used to clearly distinguish itself
  as a continuation line.

Okay: a = (\n)
E123: a = (\n    )

Okay: a = (\n    42)
E121: a = (\n   42)
E122: a = (\n42)
E123: a = (\n    42\n    )
E124: a = (24,\n     42\n)
E125: if (\n    b):\n    pass
E126: a = (\n        42)
E127: a = (24,\n      42)
E128: a = (24,\n    42)
E129: if (a or\n    b):\n    pass
E131: a = (\n    42\n 24)

There are no issues that match your filters.

Category
Status