Showing 17 of 17 total issues
File rspec_html.rb
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "erb"
require "teaspoon/formatter/base"
module Teaspoon
module Formatter
Function Runner
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.Runner = (function() {
function Runner() {
this.url = system.args[1];
this.timeout = parseInt(system.args[2] || 180) * 1000;
Class Base
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class Base
RESERVED_PARAMS = ["body", "instrument"]
attr_accessor :total_count, :run_count, :passes, :pendings, :failures, :errors
Function pageCallbacks
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Runner.prototype.pageCallbacks = function() {
var _this = this;
return {
onError: function(message, trace) {
var started = _this.page.evaluate(function() {
Method setup_framework_tasks
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.setup_framework_tasks(options)
extend Rake::DSL
framework = options[:framework]
framework_name = options[:framework_name]
Method parallelize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def parallelize
threads = []
left_capabilities = capabilities
until left_capabilities.empty?
left_capabilities.pop(max_parallel).each do |desired_capability|
- 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 onLoadFinished
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
onLoadFinished: function(status) {
if (_this.start) return;
_this.start = new Date().getTime();
var defined = _this.page.evaluate(function() {
return window.Teaspoon;
Method initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options = nil)
options ||= {}
case options
when Hash then @options = options.symbolize_keys
when String then @options = JSON.parse(options).symbolize_keys
- 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 find_env
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.find_env(override = nil)
override ||= ENV["TEASPOON_ENV"]
env_files = override && !override.empty? ? [override] : standard_environments
env_files.each do |filename|
- 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 setup_framework_tasks
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.setup_framework_tasks(options)
extend Rake::DSL
framework = options[:framework]
framework_name = options[:framework_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 generate_reports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def generate_reports(&block)
input_path do |input|
results = []
@config.reports.each do |format|
result = generate_report(input, format)
- 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 dep
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.dep(message, category = nil)
return if Teaspoon.configured
if category
return if @dep_notified[category]
@dep_notified[category] = true if category
- 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 override_from_env
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.override_from_env(env)
ENV_OVERRIDES[:boolean].each { |o| override(o, env[o] == "true") if env[o].present? }
ENV_OVERRIDES[:integer].each { |o| override(o, env[o].to_i) if env[o].present? }
ENV_OVERRIDES[:string].each { |o| override(o, env[o]) if env[o].present? }
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 which
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def which(cmd)
exts = ENV["PATHEXT"] ? ENV["PATHEXT"].split(";") : [""]
ENV["PATH"].split(File::PATH_SEPARATOR).each do |path|
exts.each do |ext|
- 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 check_thresholds
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_thresholds(&block)
args = threshold_args
return if args.blank?
input_path do |input|
result, st = Open3.capture2e(@executable, "check-coverage", *args, input.shellescape)
- 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
::Selenium::WebDriver::Wait.new(driver_options).until do
done = driver.execute_script("return window.Teaspoon && window.Teaspoon.finished")
driver.execute_script("return window.Teaspoon && window.Teaspoon.getMessages() || []").each do |line|
runner.process("#{line}\n")
end
- 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 25.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
::Selenium::WebDriver::Wait.new(driver_options).until do
done = driver.execute_script("return window.Teaspoon && window.Teaspoon.finished")
driver.execute_script("return window.Teaspoon && window.Teaspoon.getMessages() || []").each do |line|
runner.process("#{line}\n")
end
- 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 25.
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