etcher-be/epab

View on GitHub
epab/utils/_repo.py

Summary

Maintainability
D
1 day
Test Coverage

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

    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 _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 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 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 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

      There are no issues that match your filters.

      Category
      Status