Melevir/opensource_watchman

View on GitHub

Showing 13 of 13 total issues

File master.py has 396 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import datetime
import operator

import deal
import yaml
Severity: Minor
Found in opensource_watchman/pipelines/master.py - About 5 hrs to fix

    Function _extract_commands_from_raw_log has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        def _extract_commands_from_raw_log(raw_log: str) -> List[str]:  # noqa: C901
            commands_with_subcommands = [
                # those commands have subcommands that are logged as stdout,
                # those commands should be extracted too
                'make',
    Severity: Minor
    Found in opensource_watchman/api/travis.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

    Consider simplifying this complex logical expression.
    Open

                        if (
                            not line.strip()
                            or line.startswith('-')
                            or line.startswith('=')
                            or line.startswith('|')
    Severity: Critical
    Found in opensource_watchman/api/travis.py - About 1 hr to fix

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

      def main(  # noqa: CFQ002
      Severity: Major
      Found in opensource_watchman/run.py - About 1 hr to fix

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

        def has_all_required_commands_in_build(
            required_commands_to_run_in_build: List[RequiredCICommandsConfig],
            github_data: GithubPipelineData,
            travis_data: TravisPipelineData,
        ) -> List[str]:
        Severity: Minor
        Found in opensource_watchman/pipelines/master.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 process_results has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def process_results(  # noqa: CFQ002
        Severity: Major
        Found in opensource_watchman/run.py - About 1 hr to fix

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

          def fetch_pull_request_details(api: GithubRepoAPI, detailed_pull_requests: Mapping[int, Mapping]):
              pull_request_details: Dict[int, Dict[str, Any]] = {p: {} for p in detailed_pull_requests.keys()}
              for pull_request in detailed_pull_requests.values():
                  pr_commits = api.fetch_commits(pull_request_number=pull_request['number'])
                  last_commit_sha = pr_commits[-1]['sha'] if pr_commits else None
          Severity: Minor
          Found in opensource_watchman/pipelines/github.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 has_support_of_python_versions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def has_support_of_python_versions(
              github_data: GithubPipelineData,
              C01: List[str],
              required_python_versions: List[str],
          ) -> List[str]:
          Severity: Minor
          Found in opensource_watchman/pipelines/master.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 print_errors_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          def print_errors_data(repos_stat: List[RepoResult]) -> None:
              ok_repos_number = 0
              for repo_stat in repos_stat:
                  print(repo_stat.repo_name)  # noqa: T001
                  for error_slug, error_texts in sorted(repo_stat.errors.items()):
          Severity: Minor
          Found in opensource_watchman/output_processors.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 prepare_html_report has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def prepare_html_report(
          Severity: Minor
          Found in opensource_watchman/output_processors.py - About 45 mins to fix

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

            def run_watchman(  # noqa: CFQ001
            Severity: Minor
            Found in opensource_watchman/run.py - About 35 mins to fix

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

              def if_logs_has_any_of_commands(log: List[str], commands: List[str]) -> bool:
                  is_section_present = False
                  for required_command in commands:
                      for base_command in log:
                          if (
              Severity: Minor
              Found in opensource_watchman/utils/logs_analiser.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 fetch_badges_urls has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              def fetch_badges_urls(readme_content: str):
                  if not readme_content:
                      return []
                  image_urls = re.findall(r'(?:!\[.*?\]\((.*?)\))', readme_content)
                  max_badge_height = 60
              Severity: Minor
              Found in opensource_watchman/pipelines/github.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