Showing 22 of 22 total issues
Method call
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call
key_pairs = namespaces.map do |namespace|
Chamber::KeyPair.new(namespace: namespace,
key_file_path: rootpath)
end
Method convert_environment_value
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def convert_environment_value(environment_key, environment_value, settings_value) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize
return settings_value unless environment_value
return if %w{___nil___ ___null___}.include?(environment_value)
case settings_value.class.name
- 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 resolve
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def resolve
options[:rootpath] ||= Pathname.pwd
options[:rootpath] = Pathname.new(options[:rootpath])
options[:namespaces] ||= []
options[:preset] ||= resolve_preset
- 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 execute
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def execute(raw_data = data) # rubocop:disable Metrics/CyclomaticComplexity
securable_settings = super
settings = {}
securable_settings.each_pair do |key, value|
- 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 decrypt
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.decrypt(_settings_key, value, decryption_keys) # rubocop:disable Metrics/AbcSize
return value if decryption_keys.nil?
key, iv, decoded_string = value
.match(LARGE_DATA_STRING_PATTERN)
Method convert_environment_value
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def convert_environment_value(environment_key, environment_value, settings_value) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize
return settings_value unless environment_value
return if %w{___nil___ ___null___}.include?(environment_value)
case settings_value.class.name
Method execute
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def execute(raw_data = data)
settings = {}
raw_data.each_pair do |key, value|
secure_value = if value.respond_to? :each_pair
- 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 decrypt
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def decrypt
decrypted_settings = to_settings.decrypted.to_flattened_name_hash
secure_settings = to_settings.encrypted.to_flattened_name_hash
file_contents = read
Method registered
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.registered(app)
app.configure do |inner_app|
env = inner_app.environment || ENV.fetch('RACK_ENV', nil)
root = inner_app.root
- 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 encryption_method
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def encryption_method(value)
value_is_encrypted = value.is_a?(::String) &&
(value.match(BASE64_STRING_PATTERN) ||
value.match(LARGE_DATA_STRING_PATTERN))
- 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 deep_validate_keys
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.deep_validate_keys(object, &block)
case object
when ::Hash
object.each do |(key, value)|
fail ::Chamber::Errors::NonConformingKey unless key == yield(key)
- 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 decryption_method
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def decryption_method(value)
if value.is_a?(::String)
if value.match(BASE64_STRING_PATTERN)
EncryptionMethods::PublicKey
elsif value.match(LARGE_DATA_STRING_PATTERN)
- 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 deep_dup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def deep_dup
dup.tap do |hash|
each_pair do |key, value|
if key.frozen? && key.is_a?(::String)
hash[key] = value.deep_dup
- 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 resolve_namespaces
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def resolve_namespaces(other)
(other.respond_to?(:values) ? other.values : other)
.map do |namespace|
namespace.respond_to?(:call) ? namespace.call : namespace
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 resolve
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def resolve
key_paths.each_with_object({}) do |path, memo|
namespace = namespace_from_path(path) || '__default'
value = if path.readable?
path.read
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
@signature_key = if keyish.is_a?(OpenSSL::PKey::RSA)
keyish
elsif ::File.readable?(::File.expand_path(keyish))
file_contents = ::File.read(::File.expand_path(keyish))
OpenSSL::PKey::RSA.new(file_contents)
- Read upRead up
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 30.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method call
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def call
disable_warnings do
insecure_environment_variables.each_key do |key|
color = dry_run ? :blue : :green
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
memo[namespace] = if keyish.is_a?(OpenSSL::PKey::RSA)
keyish
elsif ::File.readable?(::File.expand_path(keyish))
file_contents = ::File.read(::File.expand_path(keyish))
OpenSSL::PKey::RSA.new(file_contents)
- Read upRead up
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 30.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method decrypt
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def decrypt
decrypted_settings = to_settings.decrypted.to_flattened_name_hash
secure_settings = to_settings.encrypted.to_flattened_name_hash
file_contents = read
- 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 deep_merge!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def deep_merge!(other_hash, &block)
merge!(other_hash) do |key, this_val, other_val|
if this_val.is_a?(::Hash) && other_val.is_a?(::Hash)
this_val.deep_merge(other_val, &block)
elsif block
- 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"