Showing 22 of 22 total issues
File pizzacutter.py
has 646 lines of code (exceeds 250 allowed). Consider refactoring. Open
# STDLIB
import logging
import os
import pprint
from typing import List, Optional, Union, BinaryIO
Function path_replace_pathlib_patterns
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def path_replace_pathlib_patterns(self, path_source_path: pathlib.Path) -> pathlib.Path:
"""
Returns the resolved Target Path
>>> # Setup
- 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
PizzaCutter
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class PizzaCutter(object):
""" Builds or rebuilds a project """
def __init__(self,
# the path to the PizzaCutter conf File
Function log_unfilled_patterns_in_path
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def log_unfilled_patterns_in_path(self, _path: pathlib.Path) -> List[str]:
"""
logs unfilled patterns in the path name of a file
>>> # Setup
- 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 14 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function log_unfilled_pattern_in_object
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def log_unfilled_pattern_in_object(self, path_object: pathlib.Path) -> List[str]:
"""
find unfilled patterns in the file contents.
we search for bytes, because we dont know the encoding of the file
- 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 a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self,
# the path to the PizzaCutter conf File
path_conf_file: pathlib.Path,
# the path to the Template Folder - can be set by the conf File to the Directory the conf file sits - can be overridden by untrusted conf_file
path_template_dir: Optional[pathlib.Path] = 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 skip_write_outside_project_folder
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def skip_write_outside_project_folder(self, path_target_object: pathlib.Path, quiet: Optional[bool] = None) -> bool:
""" Check if skipped because outside project folder not allowed """
skip_outside_write = False
- 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 skip_overwrite
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def skip_overwrite(self, path_source_object: pathlib.Path, path_target_object: pathlib.Path) -> bool:
""" check if overwrite is allowed """
if self.conf.pizza_cutter_options['object_no_overwrite'] in str(path_source_object) and path_target_object.exists():
return True
- 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 copy_files_from_template_to_project
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def copy_files_from_template_to_project(self) -> None:
"""
Builds or rebuilds a project
>>> # Setup
- 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 find_version_number_in_file
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def find_version_number_in_file(path_txt_file: pathlib.Path) -> str:
"""
this function can be used in the PizzaCutter Template to extrect the Version Numer
from a text file (usually CHANGES.rst)
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self,
# the path to the actual config File
pizza_cutter_path_conf_file: Optional[pathlib.Path] = None,
# the default for the template Folder is the actual directory of the given config File
pizza_cutter_path_template_dir: Optional[pathlib.Path] = 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 build
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def build(path_conf_file: pathlib.Path,
Function build
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def build(conf_file: str, template_dir: str = '', target_dir: str = '', dry_run: bool = False, overwrite: bool = False, write_outside: bool = False) -> None:
Function cli_build
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def cli_build(conf_file: str, template_dir: str = '', target_dir: str = '',
Avoid deeply nested control flow statements. Open
if target_object_part.is_absolute() and absolute_path_found:
logger.warning(
'the resulting path might be unexpected, You have more then one absolute pathlib.Path pattern in the path: '
f'"{path_source_path}", Pattern: "{pattern}" points to "{replacement}"')
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function import_module_from_file
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def import_module_from_file(module_fullpath: Union[pathlib.Path, str], reload: bool = False): # type: ignore
"""
TODO : replace with lib_import when avail maybe take from pycharm, there we do the full coverage ...
>>> # re-import from file
- 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 replace_patterns_in_files
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def replace_patterns_in_files(self) -> None:
"""
replaces the patterns in each file
"""
- 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"