samdmarshall/pyconfig

View on GitHub

Showing 33 of 76 total issues

File Linter.py has 502 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright (c) 2016, Samantha Marshall (http://pewpewthespells.com)
# All rights reserved.
#
# https://github.com/samdmarshall/pyconfig
#
Severity: Major
Found in pyconfig/Analyzer/Linter.py - About 1 day to fix

File TypeConstants.py has 488 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright (c) 2016, Samantha Marshall (http://pewpewthespells.com)
# All rights reserved.
#
# https://github.com/samdmarshall/pyconfig
#
Severity: Minor
Found in pyconfig/Settings/TypeConstants.py - About 7 hrs to fix

Function validateIf has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

    def validateIf(self, scope_contents, index): # pylint: disable=too-many-branches
        status = True
        while status is True:
            should_try_reading_assignment = True
            # read `if`
Severity: Minor
Found in pyconfig/Analyzer/Linter.py - About 6 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 readConditionFromContent has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

def readConditionFromContent(content=None, index=None): # pylint: disable=too-many-branches
    status = True
    current_char = content[index]
    original_index = index
    for case in Switch(current_char):
Severity: Minor
Found in pyconfig/Analyzer/Linter.py - About 5 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 validateSetting has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    def validateSetting(self): # pylint: disable=too-many-branches
        status = True
        while status is True:
            self.current_keyword = Keyword.Constants._setting
            self.has_finished_exports = True
Severity: Minor
Found in pyconfig/Analyzer/Linter.py - About 4 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 validates has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    def validates(self): # pylint: disable=too-many-branches,too-many-statements
        should_advance = len(self.contents) > 0
        status = True
        while should_advance is True and status is True:
            Logger.write().debug('New read at (%i) line: %i, index: %i' % (self.index, self.line_number, self.char_number))
Severity: Minor
Found in pyconfig/Analyzer/Linter.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 GenerateSCMContents has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

def GenerateSCMContents(scm_type='detect'):
    scm_content_string = ''
    detect_mode = False
    for case in Switch(scm_type):
        if case('detect'):
Severity: Minor
Found in pyconfig/SCM/SCM.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

File Builtin.py has 269 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright (c) 2016, Samantha Marshall (http://pewpewthespells.com)
# All rights reserved.
#
# https://github.com/samdmarshall/pyconfig
#
Severity: Minor
Found in pyconfig/Settings/Builtin.py - About 2 hrs to fix

Function validateFor has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def validateFor(self, scope_contents, index):
        status = True
        while status is True:
            # read `for`
            status, read_count = readStringFromContent('for', scope_contents, index)
Severity: Minor
Found in pyconfig/Analyzer/Linter.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 readSettingScopeContent has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def readSettingScopeContent(self, scope_contents, original_index):
        status = True
        offset = original_index
        index = original_index - offset
        should_advance = index < len(scope_contents)
Severity: Minor
Found in pyconfig/Analyzer/Linter.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 readScopeFromContent has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def readScopeFromContent(starter, closer, content=None, index=None):
    current_char = content[index]
    error_msg = None
    status = current_char == starter
    scope_level = 0
Severity: Minor
Found in pyconfig/Analyzer/Linter.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 validateInclude has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def validateInclude(self):
        status = True
        while status is True:
            status = self.has_finished_includes is False
            if status is False: # pragma: no cover
Severity: Minor
Found in pyconfig/Analyzer/Linter.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 readScope has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def readScope(self, starter, closer):
        Logger.write().debug('Attempting to read content between matching `%s` and `%s`' % (starter, closer))
        current_char = self.contents[self.index]
        start_line_number = self.line_number
        start_char_number = self.char_number
Severity: Minor
Found in pyconfig/Analyzer/Linter.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 __runDuplicates has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def __runDuplicates(self, configuration):
        duplicate_results = findDuplicates(self.__namespace_table)
        for key, value in list(duplicate_results.items()):
            for file_containing_dups in value:
                if file_containing_dups == configuration.name:
Severity: Minor
Found in pyconfig/Analyzer/Engine.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 writeFile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def writeFile(config_node=None, scheme_name=None):
    """
    Takes a configuration file node object and a string of the scheme
    name and will write out a file to disk.
    """
Severity: Minor
Found in pyconfig/Serializer/Serializer.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 main has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def main(argv=sys.argv[1:]):
    # setup the argument parsing
    parser = argparse.ArgumentParser(description='pyconfig is a tool to generate xcconfig files from a simple DSL')
    parser.add_argument(
        '--version',
Severity: Minor
Found in pyconfig/main.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 validateExport has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def validateExport(self):
        status = True
        while status is True:
            status = self.has_finished_exports is False
            if status is False: # pragma: no cover
Severity: Minor
Found in pyconfig/Analyzer/Linter.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

Avoid deeply nested control flow statements.
Open

                        if status is False:
                            break # pragma: no cover
                        index += read_count
Severity: Major
Found in pyconfig/Analyzer/Linter.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if status is False:
                            break # pragma: no cover
                        index += read_count
Severity: Major
Found in pyconfig/Analyzer/Linter.py - About 45 mins to fix

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

    def readWhitespace(self, content=None, index=None):
        status, index_increase, line_increase, char_number, last_newline_increase, error = readWhitespace(content, index)
        # update error message
        if error is not None: # pragma: no cover
            self.error = '%s at line: %i, index: %i' % (error, self.line_number, self.char_number)
Severity: Minor
Found in pyconfig/Analyzer/Linter.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

Severity
Category
Status
Source
Language