eggplants/extension-manifest-converter

View on GitHub

Showing 15 of 15 total issues

Function _mv3 has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def _mv3(self) -> None:
        for root, dirs, files in os.walk(self.wrapper.destination, topdown=False):
            for name in files:
                if str(Path(name).suffix) != ".js":
                    continue
Severity: Minor
Found in emc/lib/modifiers/JSActionModifier.py - About 3 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 _mv3 has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def _mv3(self) -> None:
        needsChange = False
        for root, dirs, files in os.walk(self.wrapper.destination, topdown=False):
            for name in files:
                if str(Path(name).suffix) != ".js":
Severity: Minor
Found in emc/lib/modifiers/InsertCssModifier.py - About 3 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 _mv3 has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def _mv3(self) -> None:
        """
        from

        chrome.tabs.executeScript(
Severity: Minor
Found in emc/lib/modifiers/ExecuteScriptModifier.py - About 3 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 _mv3 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def _mv3(self) -> None:
        manifest = self.wrapper.manifest
        keys = ["permissions", "optional_permissions"]
        result: dict[str, Any] = {
            "permissions": [],
Severity: Minor
Found in emc/lib/modifiers/HostPermissionsModifier.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

Avoid deeply nested control flow statements.
Open

                        for item in search:
                            if data.find(item) == -1:
                                continue
                            if not isChanged:
                                isChanged = True
Severity: Major
Found in emc/lib/modifiers/JSActionModifier.py - About 45 mins to fix

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

        def __init__(self, args: dict[str, str]) -> None:
            source = args["source"]
            original_source = source
            dirname = os.path.dirname(source)
    
    
    Severity: Minor
    Found in emc/lib/frontend.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

    Avoid deeply nested control flow statements.
    Open

                            for line in infile:
                                outfile.write(line)
                        os.remove(scriptFile)
    Severity: Major
    Found in emc/lib/modifiers/ServiceWorkerModifier.py - About 45 mins to fix

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

          def extract(self, source: str, destination: str, foldername: str) -> None:
              sentinel = False
              with zipfile.ZipFile(source, "r") as zip_ref:
                  list = zip_ref.namelist()
                  if len(list) == 0:
      Severity: Minor
      Found in emc/utils/unzip.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

      Avoid deeply nested control flow statements.
      Open

                              if data.find(seek) == -1:
                                  continue
                              Logger().log("Updating to chrome.scripting.executeScript")
      Severity: Major
      Found in emc/lib/modifiers/ExecuteScriptModifier.py - About 45 mins to fix

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

            def _mv3(self) -> None:
                manifest = self.wrapper.manifest
                if "background" not in manifest or "scripts" not in manifest["background"]:
                    return
                Logger().log("Changing to background.service_worker in manifest.json")
        Severity: Minor
        Found in emc/lib/modifiers/ServiceWorkerModifier.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

        Avoid deeply nested control flow statements.
        Open

                                if data.find(seek) == -1:
                                    continue
                                Logger().log("Changing to chrome.scripting.insertCSS")
        Severity: Major
        Found in emc/lib/modifiers/InsertCssModifier.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if not isChanged:
                                      return
                                  Logger().log("Changed to chrome.action in .js files")
          Severity: Major
          Found in emc/lib/modifiers/JSActionModifier.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if not needsChange:
                                        needsChange = True
                                    file.seek(0)
            Severity: Major
            Found in emc/lib/modifiers/InsertCssModifier.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if not needsChange:
                                          needsChange = True
                                      file.seek(0)
              Severity: Major
              Found in emc/lib/modifiers/ExecuteScriptModifier.py - About 45 mins to fix

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

                    def work(self, source: str) -> None:
                        Logger().log(source)
                
                        # TODO: Can destination be a command line argument instead?
                        destination = source + "_delete"
                Severity: Minor
                Found in emc/lib/worker.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