lib/github_service/commands/cross_repo_test.rb
Class CrossRepoTest
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class CrossRepoTest < Base
# Reference to the branch we are creating off of origin/master
attr_reader :branch_ref
# The user calling the command
Method dedup_repo_list
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
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) }
- Read upRead up
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
Open
repo = URI.parse(repo).path[1..].sub("/pull/", "#") if URI.regexp.match?(repo)
- Read upRead up
- Exclude checks
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')