mikemarsian/json_apiable

View on GitHub

Showing 5 of 5 total issues

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

    def parse!
      raise_invalid_filter_class unless valid_filter_class?

      filter_hash = ActiveSupport::HashWithIndifferentAccess.new
      if valid_filter_query?
Severity: Minor
Found in lib/json_apiable/filter_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! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def parse!
      if no_pagination
        jsonapi_page_hash = nil
      elsif invalid_page_param?
        raise ArgumentError, 'page'
Severity: Minor
Found in lib/json_apiable/pagination_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 build_relationships_hash has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def self.build_relationships_hash(relationships, excluded_relationships, request)
      attr_hash = {}
      ids_array = []
      ids_key = nil

Severity: Minor
Found in lib/json_apiable/params_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 build_attributes_hash has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def self.build_attributes_hash(attributes, excluded_attributes)
      attrs_hash = {}
      attributes&.each do |key, value|
        next if excluded_attributes&.include?(key.to_sym)

Severity: Minor
Found in lib/json_apiable/params_parser.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 parse_body_params has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def self.parse_body_params(request, params, allowed_attributes, excluded_attributes,
                               allowed_relationships, excluded_relationships)
Severity: Minor
Found in lib/json_apiable/params_parser.rb - About 45 mins to fix
    Severity
    Category
    Status
    Source
    Language