Showing 15 of 15 total issues
File check-cucumber.rb
has 385 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'sensu-plugin/check/cli'
require 'optparse'
require 'timeout'
require 'json'
require 'yaml'
Method run
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def run
return unless config_is_valid?
result = 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 run
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
return unless config_is_valid?
result = nil
Method generate_metrics_from_scenario
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def generate_metrics_from_scenario(feature, scenario, scenario_status, utc_timestamp)
metrics = []
if scenario_status == :passed
scenario_duration = 0
- 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 config_is_valid?
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def config_is_valid?
if config[:name].nil?
unknown_error 'No name specified'
return false
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 config_is_valid?
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def config_is_valid?
if config[:name].nil?
unknown_error 'No name specified'
return false
end
Method generate_sensu_event
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_sensu_event(event_name, feature, scenario, scenario_status)
scenario_clone = deep_dup(scenario)
remove_attachments_from_scenario(scenario_clone) unless config[:attachments]
feature_clone = deep_dup(feature)
feature_clone[:elements] = [scenario_clone]
Method generate_metrics_from_scenario
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_metrics_from_scenario(feature, scenario, scenario_status, utc_timestamp)
metrics = []
if scenario_status == :passed
scenario_duration = 0
Method generate_sensu_event
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def generate_sensu_event(event_name, feature, scenario, scenario_status)
scenario_clone = deep_dup(scenario)
remove_attachments_from_scenario(scenario_clone) unless config[:attachments]
feature_clone = deep_dup(feature)
feature_clone[:elements] = [scenario_clone]
- 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
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Function exports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function() {
this.Given(/^a passing pre-condition$/, function(callback) {
if (this.isDryRun()) { return callback(); }
callback();
- 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 get_scenario_status
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_scenario_status(scenario)
scenario_status = :passed
# #YELLOW
Array(scenario[:steps]).each do |step|
- 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 get_output_for_scenario
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_output_for_scenario(scenario, scenario_status)
steps_output = []
Array(scenario[:steps]).each_with_index do |step, index|
has_result = step.key?(:result)
- 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"