grammy-jiang/doe2-sim-parser

View on GitHub

Showing 70 of 70 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    refs = set([r.strip() for r in refnames.strip("()").split(",")])
Severity: Minor
Found in doe2_sim_parser/_version.py and 1 other location - About 35 mins to fix
versioneer.py on lines 992..992

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    refs = set([r.strip() for r in refnames.strip("()").split(",")])
Severity: Minor
Found in versioneer.py and 1 other location - About 35 mins to fix
doe2_sim_parser/_version.py on lines 180..180

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    def plus_or_dot(pieces):
        """Return a + if we don't already have one, else return a ."""
        if "+" in pieces.get("closest-tag", ""):
            return "."
        return "+"
    Severity: Minor
    Found in versioneer.py and 1 other location - About 30 mins to fix
    doe2_sim_parser/_version.py on lines 308..312

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 32.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      def plus_or_dot(pieces):
          """Return a + if we don't already have one, else return a ."""
          if "+" in pieces.get("closest-tag", ""):
              return "."
          return "+"
      Severity: Minor
      Found in doe2_sim_parser/_version.py and 1 other location - About 30 mins to fix
      versioneer.py on lines 1229..1233

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 32.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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