Showing 26 of 36 total issues
Function main
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def main(argv=None, directory=None):
"""
Main entry point for the tool, used by setup.py
Returns a value that can be passed into exit() specifying
the exit code.
- Read upRead up
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 tool.py
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Implement the command-line tool interface.
"""
from __future__ import unicode_literals
File diff_reporter.py
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Classes for querying which lines have changed based on a diff.
"""
from __future__ import unicode_literals
from abc import ABCMeta, abstractmethod
Function parse_reports
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def parse_reports(self, reports):
"""
Args:
reports: list[str] - output from the report
Return:
- Read upRead up
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_source_sections
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def _parse_source_sections(self, diff_str):
"""
Given the output of `git diff`, return a dictionary
with keys that are source file paths.
- Read upRead up
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 report_generator.py
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Classes for generating diff coverage reports.
"""
from __future__ import unicode_literals
from abc import ABCMeta, abstractmethod
Function _parse_lines
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _parse_lines(self, diff_lines):
"""
Given the diff lines output from `git diff` for a particular
source file, return a tuple of `(ADDED_LINES, DELETED_LINES)`
- Read upRead up
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 _group_tokens
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _group_tokens(cls, token_stream, range_list):
"""
Group tokens into snippet ranges.
`token_stream` is a generator that produces
- Read upRead up
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 violations_reporter.py
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Classes for querying the information in a test coverage report.
"""
from __future__ import unicode_literals
Function _git_diff
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def _git_diff(self):
"""
Run `git diff` and returns a dict in which the keys
are changed file paths and the values are lists of
line numbers.
- Read upRead up
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 violations
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def violations(self, src_path):
"""
Return a list of Violations recorded in `src_path`.
"""
if not any(src_path.endswith(ext) for ext in self.driver.supported_extensions):
- Read upRead up
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 _snippet_ranges
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _snippet_ranges(cls, num_src_lines, violation_lines):
"""
Given the number of source file lines and list of
violation line numbers, return a list of snippet
ranges of the form `(start_line, end_line)`.
- Read upRead up
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 _cache_file
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _cache_file(self, src_path):
"""
Load the data from `self._xml_roots`
for `src_path`, if it hasn't been already.
"""
- Read upRead up
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 combine_adjacent_lines
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def combine_adjacent_lines(line_numbers):
"""
Given a sorted collection of line numbers this will
turn them to strings and combine adjacent values
- Read upRead up
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_reports
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_reports(self, reports):
"""
Args:
reports: list[str] - output from the report
Return:
- Read upRead up
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 generate_coverage_report
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def generate_coverage_report(coverage_xml, compare_branch,
Function generate_quality_report
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def generate_quality_report(tool, compare_branch,
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _parse_hunk_line
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _parse_hunk_line(self, line):
"""
Given a hunk line in `git diff` output, return the line number
at the start of the hunk. A hunk is a segment of code that
contains changes.
- Read upRead up
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, compare_branch='origin/master', git_diff=None,