harens/seaport

View on GitHub

Showing 9 of 9 total issues

Function clip has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def clip(
    name: str,
    bump: Optional[str],
    test: bool,
    lint: bool,
Severity: Minor
Found in seaport/_clipboard/clipboard.py - About 4 hrs 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 pr has 15 arguments (exceeds 4 allowed). Consider refactoring.
Open

def pr(
Severity: Major
Found in seaport/_pull_request/pull_request.py - About 1 hr to fix

    Function clip has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def clip(
    Severity: Major
    Found in seaport/_clipboard/clipboard.py - About 1 hr to fix

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

      def new_checksums(
          website: Annotated[str, Is[lambda text: text[:4] == "http"]],
          distfile: Optional[Port] = None,
      ) -> Tuple[str, str, str]:
          """Generate checksums of file downloaded from website.
      Severity: Minor
      Found in seaport/_clipboard/portfile/checksums.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 new_version has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def new_version(port: Port, stated: Optional[str], new: bool = False) -> str:
          """Determines livecheck version, and sees whether already up-to-date.
      
          Args:
              port: The port class
      Severity: Minor
      Found in seaport/_clipboard/portfile/portfile_numbers.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 perform_test has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def perform_test(name: str, subport: Optional[str] = None) -> bool:
          """Tests the port and checks output for errors.
      
          Args:
              name: The name of the port
      Severity: Minor
      Found in seaport/_clipboard/additional.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 "/usr/bin"
      Severity: Major
      Found in seaport/_clipboard/checks.py - About 30 mins to fix

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

        def user_path(
            port: bool = False, third_party: bool = False, manual: Optional[str] = None
        ) -> str:
            """Determines the bin path to prevent starting a process with a partial executable path.
        
        
        Severity: Minor
        Found in seaport/_clipboard/checks.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, name: str) -> None:
                """Set optional attributes and check if port exists."""
                # TODO: Figure out how to find path without subprocess
                # TODO: Refactor this
                # TODO: This also kind of defeats the purpose of that bandit error, so find a better way to determine the path
        Severity: Minor
        Found in seaport/portfile.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