varvet/godmin

View on GitHub

Showing 25 of 116 total issues

Method _find_all has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _find_all(name, prefix, partial, details, key, locals)
Severity: Minor
Found in lib/godmin/resolver.rb - About 45 mins to fix

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

          def column_value(resource, attribute)
            partial_override "#{controller_path}/columns/#{attribute}", resource: resource do
              column_value = resource.send(attribute)
    
              if column_value.is_a?(Date) || column_value.is_a?(Time)
    Severity: Minor
    Found in lib/godmin/helpers/tables.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

    Avoid parameter lists longer than 5 parameters. [6/5]
    Open

        def _find_all(name, prefix, partial, details, key, locals)
    Severity: Minor
    Found in lib/godmin/resolver.rb by rubocop

    This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

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

            def perform_batch_action
              return unless params[:batch_action].present?
    
              set_resource_service
              set_resource_class
    Severity: Minor
    Found in lib/godmin/resources/resource_controller/batch_actions.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

    Avoid more than 3 levels of block nesting.
    Open

                    $1 == "desc" ? "asc" : "desc"
    Severity: Minor
    Found in lib/godmin/helpers/tables.rb by rubocop

    This cop checks for excessive nesting of conditional and looping constructs.

    You can configure if blocks are considered using the CountBlocks option. When set to false (the default) blocks are not counted towards the nesting level. Set to true to count blocks as well.

    The maximum level of nesting allowed is configurable.

    Severity
    Category
    Status
    Source
    Language