ManageIQ/miq_bot

View on GitHub
lib/github_service/commands/cross_repo_test.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Class CrossRepoTest has 30 methods (exceeds 20 allowed). Consider refactoring.
Open

    class CrossRepoTest < Base
      # Reference to the branch we are creating off of origin/master
      attr_reader :branch_ref

      # The user calling the command
Severity: Minor
Found in lib/github_service/commands/cross_repo_test.rb - About 3 hrs to fix

    Method dedup_repo_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def dedup_repo_list(repo_list)
            repo_list
              .sort # Unadorned repo name will always sort before adorned repo names
              .uniq
              .slice_when { |a, b| bare_repo_name(a) != bare_repo_name(b) }
    Severity: Minor
    Found in lib/github_service/commands/cross_repo_test.rb - 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

    URI.regexp is obsolete and should not be used. Instead, use URI::DEFAULT_PARSER.make_regexp.
    Open

            repo = URI.parse(repo).path[1..].sub("/pull/", "#") if URI.regexp.match?(repo)

    Identifies places where URI.regexp is obsolete and should not be used. Instead, use URI::DEFAULT_PARSER.make_regexp.

    Example:

    # bad
    URI.regexp('http://example.com')
    
    # good
    URI::DEFAULT_PARSER.make_regexp('http://example.com')

    There are no issues that match your filters.

    Category
    Status