132nd-etcher/epab

View on GitHub

Showing 18 of 18 total issues

File _repo.py has 477 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding=utf-8
"""
Manages the local Git repo
"""
import logging
Severity: Minor
Found in epab/utils/_repo.py - About 7 hrs to fix

    BaseRepo has 38 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class BaseRepo(metaclass=ABCMeta):
        """
        Base class for a Repo object
        """
    
    
    Severity: Minor
    Found in epab/bases/repo.py - About 5 hrs to fix

      Repo has 37 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Repo(BaseRepo):
          """
          Wrapper for git.Repo
          """
      
      
      Severity: Minor
      Found in epab/utils/_repo.py - About 4 hrs to fix

        Function get_product_version has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_product_version(path: typing.Union[str, Path]) -> VersionInfo:
            """
            Get version info from executable
        
            Args:
        Severity: Minor
        Found in epab/utils/_exe_version.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 _parse_file_info has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        def _parse_file_info(file_info_list) -> typing.Optional['VersionInfo']:
            for _file_info in file_info_list:
                if _file_info.Key == b'StringFileInfo':  # pragma: no branch
                    for string in _file_info.StringTable:  # pragma: no branch
                        if b'FileVersion' in string.entries.keys():  # pragma: no branch
        Severity: Minor
        Found in epab/utils/_exe_version.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 _pytest has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        def _pytest(test, *, long, show, exitfirst, last_failed, failed_first, rm_cov):
            LOGGER.info('running test suite')
            os.environ['PYTEST_QT_API'] = 'pyqt5'
            _Coverage.install()
            cmd = f'pytest {test}'
        Severity: Minor
        Found in epab/cmd/_pytest.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 _sanitize_amend_commit_message has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def _sanitize_amend_commit_message(
                    self,
                    append_to_msg: typing.Optional[str] = None,
                    new_message: typing.Optional[str] = None,
                    previous_message: str = None,
        Severity: Minor
        Found in epab/utils/_repo.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 _pytest has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def _pytest(test, *, long, show, exitfirst, last_failed, failed_first, rm_cov):
        Severity: Major
        Found in epab/cmd/_pytest.py - About 1 hr to fix

          Function _next_alpha_version has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def _next_alpha_version(next_stable_version: str, list_of_tags: typing.List[Tag]) -> str:
              next_alpha_version_quantifier = 1
              if list_of_tags:
                  for tag in list_of_tags:
                      if not tag.is_alpha:
          Severity: Minor
          Found in epab/utils/_next_version.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 stash has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def stash(self, stash_name: str):
                  """
                  Stashes the current working tree changes
          
                  :param stash_name: name of the stash
          Severity: Minor
          Found in epab/utils/_repo.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 _graph has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def _graph():
              out_files = [
                  Path(f'packages_{config.PACKAGE_NAME()}.png').absolute(),
                  Path(f'classes_{config.PACKAGE_NAME()}.png').absolute(),
              ]
          Severity: Minor
          Found in epab/cmd/_graph.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 pytest has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def pytest(test, long, show, exitfirst, last_failed, failed_first, rm_cov):
          Severity: Major
          Found in epab/cmd/_pytest.py - About 50 mins to fix

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

                def amend_commit(
                        self,
                        append_to_msg: typing.Optional[str] = None,
                        new_message: typing.Optional[str] = None,
                        files_to_add: typing.Optional[typing.Union[typing.List[str], str]] = None,
            Severity: Minor
            Found in epab/utils/_repo.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 _chglog has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def _chglog(amend: bool = False, stage: bool = False, next_version: str = None, auto_next_version: bool = False):
                """
                Writes the changelog
            
                Args:
            Severity: Minor
            Found in epab/cmd/_chglog.py - About 35 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def __init__(self, tag_str: str) -> None:
                    self._tag_str = tag_str
                    self._tag: typing.Optional[typing.Match[str]] = self._re_tag.match(self._tag_str)
                    if not self._tag:
                        raise ValueError(f'Wrong value for tag string: {self._tag_str}')
            Severity: Minor
            Found in epab/utils/_next_version.py - About 35 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 _next_stable_version has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def _next_stable_version(calver: str, list_of_tags: typing.List[Tag]) -> str:
                next_version_quantifier = 1
                if list_of_tags:
                    for tag in list_of_tags:
                        if tag.is_alpha:
            Severity: Minor
            Found in epab/utils/_next_version.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 checkout has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def checkout(self, reference: str):
                    """
                    Checks out a reference.
            
                    If the index is dirty, or if the repository contains untracked files, the function will fail.
            Severity: Minor
            Found in epab/utils/_repo.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 _copy_artifacts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def _copy_artifacts():
                if config.ARTIFACTS():
                    folder = Path('./artifacts')
                    folder.mkdir(exist_ok=True)
                    for pattern in config.ARTIFACTS():
            Severity: Minor
            Found in epab/cmd/_release.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