bitaculous/locomotivecms-liquids

View on GitHub

Showing 12 of 12 total issues

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

        def sample(input, number = 1)
          if input.respond_to?(:all) # Content type collection
            number > 1 ? input.all.sample(number) : input.all.sample
          else
            number > 1 ? input.sample(number) : input.sample
Severity: Minor
Found in lib/locomotivecms/liquids/filters/collections.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

Script file bundler.rake doesn't have execute permission.
Open

#!/usr/bin/env rake
Severity: Minor
Found in tasks/bundler.rake by rubocop

Script file locomotivecms-liquids.gemspec doesn't have execute permission.
Open

#!/usr/bin/env gem build
Severity: Minor
Found in locomotivecms-liquids.gemspec by rubocop

Re-enable Metrics/AbcSize cop with # rubocop:enable after disabling it.
Open

        # rubocop:disable Metrics/AbcSize

Script file rspec.rake doesn't have execute permission.
Open

#!/usr/bin/env rake
Severity: Minor
Found in tasks/rspec.rake by rubocop

Script file Gemfile doesn't have execute permission.
Open

#!/usr/bin/env bundle
Severity: Minor
Found in Gemfile by rubocop

Script file Guardfile doesn't have execute permission.
Open

#!/usr/bin/env guard
Severity: Minor
Found in Guardfile by rubocop

Use %i or %I for an array of symbols.
Open

task default: [:spec, :rubocop]
Severity: Minor
Found in Rakefile by rubocop

This cop can check for array literals made up of symbols that are not using the %i() syntax.

Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

Example: EnforcedStyle: percent (default)

# good
%i[foo bar baz]

# bad
[:foo, :bar, :baz]

Example: EnforcedStyle: brackets

# good
[:foo, :bar, :baz]

# bad
%i[foo bar baz]

Re-enable Metrics/CyclomaticComplexity cop with # rubocop:enable after disabling it.
Open

        # rubocop:disable Metrics/CyclomaticComplexity

Script file rubocop.rake doesn't have execute permission.
Open

#!/usr/bin/env rake
Severity: Minor
Found in tasks/rubocop.rake by rubocop

Script file Rakefile doesn't have execute permission.
Open

#!/usr/bin/env rake
Severity: Minor
Found in Rakefile by rubocop

Re-enable Metrics/PerceivedComplexity cop with # rubocop:enable after disabling it.
Open

        # rubocop:disable Metrics/PerceivedComplexity
Severity
Category
Status
Source
Language