artirix/url_params_manager

View on GitHub

Showing 3 of 3 total issues

Class Service has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Service
    EMPTY_STRING                            = ''.freeze
    PREFIX_SEPARATOR                        = '-'.freeze
    DEFAULT_PLACEHOLDER                     = '_'.freeze
    DEFAULT_MULTIPLE_SEPARATOR_FOR_POSITION = '--'.freeze
Severity: Minor
Found in lib/url_params_manager/service.rb - About 2 hrs to fix

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

        def unfold_filters_by_position(filters, raw)
    
          # the moment we recognise one param with a prefix based, we assume that the position based have stopped
          prefix_based_recognised = false
          position_defined_raw    = raw.inject([]) do |list, url_part|
    Severity: Minor
    Found in lib/url_params_manager/service.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 remove_defaults has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def remove_defaults(filter_args)
          default_params.each do |k, v|
            next unless filter_args.key?(k) && filter_args[k].present?
            if filter_args[k] == v || Array(filter_args[k]).sort == Array(v).sort
              filter_args.delete k
    Severity: Minor
    Found in lib/url_params_manager/service.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

    Severity
    Category
    Status
    Source
    Language