sonntagsgesicht/regtest

View on GitHub

Showing 7 of 7 total issues

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

    def open(self, filename, mode="rb", *args, **kwargs):
        folderpath = join(self.folder, self.__class__.__name__)
        if not exists(folderpath) and 'w' in mode:
            makedirs(folderpath, exist_ok=True)

Severity: Minor
Found in regtest/regtest.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 assertAlmostRegressiveEqual has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def assertAlmostRegressiveEqual(
Severity: Minor
Found in regtest/regtest.py - About 35 mins to fix

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

        def validateResults(self):
            # validate all values have been used
            for key in self._new_results:
                leftover = self._last_results.get(key)
                if leftover:
    Severity: Minor
    Found in regtest/regtest.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 _read_last has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _read_last(self, key=()):
            testmethod = self._get_testmethod()
            key = key if key else testmethod
            if key in self._last_results:
                if self._last_results[key]:
    Severity: Minor
    Found in regtest/regtest.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 writeResults has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def writeResults(self):
            msg = 'write to %s' % (self.folder + sep)
            for test_method, data in list(self._new_results.items()):
                if test_method not in self._last_results:
                    if msg:
    Severity: Minor
    Found in regtest/regtest.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 assertRegressiveEqual has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def assertRegressiveEqual(self, new, msg=None, key=()):
            # version 0.3.1, fixing tuple as list issue 'loads(dumps(tuple))=list'
            if isinstance(new, (tuple, set, list)):
                new = loads(dumps(list(new)))
            self._write_new(new, key)
    Severity: Minor
    Found in regtest/regtest.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 assertAlmostRegressiveEqual has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def assertAlmostRegressiveEqual(
                self, new, places=7, msg=None, delta=None, key=()):
            # version 0.3.1, fixing tuple as list issue 'loads(dumps(tuple))=list'
            if isinstance(new, (tuple, set, list)):
                new = loads(dumps(list(new)))
    Severity: Minor
    Found in regtest/regtest.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

    Severity
    Category
    Status
    Source
    Language