bitranox/pathlib3x

View on GitHub

Showing 25 of 25 total issues

Function _select_from has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _select_from(self, parent_path, is_dir, exists, scandir):
        try:
            yielded = set()
            try:
                successor_select = self.successor._select_from
Severity: Minor
Found in pathlib3x/pathlib3x.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

Avoid too many return statements within this function.
Open

                return False
Severity: Major
Found in pathlib3x/pathlib3x.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return True
    Severity: Major
    Found in pathlib3x/pathlib3x.py - About 30 mins to fix

      Function mkdir has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def mkdir(self, mode=0o777, parents=False, exist_ok=False):
              """
              Create a new directory at this given path.
              """
              try:
      Severity: Minor
      Found in pathlib3x/pathlib3x.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 _select_from has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _select_from(self, parent_path, is_dir, exists, scandir):
              try:
                  path = parent_path._make_child_relpath(self.name)
                  if (is_dir if self.dironly else exists)(path):
                      for p in self.successor._select_from(path, is_dir, exists, scandir):
      Severity: Minor
      Found in pathlib3x/pathlib3x.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