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')
Severity: Major
Found in babel.config.js - About 2 hrs to fix

    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)
    Severity: Minor
    Found in app/lib/parsers/file_parser.rb - About 2 hrs to fix

      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
      Severity: Minor
      Found in app/lib/parsers.rb - About 1 hr to fix

        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|
        Severity: Minor
        Found in seed-deepcore.rb - About 1 hr to fix

          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"
          
          
          Severity: Minor
          Found in app/lib/parsers/lachat_generic_line_parser.rb - About 1 hr to fix

          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
          Severity: Minor
          Found in app/lib/parsers/standard_parser.rb - About 55 mins to fix

          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
          Severity: Minor
          Found in app/lib/parsers/lachat_standard_line_parser.rb - About 55 mins to fix

          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)
          Severity: Minor
          Found in app/lib/parsers/standard_parser.rb - About 35 mins to fix

            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
            Severity: Minor
            Found in app/lib/parsers/lachat_lysimeter_line_parser.rb - About 35 mins to fix

            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
            Severity: Minor
            Found in app/lib/parsers/glbrc_deep_parser.rb - About 35 mins to fix

            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
            Severity: Major
            Found in app/lib/parsers/lachat_standard_line_parser.rb - About 30 mins to fix

              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
              Severity: Minor
              Found in app/controllers/runs_controller.rb - About 25 mins to fix

              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

              Severity
              Category
              Status
              Source
              Language