Showing 12 of 29 total issues
Function exports
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
Class FileParser
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class FileParser
attr_accessor :load_errors, :plot_errors, :measurements, :plot,
:sample, :sample_type_id, :sample_date
def initialize(date, id)
Method for
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.for(sample_type_id,date)
klass = case sample_type_id
when 1 then Parsers::LysimeterParser
when 2 then Parsers::GenericParser # LterSoilParser
# when 3 then Parsers::StandardParser # deprecated
Method seed
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def seed
[1, 2, 3, 4, 5, 6, 7, 8, '8nt'].each do |trt|
1.upto(6) do |rep|
1.upto(5) do |stn|
1.upto(2) do |core|
Method parse
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(line)
data = CSV.parse_line(line)
return nil unless data[1] == "Unknown"
- 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 process_line
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def process_line(line, line_parser)
first, second, nh4_amount, no3_amount, raw_sample_date, modifier, site = line_parser.parse(line)
if raw_sample_date
self.sample_date = raw_sample_date
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 parse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(line)
data = CSV.parse_line(line)
return nil unless data[1] == "Unknown"
return nil if data[0] =~ /1\s*M\s+KCL/i
- 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 make_plot_with_prefix
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def make_plot_with_prefix(prefix, first, second, modifier, site)
Method parse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(line)
data = CSV.parse(line)[0]
return nil unless data[1] == "Unknown"
return nil if data[0] =~ /1\s.M\s+KCL/i
return nil if data[0] =~ /H2O/i
- 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 process_line
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process_line(line)
re = Regexp.new(GLBRC_DEEP_CORE)
plot_name, nh4_amount, no3_amount = re.match(line).try(:captures)
if plot_name && nh4_amount && no3_amount
find_plot(plot_name) unless self.plot.try(:name) == plot_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
Avoid too many return
statements within this method. Open
return nil if data[0] =~ /BLK/i
Method create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create
@run = Run.new(run_params)
session[:sample_date] = @run.sample_date
session[:run_date] = @run.run_date
- 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"