Showing 676 of 676 total issues
Re-enable Layout/AlignParameters cop with # rubocop:enable
after disabling it. Open
# rubocop:disable AlignParameters
- Exclude checks
Use %i
or %I
for an array of symbols. Open
Gitdocs::Share.stubs(:all).returns([:share1, :share2])
- Read upRead up
- Exclude checks
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 of
3` 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]
Unnecessary utf-8 encoding comment. Open
# -*- encoding : utf-8 -*-
- Exclude checks
Add an empty line after magic comments. Open
require File.expand_path('../test_helper', __FILE__)
- Read upRead up
- Exclude checks
Checks for a newline after the final magic comment.
Example:
# good
# frozen_string_literal: true
# Some documentation for Person
class Person
# Some code
end
# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
# Some code
end
Unnecessary utf-8 encoding comment. Open
# -*- encoding : utf-8 -*-
- Exclude checks
Unnecessary utf-8 encoding comment. Open
# -*- encoding : utf-8 -*-
- Exclude checks
Unnecessary utf-8 encoding comment. Open
# -*- encoding : utf-8 -*-
- Exclude checks
Unnecessary utf-8 encoding comment. Open
# -*- encoding : utf-8 -*-
- Exclude checks
Add an empty line after magic comments. Open
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
- Read upRead up
- Exclude checks
Checks for a newline after the final magic comment.
Example:
# good
# frozen_string_literal: true
# Some documentation for Person
class Person
# Some code
end
# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
# Some code
end
%w
-literals should be delimited by [
and ]
. Open
%w(/my/path /my/path/2 /my/path/3a /my/path/4 /my/path/5)
- Read upRead up
- Exclude checks
This cop enforces the consistent usage of %
-literal delimiters.
Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.
Example:
# Style/PercentLiteralDelimiters:
# PreferredDelimiters:
# default: '[]'
# '%i': '()'
# good
%w[alpha beta] + %i(gamma delta)
# bad
%W(alpha #{beta})
# bad
%I(alpha beta)
Unnecessary utf-8 encoding comment. Open
# -*- encoding : utf-8 -*-
- Exclude checks
Unnecessary utf-8 encoding comment. Open
# -*- encoding : utf-8 -*-
- Exclude checks
required_ruby_version
(1.9, declared in gitdocs.gemspec) and TargetRubyVersion
(2.1, declared in .rubocop.yml) should be equal. Open
s.required_ruby_version = '>= 1.9'
- Read upRead up
- Exclude checks
Checks that required_ruby_version
of gemspec and TargetRubyVersion
of .rubocop.yml are equal.
Thereby, RuboCop to perform static analysis working on the version
required by gemspec.
Example:
# When `TargetRubyVersion` of .rubocop.yml is `2.3`.
# bad
Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.2.0'
end
# bad
Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.4.0'
end
# good
Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.3.0'
end
# good
Gem::Specification.new do |spec|
spec.required_ruby_version = '>= 2.3'
end
# good
Gem::Specification.new do |spec|
spec.required_ruby_version = ['>= 2.3.0', '< 2.5.0']
end
Unnecessary utf-8 encoding comment. Open
# -*- encoding : utf-8 -*-
- Exclude checks
Unnecessary utf-8 encoding comment. Open
# -*- encoding : utf-8 -*-
- Exclude checks
Use meaningful heredoc delimiters. Open
EOS
- Read upRead up
- Exclude checks
This cop checks that your heredocs are using meaningful delimiters.
By default it disallows END
and EO*
, and can be configured through
blacklisting additional delimiters.
Example:
# good
<<-SQL
SELECT * FROM foo
SQL
# bad
<<-END
SELECT * FROM foo
END
# bad
<<-EOS
SELECT * FROM foo
EOS
Favor a normal unless-statement over a modifier clause in a multiline statement. Open
return(
'Auto-commit from gitdocs'
) unless File.exist?(@commit_message_path)
- Read upRead up
- Exclude checks
Checks for uses of if/unless modifiers with multiple-lines bodies.
Example:
# bad
{
result: 'this should not happen'
} unless cond
# good
{ result: 'ok' } if cond
Rule doesn't have all its properties in alphabetical order. Open
form.upload p, form.add p {
- Exclude checks
Element (td.size) is overqualified, just use .size without element name. Open
table td.size { width: 15%; }
- Exclude checks
Rule doesn't have all its properties in alphabetical order. Open
.container-fluid{position:relative;min-width:940px;padding-left:20px;padding-right:20px;zoom:1;}.container-fluid:before,.container-fluid:after{display:table;content:"";zoom:1;}
- Exclude checks