nicoulaj/rainbow

View on GitHub

Showing 30 of 30 total issues

Avoid deeply nested control flow statements.
Open

                            for line in lines[:-1]:
                                os.write(write_fd, self.encode(transformer.transform(line) + '\n'))
                            if lines[-1]:
Severity: Major
Found in rainbow/command/execute.py - About 45 mins to fix

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

    def run(self):
        clean.run(self)
        if self.all:
            for path in [path.strip() for path in self.paths.split(',')]:
                if os.path.isdir(path):
Severity: Minor
Found in rainbow/build.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 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, name, help, short_option=None, long_option=None, before=None, after=None):
Severity: Minor
Found in rainbow/filter.py - About 45 mins to fix

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

    def __init__(self,
                 paths=None,
                 stdout_builder=None,
                 stderr_builder=None,
                 error_handler=lambda error: None):
Severity: Minor
Found in rainbow/cli.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

Avoid deeply nested control flow statements.
Open

                        if enable_stderr_filtering:
                            self.stderr_builder.add_mapping(pattern, resolved_filter)

Severity: Major
Found in rainbow/config/parser.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                            for read_fd in buffers:
                                buffers[read_fd] = ''
                        else:
Severity: Major
Found in rainbow/command/execute.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                            if lines[0] and buffers[read_fd]:
                                os.write(write_fd, self.encode('\r'))
                            for line in lines[:-1]:
Severity: Major
Found in rainbow/command/execute.py - About 45 mins to fix

Function find_config_name_from_command_line has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def find_config_name_from_command_line(command_line_args):
        for arg in command_line_args:
            if arg[0] != '-':
                basename = os.path.basename(arg)
                if basename not in PRECOMMANDS:
Severity: Minor
Found in rainbow/config/loader.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 parse_args has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_args(self, args=None, values=None):

        try:
            (values, remaining_args) = OptionParser.parse_args(self, args=args)
        except SystemExit:
Severity: Minor
Found in rainbow/cli.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 makeparentdirs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def makeparentdirs(path):
    directory = os.path.dirname(path)
    if not os.path.exists(directory):  # no cover
        try:
            os.makedirs(directory)
Severity: Minor
Found in rainbow/build.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