dotanuki-labs/bitrise-reports

View on GitHub

Showing 13 of 13 total issues

Function report has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def report(self, breakdowns):

        self.sheet.column_dimensions["A"].width = 25

        for column in ["A", "B", "C", "D", "E", "F", "G", "H", "I"]:
Severity: Minor
Found in bitrise_reports/reporting.py - About 2 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 launch has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

def launch(
Severity: Major
Found in bitrise_reports/entrypoint.py - About 1 hr to fix

    Function inject has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def inject(
    Severity: Major
    Found in bitrise_reports/di.py - About 1 hr to fix

      Function report_breakdown has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def report_breakdown(self, breakdown):
              printer = self.console
              printer.print(f"\n[bold green]{breakdown.name}[/bold green]")
      
              table = Table(show_header=True, header_style="bold magenta")
      Severity: Minor
      Found in bitrise_reports/reporting.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

      Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Major
      Found in bitrise_reports/reporting.py - About 1 hr to fix

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            def breakdown_per_project(self, builds):
                _, summary = self.__breakdown_builds(builds, lambda k: k.project)
                return BitriseBreakdown("Project Numbers", summary)
        Severity: Major
        Found in bitrise_reports/metrics.py and 2 other locations - About 1 hr to fix
        bitrise_reports/metrics.py on lines 34..36
        bitrise_reports/metrics.py on lines 38..40

        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 38.

        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

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            def breakdown_per_machine(self, builds):
                _, summary = self.__breakdown_builds(builds, lambda k: k.machine)
                return BitriseBreakdown("Per machine", summary)
        Severity: Major
        Found in bitrise_reports/metrics.py and 2 other locations - About 1 hr to fix
        bitrise_reports/metrics.py on lines 30..32
        bitrise_reports/metrics.py on lines 38..40

        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 38.

        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

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            def breakdown_per_workflow(self, builds):
                _, summary = self.__breakdown_builds(builds, lambda k: k.workflow)
                return BitriseBreakdown("Per Workflow", summary)
        Severity: Major
        Found in bitrise_reports/metrics.py and 2 other locations - About 1 hr to fix
        bitrise_reports/metrics.py on lines 30..32
        bitrise_reports/metrics.py on lines 34..36

        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 38.

        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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(
        Severity: Major
        Found in bitrise_reports/reporting.py - About 50 mins to fix

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

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

            Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, criteria, detailed_builds, detailed_timing, emulate_velocity, console):
            Severity: Minor
            Found in bitrise_reports/reporting.py - About 35 mins to fix

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

                  def __process(self, breakdown):
                      flattened = {"description": breakdown.name, "details": []}
              
                      sorted_by_total = sorted(
                          breakdown.details.items(), key=lambda kv: kv[1].count, reverse=True
              Severity: Minor
              Found in bitrise_reports/reporting.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 __analyse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __analyse(self, builds):
                      count = 0
                      minutes = BuildMinutes(0, 0, 0)
                      successes = 0
                      failures = 0
              Severity: Minor
              Found in bitrise_reports/metrics.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

              Severity
              Category
              Status
              Source
              Language