grammy-jiang/doe2-sim-parser

View on GitHub

Showing 36 of 70 total issues

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

def render_pep440_old(pieces):
    """TAG[.postDISTANCE[.dev0]] .

    The ".dev0" means dirty.

Severity: Minor
Found in versioneer.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 render_pep440_old has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def render_pep440_old(pieces):
    """TAG[.postDISTANCE[.dev0]] .

    The ".dev0" means dirty.

Severity: Minor
Found in doe2_sim_parser/_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 render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def render(pieces, style):
    """Render the given version pieces into the requested style."""
    if pieces["error"]:
        return {"version": "unknown",
                "full-revisionid": pieces.get("long"),
Severity: Minor
Found in versioneer.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 render_pep440_post has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def render_pep440_post(pieces):
    """TAG[.postDISTANCE[.dev0]+gHEX] .

    The ".dev0" means dirty. Note that .dev0 sorts backwards
    (a dirty tree will appear "older" than the corresponding clean one),
Severity: Minor
Found in doe2_sim_parser/_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 render_pep440 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def render_pep440(pieces):
    """Build up version string, with post-release "local version identifier".

    Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
    get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
Severity: Minor
Found in versioneer.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 run_command has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
Severity: Minor
Found in doe2_sim_parser/_version.py - About 45 mins to fix

    Function run_command has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
    Severity: Minor
    Found in versioneer.py - About 45 mins to fix

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

          def _read_sim(self) -> Generator[SingleReport, None, None]:
              report: List[str] = []
              with self.path.open(mode='r') as f:
                  for line in f.readlines():
                      if PATTERN_REPORT_HEAD.search(line):
      Severity: Minor
      Found in doe2_sim_parser/sim.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Minor
      Found in doe2_sim_parser/report.py - About 45 mins to fix

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

        def read_sim(path: Path) -> Generator[Report, None, None]:
            """
            read a sim report and yield the reports of it one by one, with parsed the
            report name
            :param path: the path of sim report
        Severity: Minor
        Found in doe2_sim_parser/split_sim.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 too many return statements within this function.
        Open

            return {"version": "0+unknown", "full-revisionid": None,
        Severity: Major
        Found in versioneer.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return {"version": "0+unknown", "full-revisionid": None,
          Severity: Major
          Found in doe2_sim_parser/_version.py - About 30 mins to fix

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

            def get_root():
                """Get the project root directory.
            
                We require that all commands are run from the project root, i.e. the
                directory that contains setup.py, setup.cfg, and versioneer.py .
            Severity: Minor
            Found in versioneer.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 parse_contents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def parse_contents(lines: List[str]):
                content = []
                counter = None
            
                for i, [l_1, l_2, l_3] in enumerate(chunks(lines, 3)):
            Severity: Minor
            Found in doe2_sim_parser/parse_report_bepu.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 parse_one_hourly_report has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def parse_one_hourly_report(report: Dict[int, List[Report]]):
                _reports: Dict = defaultdict(list)
            
                for no, reports in report.items():
                    _reports[('MM', 'DD', 'HH')].extend(get_columns(reports[0])[3:])
            Severity: Minor
            Found in doe2_sim_parser/parse_hourly_report.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 get_versions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_versions():
                """Get version information or return default if unable to do so."""
                # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have
                # __file__, we can work backwards from there to the root. Some
                # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which
            Severity: Minor
            Found in doe2_sim_parser/_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

            Severity
            Category
            Status
            Source
            Language