Showing 26 of 26 total issues
File rule_config.rb
has 478 lines of code (exceeds 250 allowed). Consider refactoring. Open
module CukeSniffer
# Contains the rules and various scores used in evaluating objects
module RuleConfig
Method detect_nested_steps
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def detect_nested_steps
multi_line_step_flag = false
counter = 1
@code.each do |line|
regex = 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
Class CLI
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class CLI
include CukeSniffer::Constants
include CukeSniffer::RuleConfig
include ROXML
Method split_feature
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def split_feature(file_name, feature_lines)
index = 0
until index >= feature_lines.length or feature_lines[index].match /Feature:\s*(?<name>.*)/
update_tag_list(feature_lines[index])
index += 1
- 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 detect_nested_steps
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def detect_nested_steps
multi_line_step_flag = false
counter = 1
@code.each do |line|
regex = nil
Method output_junit_xml
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.output_junit_xml(cuke_sniffer, file_name = DEFAULT_OUTPUT_FILE_NAME)
file_name = file_name + ".xml" unless file_name =~ /\.xml$/
results = {}
failures = 0
suits={}
Method output_junit_xml
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.output_junit_xml(cuke_sniffer, file_name = DEFAULT_OUTPUT_FILE_NAME)
file_name = file_name + ".xml" unless file_name =~ /\.xml$/
results = {}
failures = 0
suits={}
- 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
Function changeRuleStatus
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
changeRuleStatus: function(){
$(document).on("click", ".rule input[type='checkbox']", function(){
var enabled = $(this).is(":checked"),
$rule = $(this).closest(".rule"),
phrase = $rule.find("[data-phrase]").html(),
- 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 split_feature
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def split_feature(file_name, feature_lines)
index = 0
until index >= feature_lines.length or feature_lines[index].match /Feature:\s*(?<name>.*)/
update_tag_list(feature_lines[index])
index += 1
Similar blocks of code found in 2 locations. Consider refactoring. Open
_bindCollapseAll: function(){
$(document).on("click", "[collapse]", function(){
$(this).closest(".panel-body").find(".details").hide();
});
},
- 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 62.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
_bindExpandAll: function(){
$(document).on("click", "[expand]", function(){
$(this).closest(".panel-body").find(".details").show();
});
},
- 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 62.
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
Function changeRuleStatus
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
changeRuleStatus: function(){
$(document).on("click", ".rule input[type='checkbox']", function(){
var enabled = $(this).is(":checked"),
$rule = $(this).closest(".rule"),
phrase = $rule.find("[data-phrase]").html(),
Method judge_object
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def judge_object(object, type)
@rules.each do |rule|
fail "No targets for rule: #{rule.phrase}" if rule.targets.nil? or rule.targets.empty?
next unless rule.targets.include? type and rule.enabled
if rule.reason.(object, rule) == true
- 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 build_object_for_extension_from_file
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def build_object_for_extension_from_file(file_name, regex, cuke_sniffer_class)
file_lines = IO.readlines(file_name)
counter = 0
code = []
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
:small_sleep => {
:enabled => true,
:phrase => "Small sleeps used. Use a wait_until like method.",
:score => INFO,
:max => 2,
- 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 44.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
:large_sleep => {
:enabled => true,
:phrase => "Large sleeps used. Use a wait_until like method.",
:score => INFO,
:min => 2,
- 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 44.
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 assess_rule_target_list
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.assess_rule_target_list(rule_target_list, type)
assessment_hash = initialize_assessment_hash(rule_target_list, type)
rule_target_list.each do |rule_target|
score = rule_target.score
assessment_hash[:total_score] += score
- 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 extract_inline_tables
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def extract_inline_tables(scenario_body)
index = 0
while index < scenario_body.size
if scenario_body[index] =~ /^\|.*\|/
start_index = index
- 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 extract_steps_from_features
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.extract_steps_from_features(features)
steps = {}
features.each do |feature|
steps.merge! extract_scenario_steps(feature.background) unless feature.background.nil?
feature.scenarios.each do |scenario|
- 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 catalog_possible_dead_steps
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.catalog_possible_dead_steps(step_definitions, steps_with_expressions)
step_definitions.each do |step_definition|
next unless step_definition.calls.empty?
regex_as_string = step_definition.regex.to_s.gsub(/\(\?-mix:\^?/, "").gsub(/\$\)$/, "")
steps_with_expressions.each do |step_location, step_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"