maki-tetsu/anodator

View on GitHub

Showing 28 of 191 total issues

Method generate_error has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

    def generate_error(input_spec_with_values, check_results)
      buf = []

      if check_results.size.zero?
        if @include_no_error
Severity: Minor
Found in lib/anodator/output_spec.rb - About 5 hrs 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 validate has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

      def validate
        if allow_blank?
          return true if target_value.split(//).size.zero?
        end

Severity: Minor
Found in lib/anodator/validator/numeric_validator.rb - About 4 hrs 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 validate has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

      def validate
        length = target_value.split(//).size

        if allow_blank?
          return true if length.zero?
Severity: Minor
Found in lib/anodator/validator/length_validator.rb - About 3 hrs 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 load_rule_from_csv_file has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def self.load_rule_from_csv_file(file_path, validators)
      first = true
      header = nil
      rule_set = RuleSet.new

Severity: Minor
Found in lib/anodator/utils.rb - About 2 hrs 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 generate_error has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def generate_error(input_spec_with_values, check_results)
      buf = []

      if check_results.size.zero?
        if @include_no_error
Severity: Major
Found in lib/anodator/output_spec.rb - About 2 hrs to fix

    Method load_validators_from_csv_file has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.load_validators_from_csv_file(file_path)
          first = true
          header = nil
          validators = {}
    
    
    Severity: Minor
    Found in lib/anodator/utils.rb - About 1 hr to fix

      Method load_validators_from_csv_file has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.load_validators_from_csv_file(file_path)
            first = true
            header = nil
            validators = {}
      
      
      Severity: Minor
      Found in lib/anodator/utils.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 load_rule_from_csv_file has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def self.load_rule_from_csv_file(file_path, validators)
            first = true
            header = nil
            rule_set = RuleSet.new
      
      
      Severity: Minor
      Found in lib/anodator/utils.rb - About 1 hr to fix

        Method add_error_level has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.add_error_level(value, symbol, label)
              # value check
              raise 'Error level value must be Integer' unless value.is_a? Integer
              raise 'Error level value must be greater than zero' unless value > 0
              raise "Error level value #{value} already exists" if ERROR_LEVELS.values.include?(value)
        Severity: Minor
        Found in lib/anodator/rule.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 validate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def validate
                if target_value.split(//).size.zero?
                  return true if allow_blank?
                end
        
        
        Severity: Minor
        Found in lib/anodator/validator/format_validator.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 generate_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def generate_data(input_spec_with_values, check_results)
              buf = []
              buf << @items.map do |item|
                if item.is_a? Symbol
                  case item
        Severity: Minor
        Found in lib/anodator/output_spec.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 default_options has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

                def default_options(options = nil)
                  # initialize from superclass
                  @default_options = superclass.default_options if @default_options.nil?
        
                  unless options.nil?
        Severity: Minor
        Found in lib/anodator/validator/base.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 validate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def validate
                if allow_blank?
                  return true if target_value.split(//).size.zero?
                end
        
        
        Severity: Minor
        Found in lib/anodator/validator/numeric_validator.rb - About 1 hr to fix

          Method validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def validate
                  if @options[:validators].nil?
                    raise ConfigurationError, 'ComplexValidator must have validators option'
                  end
                  case @options[:logic]
          Severity: Minor
          Found in lib/anodator/validator/complex_validator.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 options_reader has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.options_reader(row, options = {}, options_index_from = 4)
                if row.size > options_index_from
                  row[options_index_from..-1].each do |column|
                    next if column.nil?
                    key, value = column.split(':', 2)
          Severity: Minor
          Found in lib/anodator/utils.rb - About 45 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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def initialize(target_expressions, message, validator, prerequisite = nil, level = ERROR_LEVELS.values.sort.last, description = nil)
          Severity: Minor
          Found in lib/anodator/rule.rb - About 45 mins to fix

            Method valid_option_keys has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                    def valid_option_keys(*option_keys)
                      # initialize from superclass
                      if @valid_option_keys.nil?
                        @valid_option_keys = superclass.valid_option_keys
                      end
            Severity: Minor
            Found in lib/anodator/validator/base.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 [] has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def [](target_expression)
                  raise SourceDataNotProvidedError if @source.nil?
                  return value_at(target_expression) if target_expression.is_a? Integer
            
                  if target_expression =~ /^CALC::(.+)$/
            Severity: Minor
            Found in lib/anodator/input_spec.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 validate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def validate
                    return true if allow_blank? && target_value.split(//).size.zero?
                    date = parse_date(target_value)
                    return false unless date
            
            
            Severity: Minor
            Found in lib/anodator/validator/date_validator.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 load_output_spec_from_csv_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.load_output_spec_from_csv_file(file_path,
                                                        target = Anodator::OutputSpec::TARGET_ERROR,
                                                        include_no_error = false)
                  first = true
                  header = nil
            Severity: Minor
            Found in lib/anodator/utils.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

            Severity
            Category
            Status
            Source
            Language