evilmartians/fias

View on GitHub

Showing 5 of 5 total issues

Method copy_fias_data has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def copy_fias_data
  puts 'Copying data from FIAS...'

  encoder = PgDataEncoder::EncodeForCopy.new(
    column_types: { 0 => :uuid, 1 => :uuid, 2 => :uuid }
Severity: Minor
Found in examples/create.rb - About 1 hr to fix

    Method extract_names has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def extract_names
            extracted = @params.map do |name, value|
              if value.is_a?(Array)
                [name, value]
              else
    Severity: Minor
    Found in lib/fias/query/params.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 only has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def only(*names)
            return @files if names.empty?
    
            names = names.map do |name|
              name = name.to_sym
    Severity: Minor
    Found in lib/fias/import/dbf.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 open_files has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def open_files(encoding)
            TABLES.each do |accessor, dbf_filename|
              filename = File.join(@path, dbf_filename)
    
              next unless File.exist?(filename)
    Severity: Minor
    Found in lib/fias/import/dbf.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

    Method encode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def encode
            @dbf.each do |record|
              line = record.to_a.map { |v| v == '' ? nil : v }
              @encoder.add(line)
              yield if block_given?
    Severity: Minor
    Found in lib/fias/import/copy.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