maki-tetsu/anodator

View on GitHub

Showing 191 of 191 total issues

Class has too many lines. [143/100]
Open

  class OutputSpec
    TARGET_DATA  = 'DATA'.freeze
    TARGET_ERROR = 'ERROR'.freeze

    VALID_SYMBOL_ITEMS = %i[
Severity: Minor
Found in lib/anodator/output_spec.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [142/100]
Open

  class InputSpec
    CALCULATION_HOLDER_REGEXP = /\[\[([^\]]+)\]\]/

    include Common

Severity: Minor
Found in lib/anodator/input_spec.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Module has too many lines. [134/100]
Open

  module Utils
    # load input_spec from csv file
    #
    # File encoding: UTF-8
    # Columns:
Severity: Minor
Found in lib/anodator/utils.rb by rubocop

This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [111/100]
Open

    class Base
      # value of target for validation
      @@values = nil

      # data source set
Severity: Minor
Found in lib/anodator/validator/base.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [101/100]
Open

    class DateValidator < Base
      FORMAT_SCANNER_REGEXP =
        /((YY(?:YY)?)|(M(?![YMD]))|(MM)|(D(?![YMD]))|(DD))/
      HOLDER_DEFS = {
        'YYYY' => :year,

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [55/10]
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 by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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 has too many lines. [41/10]
Open

    def self.load_validators_from_csv_file(file_path)
      first = true
      header = nil
      validators = {}

Severity: Minor
Found in lib/anodator/utils.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for load_rule_from_csv_file is too high. [45.35/15]
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 by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [39/10]
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 by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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

Assignment Branch Condition size for generate_error is too high. [39.94/15]
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 by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for validate is too high. [38.54/15]
Open

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

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for load_validators_from_csv_file is too high. [33.06/15]
Open

    def self.load_validators_from_csv_file(file_path)
      first = true
      header = nil
      validators = {}

Severity: Minor
Found in lib/anodator/utils.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [27/10]
Open

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

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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 has too many lines. [22/10]
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 by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [21/10]
Open

    def initialize(items = [], options = {})
      @items            = items.to_a
      @target           = TARGET_ERROR
      @include_no_error = false
      @separator        = ' '
Severity: Minor
Found in lib/anodator/output_spec.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Cyclomatic complexity for validate is too high. [17/6]
Open

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

This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

Method has too many lines. [21/10]
Open

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

        if allow_blank?
          return true if length.zero?

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Severity
Category
Status
Source
Language