Block has too many lines. [85/25] Open
RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
# config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
Assignment Branch Condition size for stub_current_user is too high. [15.17/15] Open
def stub_current_user(current_user, current_role_name = 'Student', current_role)
allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(current_user) if defined?(session)
allow_any_instance_of(ApplicationController).to receive(:current_role_name).and_return(current_role_name)
allow_any_instance_of(ApplicationController).to receive(:current_role).and_return(current_role)
# Also pop this stub user into the session to support the authorization helper
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Optional arguments should appear at the end of the argument list. Open
def stub_current_user(current_user, current_role_name = 'Student', current_role)
- Read upRead up
- Exclude checks
This cop checks for optional arguments to methods that do not come at the end of the argument list
Example:
# bad
def foo(a = 1, b, c)
end
# good
def baz(a, b, c = 1)
end
def foobar(a = 1, b = 2, c = 3)
end
end
at 75, 4 is not aligned with def
at 71, 2. Open
end
- Read upRead up
- Exclude checks
This cop checks whether the end keywords of method definitions are aligned properly.
Two modes are supported through the EnforcedStyleAlignWith configuration
parameter. If it's set to start_of_line
(which is the default), the
end
shall be aligned with the start of the line where the def
keyword is. If it's set to def
, the end
shall be aligned with the
def
keyword.
Example: EnforcedStyleAlignWith: startofline (default)
# bad
private def foo
end
# good
private def foo
end
Example: EnforcedStyleAlignWith: def
# bad
private def foo
end
# good
private def foo
end