File specification_policy.rb
has 380 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "user_interaction"
class Gem::SpecificationPolicy
include Gem::UserInteraction
Class SpecificationPolicy
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class Gem::SpecificationPolicy
include Gem::UserInteraction
VALID_NAME_PATTERN = /\A[a-zA-Z0-9\.\-\_]+\z/ # :nodoc:
Method validate_metadata
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def validate_metadata
metadata = @specification.metadata
unless Hash === metadata
error "metadata must be a hash"
- 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
Method validate_dependencies
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def validate_dependencies # :nodoc:
warning_messages = []
@specification.dependencies.each do |dep|
if dep.name == @specification.name # warn on self reference
warning_messages << "Self referencing dependency is unnecessary and strongly discouraged."
- 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
Method validate_permissions
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def validate_permissions
return if Gem.win_platform?
@specification.files.each do |file|
next unless File.file?(file)
- 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
Method validate_lazy_metadata
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def validate_lazy_metadata
unless @specification.authors.grep(LAZY_PATTERN).empty?
error "#{LAZY} is not an author"
end
- 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
Method validate_licenses
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def validate_licenses
licenses = @specification.licenses
licenses.each do |license|
next if Gem::Licenses.match?(license) || license.nil?
- 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
Method validate_dependencies
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_dependencies # :nodoc:
warning_messages = []
@specification.dependencies.each do |dep|
if dep.name == @specification.name # warn on self reference
warning_messages << "Self referencing dependency is unnecessary and strongly discouraged."
Method validate_array_attribute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_array_attribute(field)
val = @specification.send(field)
klass = case field
when :dependencies then
Gem::Dependency
- 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
TODO found Open
# TODO: raise at some given date
- Exclude checks