pboling/letter_group

View on GitHub

Showing 3 of 3 total issues

Method initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(array_of_hashes = [], alpha_key:, unique_key:, selected: nil, field_groups: {}, labels: true)
      # With this sort of data triage many of the result rows must be combined to represent a single data issue.
      #   (the nature of SQL JOINS)
      # Thus we can only get a count by tallying up the total for each group.
      # since they each will know how to find their own unique problems
Severity: Minor
Found in lib/letter_group/presenter.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 determine_fields has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def determine_fields(fields, field_groups)
      field_groups ||= {}
      if field_groups.keys.any?
        @field_groups = field_groups
        @fields = field_groups.keys
Severity: Minor
Found in lib/letter_group/group.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 each has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def each
      return enum_for(:each) unless block_given? # Sparkling magic!
      selected.each do |letter|
        for_letter = groups[letter]
        next unless for_letter
Severity: Minor
Found in lib/letter_group/presenter.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