Showing 6 of 6 total issues
File igittigitt.py
has 528 lines of code (exceeds 250 allowed). Consider refactoring. Open
# STDLIB
import glob
import os # noqa
import pathlib
import platform
Function _match_rules
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _match_rules(self, str_file_path: str, is_file: bool) -> bool:
"""
match without negations - in that case we can return
immediately after a match.
- 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 create_rule_variations
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_rule_variations(
Function parse_rule_file
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_rule_file(self, rule_file: PathLikeOrString, base_dir: Optional[PathLikeOrString] = None) -> None:
"""
parse a git ignore file, create rules from a gitignore file
Parameter
- 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 get_rules_from_git_pattern
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_rules_from_git_pattern(
git_pattern: str,
path_base_dir: pathlib.Path,
path_source_file: Optional[pathlib.Path] = None,
source_line_number: Optional[int] = None,
- 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 _add_default_patterns
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _add_default_patterns(self, path_base_dir: pathlib.Path, is_windows: Optional[bool] = None) -> None:
"""
add the default ignore patterns from user home directory. Those default patterns may reside at :
LINUX : $XDG_CONFIG_HOME/git/ignore, if not set or empty
- 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"