jamesdabbs/pi-base

View on GitHub

Showing 8 of 8 total issues

Method run! has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def run!
    raise unless Rails.env.development?

    process :value_sets, ValueSet do |v|
      {
Severity: Major
Found in lib/importer.rb - About 4 hrs to fix

    Method process has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def process table, klass, &block
        klass.delete_all
    
        table = @db[table] if table.is_a? Symbol
    
    
    Severity: Minor
    Found in lib/importer.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 consume has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def consume
          if scan /\\/
            store
            store_escaped
          elsif scan /[^()+|\\]+/
    Severity: Minor
    Found in app/models/formula/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 parse_name_or_id has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.parse_name_or_id str, klass, default=nil
        return default if !str.present? && default
        str.to_i.zero? ? klass.where(name: str).first! : klass.find(str.to_i)
      rescue ActiveRecord::RecordNotFound => e
        raise ParseError.new "Unrecognized #{klass}: #{str}"
    Severity: Minor
    Found in app/models/formula/atom.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 check has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def check
            read_csv!
    
            positions.map do |t, (row, col)|
              next unless row && col
    Severity: Minor
    Found in app/models/trait/table.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 link_trait has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def link_trait v
          return "" unless v
          klass = v[1] == 1 ? "true" : "false"
          sym   = v[1] == 1 ? "✓"    : "⨯"
          "<a href='/traits/#{v[0]}' class='#{klass}'>#{sym}</a>"
    Severity: Minor
    Found in app/models/trait/table.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def initialize user
        read_only = true
    
        can :read, :all
    
    
    Severity: Minor
    Found in app/models/ability.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 spaces has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def spaces where=true
        if where.nil?
          set = @property.traits.pluck :space_id
          spaces = set.empty? ? Space : Space.where('id NOT IN (?)', set)
          spaces.pluck :id
    Severity: Minor
    Found in app/models/formula/atom.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