finstyle 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.cane +0 -0
- data/.gitignore +14 -0
- data/.travis.yml +14 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +95 -0
- data/Rakefile +45 -0
- data/bin/finstyle +13 -0
- data/config/default.yml +5 -0
- data/config/disabled.yml +13 -0
- data/config/enabled.yml +793 -0
- data/config/finstyle.yml +131 -0
- data/config/upstream.yml +522 -0
- data/finstyle.gemspec +32 -0
- data/lib/finstyle.rb +20 -0
- data/lib/finstyle/version.rb +3 -0
- metadata +132 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cbee44330185e487fcd9540fef46baa1f9fd2d4a
|
4
|
+
data.tar.gz: 5fa6b8817d44f84dba2e6979c121c2e179b93400
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4cfb6dec10fa41f26baf4d04f5b8b0c3ac9dab8a3f6b1a198c472a1952f3b8053f1cf4dce56b57b10908d7fc2a93f1a23031a5ec7afa980735cff51d460d3709
|
7
|
+
data.tar.gz: c1d0ed710e04ea4fe4255f0ebec7ca3b3ca528c216888ad6927eb9d486ebe4c592ac2dd3b67e898de302f4b766dbe8afee75c2fc763e4b101e244812625f688d
|
data/.cane
ADDED
File without changes
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Fletcher Nichol
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
# Finstyle: Version Pinning RuboCop and Configuration for CI
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/fnichol/finstyle.svg?branch=master)](https://travis-ci.org/fnichol/finstyle)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/fnichol/finstyle.png)](https://codeclimate.com/github/fnichol/finstyle)
|
5
|
+
[![Dependency Status](https://gemnasium.com/fnichol/finstyle.svg)](https://gemnasium.com/fnichol/finstyle)
|
6
|
+
|
7
|
+
|
8
|
+
This is an executable version of a Ruby style guide which uses [RuboCop][rubocop] as its implementation. It focuses on being Ruby code that is non-surprising, readable, and allows for some flexibility with respect to naming expression.
|
9
|
+
|
10
|
+
## How It Works
|
11
|
+
|
12
|
+
This library has a direct dependency on one specific version of RuboCop (at a time), and [patches it][patch] to load the [upstream configuration][upstream] and [custom set][config] of rule updates. When a new RuboCop release comes out, this library can rev its pinned version dependency and [re-vendor][rakefile] the upstream configuration to determine if any breaking style or lint rules were added/dropped/reversed/etc.
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'finstyle'
|
20
|
+
```
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle
|
25
|
+
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install finstyle
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
Use this tool just as you would RuboCop, but invoke the `finstyle` binary
|
33
|
+
instead which patches RuboCop to load rules from the Finstyle gem. For example:
|
34
|
+
|
35
|
+
```sh
|
36
|
+
finstyle -D --format offenses
|
37
|
+
```
|
38
|
+
|
39
|
+
In a Rakefile, the setup is exactly the same, except you need to require the
|
40
|
+
Finstyle library first:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
require "finstyle"
|
44
|
+
require "rubocop/rake_task"
|
45
|
+
RuboCop::RakeTask.new do |task|
|
46
|
+
task.options << "--display-cop-names"
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
As with vanilla RuboCop, any custom settings can still be placed in a `.rubocop.yml` file in the root of your project.
|
51
|
+
|
52
|
+
## Frequently Ask Questions
|
53
|
+
|
54
|
+
* **Why?**
|
55
|
+
Tools and libraries such as RuboCop couple an implementation with policy into one versioned artifact. As such it can be hard to determine if a version change was due to a new tool feature or policy changes. Additonally, most users of such dependencies declare very loose version constraints on these tools (blindly depending on latest release or even assuming a SemVer friendly constraint such as `"~ 1.0"`). Then when a new version is released any continuous integration (CI) jobs may start to fail without *any* change in code. This library attempts to bake the version of the upstream dependency and its custom policy in one place. By the way, if you decide to use this library, it is recommended to version pin the version in your gemspec or Gemfile.
|
56
|
+
* **Aren't the default RuboCop rules sufficient?**
|
57
|
+
The custom rules for Finstyle were derived by using a corpus of working production code and so the aim here is to be pragmatic and realistic.
|
58
|
+
* **I disagree with {{insert rule here}}, can I change it?**
|
59
|
+
You are welcome to submit issues or pull requests to this project but keep in mind that as any style guides go, these work for the author and related projects. They weren't made arbitrarily :) If you like the implemementation (hack), feel free to fork/copy the idea and vendor your own custom rules.
|
60
|
+
|
61
|
+
## Contributing
|
62
|
+
|
63
|
+
* Source hosted at [GitHub][repo]
|
64
|
+
* Report issues/questions/feature requests on [GitHub Issues][issues]
|
65
|
+
|
66
|
+
Pull requests are very welcome! Make sure your patches are well tested.
|
67
|
+
Ideally create a topic branch for every separate change you make. For
|
68
|
+
example:
|
69
|
+
|
70
|
+
|
71
|
+
1. Fork it ( https://github.com/[my-github-username]/finstyle/fork )
|
72
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
73
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
74
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
75
|
+
5. Create a new Pull Request
|
76
|
+
|
77
|
+
## Authors
|
78
|
+
|
79
|
+
Created and maintained by [Fletcher Nichol][fnichol] (<fnichol@nichol.ca>)
|
80
|
+
|
81
|
+
## License
|
82
|
+
|
83
|
+
MIT (see [LICENSE.txt][license])
|
84
|
+
|
85
|
+
[license]: https://github.com/fnichol/finstyle/blob/master/LICENSE.txt
|
86
|
+
[fnichol]: https://github.com/fnichol
|
87
|
+
[repo]: https://github.com/fnichol/finstyle
|
88
|
+
[issues]: https://github.com/fnichol/finstyle/issues
|
89
|
+
[contributors]: https://github.com/fnichol/finstyle/contributors
|
90
|
+
|
91
|
+
[config]: https://github.com/fnichol/finstyle/blob/master/config/finstyle.yml
|
92
|
+
[rubocop]: https://github.com/bbatsov/rubocop
|
93
|
+
[patch]: https://github.com/fnichol/finstyle/blob/master/lib/finstyle.rb
|
94
|
+
[rakefile]: https://github.com/fnichol/finstyle/blob/master/Rakefile
|
95
|
+
[upstream]: https://github.com/fnichol/finstyle/blob/master/config/deault.yml
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
|
3
|
+
upstream = Gem::Specification.find_by_name("rubocop")
|
4
|
+
|
5
|
+
desc "Vendor rubocop-#{upstream.version} configuration into gem"
|
6
|
+
task :vendor do
|
7
|
+
src = Pathname.new(upstream.gem_dir).join("config")
|
8
|
+
dst = Pathname.new(__FILE__).dirname.join("config")
|
9
|
+
|
10
|
+
mkdir_p dst
|
11
|
+
cp(src.join("default.yml"), dst.join("upstream.yml"))
|
12
|
+
cp(src.join("enabled.yml"), dst.join("enabled.yml"))
|
13
|
+
cp(src.join("disabled.yml"), dst.join("disabled.yml"))
|
14
|
+
|
15
|
+
sh %{git add #{dst}/{upstream,enabled,disabled}.yml}
|
16
|
+
sh %{git commit -m "Vendor rubocop-#{upstream.version} upstream configuration."}
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Display LOC stats"
|
20
|
+
task :stats do
|
21
|
+
puts "\n## Production Code Stats"
|
22
|
+
sh "countloc -r lib"
|
23
|
+
end
|
24
|
+
|
25
|
+
require "finstyle"
|
26
|
+
require "rubocop/rake_task"
|
27
|
+
RuboCop::RakeTask.new(:style) do |task|
|
28
|
+
task.options << "--display-cop-names"
|
29
|
+
end
|
30
|
+
|
31
|
+
if RUBY_ENGINE != "jruby"
|
32
|
+
require "cane/rake_task"
|
33
|
+
desc "Run cane to check quality metrics"
|
34
|
+
Cane::RakeTask.new do |cane|
|
35
|
+
cane.canefile = "./.cane"
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "Run all quality tasks"
|
39
|
+
task :quality => [:cane, :style, :stats]
|
40
|
+
else
|
41
|
+
desc "Run all quality tasks"
|
42
|
+
task :quality => [:style, :stats]
|
43
|
+
end
|
44
|
+
|
45
|
+
task :default => [:quality]
|
data/bin/finstyle
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- encoding: utf-8 -*-
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), %w[.. lib])
|
5
|
+
|
6
|
+
require "finstyle"
|
7
|
+
|
8
|
+
if ARGV.size == 1 && %w[-v --version].include?(ARGV.first)
|
9
|
+
puts "Finstyle #{Finstyle::VERSION}"
|
10
|
+
print " * RuboCop "
|
11
|
+
end
|
12
|
+
|
13
|
+
load Gem.bin_path("rubocop", "rubocop")
|
data/config/default.yml
ADDED
data/config/disabled.yml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# These are all the cops that are disabled in the default configuration.
|
2
|
+
|
3
|
+
Style/InlineComment:
|
4
|
+
Description: 'Avoid inline comments.'
|
5
|
+
Enabled: false
|
6
|
+
|
7
|
+
Style/MethodCalledOnDoEndBlock:
|
8
|
+
Description: 'Avoid chaining a method call on a do...end block.'
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Style/SymbolArray:
|
12
|
+
Description: 'Use %i or %I for arrays of symbols.'
|
13
|
+
Enabled: false
|
data/config/enabled.yml
ADDED
@@ -0,0 +1,793 @@
|
|
1
|
+
# These are all the cops that are enabled in the default configuration.
|
2
|
+
|
3
|
+
Style/AccessModifierIndentation:
|
4
|
+
Description: Check indentation of private/protected visibility modifiers.
|
5
|
+
Enabled: true
|
6
|
+
|
7
|
+
Style/AccessorMethodName:
|
8
|
+
Description: Check the naming of accessor methods for get_/set_.
|
9
|
+
Enabled: true
|
10
|
+
|
11
|
+
Style/Alias:
|
12
|
+
Description: 'Use alias_method instead of alias.'
|
13
|
+
Enabled: true
|
14
|
+
|
15
|
+
Style/AlignArray:
|
16
|
+
Description: >-
|
17
|
+
Align the elements of an array literal if they span more than
|
18
|
+
one line.
|
19
|
+
Enabled: true
|
20
|
+
|
21
|
+
Style/AlignHash:
|
22
|
+
Description: >-
|
23
|
+
Align the elements of a hash literal if they span more than
|
24
|
+
one line.
|
25
|
+
Enabled: true
|
26
|
+
|
27
|
+
Style/AlignParameters:
|
28
|
+
Description: >-
|
29
|
+
Align the parameters of a method call if they span more
|
30
|
+
than one line.
|
31
|
+
Enabled: true
|
32
|
+
|
33
|
+
Style/AndOr:
|
34
|
+
Description: 'Use &&/|| instead of and/or.'
|
35
|
+
Enabled: true
|
36
|
+
|
37
|
+
Style/ArrayJoin:
|
38
|
+
Description: 'Use Array#join instead of Array#*.'
|
39
|
+
Enabled: true
|
40
|
+
|
41
|
+
Style/AsciiComments:
|
42
|
+
Description: 'Use only ascii symbols in comments.'
|
43
|
+
Enabled: true
|
44
|
+
|
45
|
+
Style/AsciiIdentifiers:
|
46
|
+
Description: 'Use only ascii symbols in identifiers.'
|
47
|
+
Enabled: true
|
48
|
+
|
49
|
+
Style/Attr:
|
50
|
+
Description: 'Checks for uses of Module#attr.'
|
51
|
+
Enabled: true
|
52
|
+
|
53
|
+
Style/BeginBlock:
|
54
|
+
Description: 'Avoid the use of BEGIN blocks.'
|
55
|
+
Enabled: true
|
56
|
+
|
57
|
+
Style/BlockComments:
|
58
|
+
Description: 'Do not use block comments.'
|
59
|
+
Enabled: true
|
60
|
+
|
61
|
+
Style/BlockNesting:
|
62
|
+
Description: 'Avoid excessive block nesting'
|
63
|
+
Enabled: true
|
64
|
+
|
65
|
+
Style/Blocks:
|
66
|
+
Description: >-
|
67
|
+
Avoid using {...} for multi-line blocks (multiline chaining is
|
68
|
+
always ugly).
|
69
|
+
Prefer {...} over do...end for single-line blocks.
|
70
|
+
Enabled: true
|
71
|
+
|
72
|
+
Style/BracesAroundHashParameters:
|
73
|
+
Description: 'Enforce braces style inside hash parameters.'
|
74
|
+
Enabled: true
|
75
|
+
|
76
|
+
Style/CaseEquality:
|
77
|
+
Description: 'Avoid explicit use of the case equality operator(===).'
|
78
|
+
Enabled: true
|
79
|
+
|
80
|
+
Style/CaseIndentation:
|
81
|
+
Description: 'Indentation of when in a case/when/[else/]end.'
|
82
|
+
Enabled: true
|
83
|
+
|
84
|
+
Style/CharacterLiteral:
|
85
|
+
Description: 'Checks for uses of character literals.'
|
86
|
+
Enabled: true
|
87
|
+
|
88
|
+
Style/ClassAndModuleCamelCase:
|
89
|
+
Description: 'Use CamelCase for classes and modules.'
|
90
|
+
Enabled: true
|
91
|
+
|
92
|
+
Style/ClassAndModuleChildren:
|
93
|
+
Description: 'Checks style of children classes and modules.'
|
94
|
+
Enabled: true
|
95
|
+
|
96
|
+
Style/ClassCheck:
|
97
|
+
Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
|
98
|
+
Enabled: true
|
99
|
+
|
100
|
+
Style/ClassLength:
|
101
|
+
Description: 'Avoid classes longer than 100 lines of code.'
|
102
|
+
Enabled: true
|
103
|
+
|
104
|
+
Style/ClassMethods:
|
105
|
+
Description: 'Use self when defining module/class methods.'
|
106
|
+
Enabled: true
|
107
|
+
|
108
|
+
Style/ClassVars:
|
109
|
+
Description: 'Avoid the use of class variables.'
|
110
|
+
Enabled: true
|
111
|
+
|
112
|
+
Style/CollectionMethods:
|
113
|
+
Description: 'Preferred collection methods.'
|
114
|
+
Enabled: true
|
115
|
+
|
116
|
+
Style/ColonMethodCall:
|
117
|
+
Description: 'Do not use :: for method call.'
|
118
|
+
Enabled: true
|
119
|
+
|
120
|
+
Style/CommentAnnotation:
|
121
|
+
Description: >-
|
122
|
+
Checks formatting of special comments
|
123
|
+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
|
124
|
+
Enabled: true
|
125
|
+
|
126
|
+
Style/CommentIndentation:
|
127
|
+
Description: 'Indentation of comments.'
|
128
|
+
Enabled: true
|
129
|
+
|
130
|
+
Style/ConstantName:
|
131
|
+
Description: 'Constants should use SCREAMING_SNAKE_CASE.'
|
132
|
+
Enabled: true
|
133
|
+
|
134
|
+
Style/CyclomaticComplexity:
|
135
|
+
Description: 'Avoid complex methods.'
|
136
|
+
Enabled: true
|
137
|
+
|
138
|
+
Style/DefWithParentheses:
|
139
|
+
Description: 'Use def with parentheses when there are arguments.'
|
140
|
+
Enabled: true
|
141
|
+
|
142
|
+
Style/DeprecatedHashMethods:
|
143
|
+
Description: 'Checks for use of deprecated Hash methods.'
|
144
|
+
Enabled: true
|
145
|
+
|
146
|
+
Style/Documentation:
|
147
|
+
Description: 'Document classes and non-namespace modules.'
|
148
|
+
Enabled: true
|
149
|
+
|
150
|
+
Style/DotPosition:
|
151
|
+
Description: 'Checks the position of the dot in multi-line method calls.'
|
152
|
+
Enabled: true
|
153
|
+
|
154
|
+
Style/DoubleNegation:
|
155
|
+
Description: 'Checks for uses of double negation (!!).'
|
156
|
+
Enabled: true
|
157
|
+
|
158
|
+
Style/EachWithObject:
|
159
|
+
Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
|
160
|
+
Enabled: true
|
161
|
+
|
162
|
+
Style/EmptyLineBetweenDefs:
|
163
|
+
Description: 'Use empty lines between defs.'
|
164
|
+
Enabled: true
|
165
|
+
|
166
|
+
Style/EmptyLines:
|
167
|
+
Description: "Don't use several empty lines in a row."
|
168
|
+
Enabled: true
|
169
|
+
|
170
|
+
Style/EmptyLinesAroundAccessModifier:
|
171
|
+
Description: "Keep blank lines around access modifiers."
|
172
|
+
Enabled: true
|
173
|
+
|
174
|
+
Style/EmptyLinesAroundBody:
|
175
|
+
Description: "Keeps track of empty lines around expression bodies."
|
176
|
+
Enabled: true
|
177
|
+
|
178
|
+
Style/EmptyLiteral:
|
179
|
+
Description: 'Prefer literals to Array.new/Hash.new/String.new.'
|
180
|
+
Enabled: true
|
181
|
+
|
182
|
+
Style/Encoding:
|
183
|
+
Description: 'Use UTF-8 as the source file encoding.'
|
184
|
+
Enabled: true
|
185
|
+
|
186
|
+
Style/EndBlock:
|
187
|
+
Description: 'Avoid the use of END blocks.'
|
188
|
+
Enabled: true
|
189
|
+
|
190
|
+
Style/EndOfLine:
|
191
|
+
Description: 'Use Unix-style line endings.'
|
192
|
+
Enabled: true
|
193
|
+
|
194
|
+
Style/EvenOdd:
|
195
|
+
Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
|
196
|
+
Enabled: true
|
197
|
+
|
198
|
+
Style/FileName:
|
199
|
+
Description: 'Use snake_case for source file names.'
|
200
|
+
Enabled: true
|
201
|
+
|
202
|
+
Style/FlipFlop:
|
203
|
+
Description: 'Checks for flip flops'
|
204
|
+
Enabled: true
|
205
|
+
|
206
|
+
Style/For:
|
207
|
+
Description: 'Checks use of for or each in multiline loops.'
|
208
|
+
Enabled: true
|
209
|
+
|
210
|
+
Style/FormatString:
|
211
|
+
Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
|
212
|
+
Enabled: true
|
213
|
+
|
214
|
+
Style/GlobalVars:
|
215
|
+
Description: 'Do not introduce global variables.'
|
216
|
+
Enabled: true
|
217
|
+
|
218
|
+
Style/GuardClause:
|
219
|
+
Description: 'Check for conditionals that can be replaced with guard clauses'
|
220
|
+
Enabled: true
|
221
|
+
|
222
|
+
Style/HashSyntax:
|
223
|
+
Description: >-
|
224
|
+
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
225
|
+
{ :a => 1, :b => 2 }.
|
226
|
+
Enabled: true
|
227
|
+
|
228
|
+
Style/IfUnlessModifier:
|
229
|
+
Description: >-
|
230
|
+
Favor modifier if/unless usage when you have a
|
231
|
+
single-line body.
|
232
|
+
Enabled: true
|
233
|
+
|
234
|
+
Style/IfWithSemicolon:
|
235
|
+
Description: 'Never use if x; .... Use the ternary operator instead.'
|
236
|
+
Enabled: true
|
237
|
+
|
238
|
+
Style/IndentationConsistency:
|
239
|
+
Description: 'Keep indentation straight.'
|
240
|
+
Enabled: true
|
241
|
+
|
242
|
+
Style/IndentationWidth:
|
243
|
+
Description: 'Use 2 spaces for indentation.'
|
244
|
+
Enabled: true
|
245
|
+
|
246
|
+
Style/IndentArray:
|
247
|
+
Description: >-
|
248
|
+
Checks the indentation of the first element in an array
|
249
|
+
literal.
|
250
|
+
Enabled: true
|
251
|
+
|
252
|
+
Style/IndentHash:
|
253
|
+
Description: 'Checks the indentation of the first key in a hash literal.'
|
254
|
+
Enabled: true
|
255
|
+
|
256
|
+
Style/Lambda:
|
257
|
+
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
258
|
+
Enabled: true
|
259
|
+
|
260
|
+
Style/LambdaCall:
|
261
|
+
Description: 'Use lambda.call(...) instead of lambda.(...).'
|
262
|
+
Enabled: true
|
263
|
+
|
264
|
+
Style/LeadingCommentSpace:
|
265
|
+
Description: 'Comments should start with a space.'
|
266
|
+
Enabled: true
|
267
|
+
|
268
|
+
Style/LineEndConcatenation:
|
269
|
+
Description: >-
|
270
|
+
Use \ instead of + or << to concatenate two string literals at
|
271
|
+
line end.
|
272
|
+
Enabled: true
|
273
|
+
|
274
|
+
Style/LineLength:
|
275
|
+
Description: 'Limit lines to 80 characters.'
|
276
|
+
Enabled: true
|
277
|
+
|
278
|
+
Style/MethodCallParentheses:
|
279
|
+
Description: 'Do not use parentheses for method calls with no arguments.'
|
280
|
+
Enabled: true
|
281
|
+
|
282
|
+
Style/MethodDefParentheses:
|
283
|
+
Description: >-
|
284
|
+
Checks if the method definitions have or don't have
|
285
|
+
parentheses.
|
286
|
+
Enabled: true
|
287
|
+
|
288
|
+
Style/MethodLength:
|
289
|
+
Description: 'Avoid methods longer than 10 lines of code.'
|
290
|
+
Enabled: true
|
291
|
+
|
292
|
+
Style/MethodName:
|
293
|
+
Description: 'Use the configured style when naming methods.'
|
294
|
+
Enabled: true
|
295
|
+
|
296
|
+
Style/ModuleFunction:
|
297
|
+
Description: 'Checks for usage of `extend self` in modules.'
|
298
|
+
Enabled: true
|
299
|
+
|
300
|
+
Style/MultilineBlockChain:
|
301
|
+
Description: 'Avoid multi-line chains of blocks.'
|
302
|
+
Enabled: true
|
303
|
+
|
304
|
+
Style/MultilineIfThen:
|
305
|
+
Description: 'Never use then for multi-line if/unless.'
|
306
|
+
Enabled: true
|
307
|
+
|
308
|
+
Style/MultilineTernaryOperator:
|
309
|
+
Description: >-
|
310
|
+
Avoid multi-line ?: (the ternary operator);
|
311
|
+
use if/unless instead.
|
312
|
+
Enabled: true
|
313
|
+
|
314
|
+
Style/NegatedIf:
|
315
|
+
Description: >-
|
316
|
+
Favor unless over if for negative conditions
|
317
|
+
(or control flow or).
|
318
|
+
Enabled: true
|
319
|
+
|
320
|
+
Style/NegatedWhile:
|
321
|
+
Description: 'Favor until over while for negative conditions.'
|
322
|
+
Enabled: true
|
323
|
+
|
324
|
+
Style/NestedTernaryOperator:
|
325
|
+
Description: 'Use one expression per branch in a ternary operator.'
|
326
|
+
Enabled: true
|
327
|
+
|
328
|
+
Style/Next:
|
329
|
+
Description: 'Use `next` to skip iteration instead of a condition at the end.'
|
330
|
+
Enabled: true
|
331
|
+
|
332
|
+
Style/NilComparison:
|
333
|
+
Description: 'Prefer x.nil? to x == nil.'
|
334
|
+
Enabled: true
|
335
|
+
|
336
|
+
Style/NonNilCheck:
|
337
|
+
Description: 'Checks for redundant nil checks.'
|
338
|
+
Enabled: true
|
339
|
+
|
340
|
+
Style/Not:
|
341
|
+
Description: 'Use ! instead of not.'
|
342
|
+
Enabled: true
|
343
|
+
|
344
|
+
Style/NumericLiterals:
|
345
|
+
Description: >-
|
346
|
+
Add underscores to large numeric literals to improve their
|
347
|
+
readability.
|
348
|
+
Enabled: true
|
349
|
+
|
350
|
+
Style/OneLineConditional:
|
351
|
+
Description: >-
|
352
|
+
Favor the ternary operator(?:) over
|
353
|
+
if/then/else/end constructs.
|
354
|
+
Enabled: true
|
355
|
+
|
356
|
+
Style/OpMethod:
|
357
|
+
Description: 'When defining binary operators, name the argument other.'
|
358
|
+
Enabled: true
|
359
|
+
|
360
|
+
Style/ParameterLists:
|
361
|
+
Description: 'Avoid parameter lists longer than three or four parameters.'
|
362
|
+
Enabled: true
|
363
|
+
|
364
|
+
Style/ParenthesesAroundCondition:
|
365
|
+
Description: >-
|
366
|
+
Don't use parentheses around the condition of an
|
367
|
+
if/unless/while.
|
368
|
+
Enabled: true
|
369
|
+
|
370
|
+
Style/PercentLiteralDelimiters:
|
371
|
+
Description: 'Use `%`-literal delimiters consistently'
|
372
|
+
Enabled: true
|
373
|
+
|
374
|
+
Style/PerlBackrefs:
|
375
|
+
Description: 'Avoid Perl-style regex back references.'
|
376
|
+
Enabled: true
|
377
|
+
|
378
|
+
Style/PredicateName:
|
379
|
+
Description: 'Check the names of predicate methods.'
|
380
|
+
Enabled: true
|
381
|
+
|
382
|
+
Style/Proc:
|
383
|
+
Description: 'Use proc instead of Proc.new.'
|
384
|
+
Enabled: true
|
385
|
+
|
386
|
+
Style/RaiseArgs:
|
387
|
+
Description: 'Checks the arguments passed to raise/fail.'
|
388
|
+
Enabled: true
|
389
|
+
|
390
|
+
Style/RedundantBegin:
|
391
|
+
Description: "Don't use begin blocks when they are not needed."
|
392
|
+
Enabled: true
|
393
|
+
|
394
|
+
Style/RedundantException:
|
395
|
+
Description: "Checks for an obsolete RuntimeException argument in raise/fail."
|
396
|
+
Enabled: true
|
397
|
+
|
398
|
+
Style/RedundantReturn:
|
399
|
+
Description: "Don't use return where it's not required."
|
400
|
+
Enabled: true
|
401
|
+
|
402
|
+
Style/RedundantSelf:
|
403
|
+
Description: "Don't use self where it's not needed."
|
404
|
+
Enabled: true
|
405
|
+
|
406
|
+
Style/RegexpLiteral:
|
407
|
+
Description: >-
|
408
|
+
Use %r for regular expressions matching more than
|
409
|
+
`MaxSlashes` '/' characters.
|
410
|
+
Use %r only for regular expressions matching more than
|
411
|
+
`MaxSlashes` '/' character.
|
412
|
+
Enabled: true
|
413
|
+
|
414
|
+
Style/RescueModifier:
|
415
|
+
Description: 'Avoid using rescue in its modifier form.'
|
416
|
+
Enabled: true
|
417
|
+
|
418
|
+
Style/SelfAssignment:
|
419
|
+
Description: 'Checks for places where self-assignment shorthand should have been used.'
|
420
|
+
Enabled: true
|
421
|
+
|
422
|
+
Style/Semicolon:
|
423
|
+
Description: "Don't use semicolons to terminate expressions."
|
424
|
+
Enabled: true
|
425
|
+
|
426
|
+
Style/SignalException:
|
427
|
+
Description: 'Checks for proper usage of fail and raise.'
|
428
|
+
Enabled: true
|
429
|
+
|
430
|
+
Style/SingleLineBlockParams:
|
431
|
+
Description: 'Enforces the names of some block params.'
|
432
|
+
Enabled: true
|
433
|
+
|
434
|
+
Style/SingleLineMethods:
|
435
|
+
Description: 'Avoid single-line methods.'
|
436
|
+
Enabled: true
|
437
|
+
|
438
|
+
Style/SingleSpaceBeforeFirstArg:
|
439
|
+
Description: >-
|
440
|
+
Checks that exactly one space is used between a method name
|
441
|
+
and the first argument for method calls without parentheses.
|
442
|
+
Enabled: true
|
443
|
+
|
444
|
+
Style/SpaceAfterColon:
|
445
|
+
Description: 'Use spaces after colons.'
|
446
|
+
Enabled: true
|
447
|
+
|
448
|
+
Style/SpaceAfterComma:
|
449
|
+
Description: 'Use spaces after commas.'
|
450
|
+
Enabled: true
|
451
|
+
|
452
|
+
Style/SpaceAfterControlKeyword:
|
453
|
+
Description: 'Use spaces after if/elsif/unless/while/until/case/when.'
|
454
|
+
Enabled: true
|
455
|
+
|
456
|
+
Style/SpaceAfterMethodName:
|
457
|
+
Description: >-
|
458
|
+
Never put a space between a method name and the opening
|
459
|
+
parenthesis in a method definition.
|
460
|
+
Enabled: true
|
461
|
+
|
462
|
+
Style/SpaceAfterNot:
|
463
|
+
Description: Tracks redundant space after the ! operator.
|
464
|
+
Enabled: true
|
465
|
+
|
466
|
+
Style/SpaceAfterSemicolon:
|
467
|
+
Description: 'Use spaces after semicolons.'
|
468
|
+
Enabled: true
|
469
|
+
|
470
|
+
Style/SpaceBeforeBlockBraces:
|
471
|
+
Description: >-
|
472
|
+
Checks that the left block brace has or doesn't have space
|
473
|
+
before it.
|
474
|
+
Enabled: true
|
475
|
+
|
476
|
+
Style/SpaceBeforeComma:
|
477
|
+
Description: 'No spaces before commas.'
|
478
|
+
Enabled: true
|
479
|
+
|
480
|
+
Style/SpaceBeforeComment:
|
481
|
+
Description: >-
|
482
|
+
Checks for missing space between code and a comment on the
|
483
|
+
same line.
|
484
|
+
Enabled: true
|
485
|
+
|
486
|
+
Style/SpaceBeforeSemicolon:
|
487
|
+
Description: 'No spaces before semicolons.'
|
488
|
+
Enabled: true
|
489
|
+
|
490
|
+
Style/SpaceInsideBlockBraces:
|
491
|
+
Description: >-
|
492
|
+
Checks that block braces have or don't have surrounding space.
|
493
|
+
For blocks taking parameters, checks that the left brace has
|
494
|
+
or doesn't have trailing space.
|
495
|
+
Enabled: true
|
496
|
+
|
497
|
+
Style/SpaceAroundEqualsInParameterDefault:
|
498
|
+
Description: >-
|
499
|
+
Checks that the equals signs in parameter default assignments
|
500
|
+
have or don't have surrounding space depending on
|
501
|
+
configuration.
|
502
|
+
Enabled: true
|
503
|
+
|
504
|
+
Style/SpaceAroundOperators:
|
505
|
+
Description: 'Use spaces around operators.'
|
506
|
+
Enabled: true
|
507
|
+
|
508
|
+
Style/SpaceBeforeModifierKeyword:
|
509
|
+
Description: 'Put a space before the modifier keyword.'
|
510
|
+
Enabled: true
|
511
|
+
|
512
|
+
Style/SpaceInsideBrackets:
|
513
|
+
Description: 'No spaces after [ or before ].'
|
514
|
+
Enabled: true
|
515
|
+
|
516
|
+
Style/SpaceInsideHashLiteralBraces:
|
517
|
+
Description: "Use spaces inside hash literal braces - or don't."
|
518
|
+
Enabled: true
|
519
|
+
|
520
|
+
Style/SpaceInsideParens:
|
521
|
+
Description: 'No spaces after ( or before ).'
|
522
|
+
Enabled: true
|
523
|
+
|
524
|
+
Style/SpecialGlobalVars:
|
525
|
+
Description: 'Avoid Perl-style global variables.'
|
526
|
+
Enabled: true
|
527
|
+
|
528
|
+
Style/StringLiterals:
|
529
|
+
Description: 'Checks if uses of quotes match the configured preference.'
|
530
|
+
Enabled: true
|
531
|
+
|
532
|
+
Style/Tab:
|
533
|
+
Description: 'No hard tabs.'
|
534
|
+
Enabled: true
|
535
|
+
|
536
|
+
Style/TrailingBlankLines:
|
537
|
+
Description: 'Checks trailing blank lines and final newline.'
|
538
|
+
Enabled: true
|
539
|
+
|
540
|
+
Style/TrailingComma:
|
541
|
+
Description: 'Checks for trailing comma in parameter lists and literals.'
|
542
|
+
Enabled: true
|
543
|
+
|
544
|
+
Style/TrailingWhitespace:
|
545
|
+
Description: 'Avoid trailing whitespace.'
|
546
|
+
Enabled: true
|
547
|
+
|
548
|
+
Style/TrivialAccessors:
|
549
|
+
Description: 'Prefer attr_* methods to trivial readers/writers.'
|
550
|
+
Enabled: true
|
551
|
+
|
552
|
+
Style/UnlessElse:
|
553
|
+
Description: >-
|
554
|
+
Never use unless with else. Rewrite these with the positive
|
555
|
+
case first.
|
556
|
+
Enabled: true
|
557
|
+
|
558
|
+
Style/UnneededCapitalW:
|
559
|
+
Description: 'Checks for %W when interpolation is not needed.'
|
560
|
+
Enabled: true
|
561
|
+
|
562
|
+
Style/UnneededPercentQ:
|
563
|
+
Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
|
564
|
+
Enabled: true
|
565
|
+
|
566
|
+
Style/UnneededPercentX:
|
567
|
+
Description: 'Checks for %x when `` would do.'
|
568
|
+
Enabled: true
|
569
|
+
|
570
|
+
Style/VariableInterpolation:
|
571
|
+
Description: >-
|
572
|
+
Don't interpolate global, instance and class variables
|
573
|
+
directly in strings.
|
574
|
+
Enabled: true
|
575
|
+
|
576
|
+
Style/VariableName:
|
577
|
+
Description: 'Use the configured style when naming variables.'
|
578
|
+
Enabled: true
|
579
|
+
|
580
|
+
Style/WhenThen:
|
581
|
+
Description: 'Use when x then ... for one-line cases.'
|
582
|
+
Enabled: true
|
583
|
+
|
584
|
+
Style/WhileUntilDo:
|
585
|
+
Description: 'Checks for redundant do after while or until.'
|
586
|
+
Enabled: true
|
587
|
+
|
588
|
+
Style/WhileUntilModifier:
|
589
|
+
Description: >-
|
590
|
+
Favor modifier while/until usage when you have a
|
591
|
+
single-line body.
|
592
|
+
Enabled: true
|
593
|
+
|
594
|
+
Style/WordArray:
|
595
|
+
Description: 'Use %w or %W for arrays of words.'
|
596
|
+
Enabled: true
|
597
|
+
|
598
|
+
#################### Lint ################################
|
599
|
+
### Warnings
|
600
|
+
|
601
|
+
Lint/AmbiguousOperator:
|
602
|
+
Description: >-
|
603
|
+
Checks for ambiguous operators in the first argument of a
|
604
|
+
method invocation without parentheses.
|
605
|
+
Enabled: true
|
606
|
+
|
607
|
+
Lint/AmbiguousRegexpLiteral:
|
608
|
+
Description: >-
|
609
|
+
Checks for ambiguous regexp literals in the first argument of
|
610
|
+
a method invocation without parenthesis.
|
611
|
+
Enabled: true
|
612
|
+
|
613
|
+
Lint/AssignmentInCondition:
|
614
|
+
Description: "Don't use assignment in conditions."
|
615
|
+
Enabled: true
|
616
|
+
|
617
|
+
Lint/BlockAlignment:
|
618
|
+
Description: 'Align block ends correctly.'
|
619
|
+
Enabled: true
|
620
|
+
|
621
|
+
Lint/ConditionPosition:
|
622
|
+
Description: 'Checks for condition placed in a confusing position relative to the keyword.'
|
623
|
+
Enabled: true
|
624
|
+
|
625
|
+
Lint/Debugger:
|
626
|
+
Description: 'Check for debugger calls.'
|
627
|
+
Enabled: true
|
628
|
+
|
629
|
+
Lint/DefEndAlignment:
|
630
|
+
Description: 'Align ends corresponding to defs correctly.'
|
631
|
+
Enabled: true
|
632
|
+
|
633
|
+
Lint/DeprecatedClassMethods:
|
634
|
+
Description: 'Check for deprecated class method calls.'
|
635
|
+
Enabled: true
|
636
|
+
|
637
|
+
Lint/ElseLayout:
|
638
|
+
Description: 'Check for odd code arrangement in an else block.'
|
639
|
+
Enabled: true
|
640
|
+
|
641
|
+
Lint/EmptyEnsure:
|
642
|
+
Description: 'Checks for empty ensure block.'
|
643
|
+
Enabled: true
|
644
|
+
|
645
|
+
Lint/EmptyInterpolation:
|
646
|
+
Description: 'Checks for empty string interpolation.'
|
647
|
+
Enabled: true
|
648
|
+
|
649
|
+
Lint/EndAlignment:
|
650
|
+
Description: 'Align ends correctly.'
|
651
|
+
Enabled: true
|
652
|
+
|
653
|
+
Lint/EndInMethod:
|
654
|
+
Description: 'END blocks should not be placed inside method definitions.'
|
655
|
+
Enabled: true
|
656
|
+
|
657
|
+
Lint/EnsureReturn:
|
658
|
+
Description: 'Never use return in an ensure block.'
|
659
|
+
Enabled: true
|
660
|
+
|
661
|
+
Lint/Eval:
|
662
|
+
Description: 'The use of eval represents a serious security risk.'
|
663
|
+
Enabled: true
|
664
|
+
|
665
|
+
Lint/HandleExceptions:
|
666
|
+
Description: "Don't suppress exception."
|
667
|
+
Enabled: true
|
668
|
+
|
669
|
+
Lint/InvalidCharacterLiteral:
|
670
|
+
Description: >-
|
671
|
+
Checks for invalid character literals with a non-escaped
|
672
|
+
whitespace character.
|
673
|
+
Enabled: true
|
674
|
+
|
675
|
+
Lint/LiteralInCondition:
|
676
|
+
Description: 'Checks of literals used in conditions.'
|
677
|
+
Enabled: true
|
678
|
+
|
679
|
+
Lint/LiteralInInterpolation:
|
680
|
+
Description: 'Checks for literals used in interpolation.'
|
681
|
+
Enabled: true
|
682
|
+
|
683
|
+
Lint/Loop:
|
684
|
+
Description: >-
|
685
|
+
Use Kernel#loop with break rather than begin/end/until or
|
686
|
+
begin/end/while for post-loop tests.
|
687
|
+
Enabled: true
|
688
|
+
|
689
|
+
Lint/ParenthesesAsGroupedExpression:
|
690
|
+
Description: >-
|
691
|
+
Checks for method calls with a space before the opening
|
692
|
+
parenthesis.
|
693
|
+
Enabled: true
|
694
|
+
|
695
|
+
Lint/RequireParentheses:
|
696
|
+
Description: >-
|
697
|
+
Use parentheses in the method call to avoid confusion
|
698
|
+
about precedence.
|
699
|
+
Enabled: true
|
700
|
+
|
701
|
+
Lint/RescueException:
|
702
|
+
Description: 'Avoid rescuing the Exception class.'
|
703
|
+
Enabled: true
|
704
|
+
|
705
|
+
Lint/ShadowingOuterLocalVariable:
|
706
|
+
Description: >-
|
707
|
+
Do not use the same name as outer local variable
|
708
|
+
for block arguments or block local variables.
|
709
|
+
Enabled: true
|
710
|
+
|
711
|
+
Lint/SpaceBeforeFirstArg:
|
712
|
+
Description: >-
|
713
|
+
Put a space between a method name and the first argument
|
714
|
+
in a method call without parentheses.
|
715
|
+
Enabled: true
|
716
|
+
|
717
|
+
Lint/StringConversionInInterpolation:
|
718
|
+
Description: 'Checks for Object#to_s usage in string interpolation.'
|
719
|
+
Enabled: true
|
720
|
+
|
721
|
+
Lint/UnderscorePrefixedVariableName:
|
722
|
+
Description: 'Do not use prefix `_` for a variable that is used.'
|
723
|
+
Enabled: true
|
724
|
+
|
725
|
+
Lint/UnusedBlockArgument:
|
726
|
+
Description: 'Checks for unused block arguments.'
|
727
|
+
Enabled: true
|
728
|
+
|
729
|
+
Lint/UnusedMethodArgument:
|
730
|
+
Description: 'Checks for unused method arguments.'
|
731
|
+
Enabled: true
|
732
|
+
|
733
|
+
Lint/UnreachableCode:
|
734
|
+
Description: 'Unreachable code.'
|
735
|
+
Enabled: true
|
736
|
+
|
737
|
+
Lint/UselessAccessModifier:
|
738
|
+
Description: 'Checks for useless access modifiers.'
|
739
|
+
Enabled: true
|
740
|
+
|
741
|
+
Lint/UselessAssignment:
|
742
|
+
Description: 'Checks for useless assignment to a local variable.'
|
743
|
+
Enabled: true
|
744
|
+
|
745
|
+
Lint/UselessComparison:
|
746
|
+
Description: 'Checks for comparison of something with itself.'
|
747
|
+
Enabled: true
|
748
|
+
|
749
|
+
Lint/UselessElseWithoutRescue:
|
750
|
+
Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
|
751
|
+
Enabled: true
|
752
|
+
|
753
|
+
Lint/UselessSetterCall:
|
754
|
+
Description: 'Checks for useless setter call to a local variable.'
|
755
|
+
Enabled: true
|
756
|
+
|
757
|
+
Lint/Void:
|
758
|
+
Description: 'Possible use of operator/literal/variable in void context.'
|
759
|
+
Enabled: true
|
760
|
+
|
761
|
+
##################### Rails ##################################
|
762
|
+
|
763
|
+
Rails/ActionFilter:
|
764
|
+
Description: 'Enforces consistent use of action filter methods.'
|
765
|
+
Enabled: true
|
766
|
+
|
767
|
+
Rails/DefaultScope:
|
768
|
+
Description: 'Checks if the argument passed to default_scope is a block.'
|
769
|
+
Enabled: true
|
770
|
+
|
771
|
+
Rails/Delegate:
|
772
|
+
Description: 'Prefer delegate method for delegations.'
|
773
|
+
Enabled: true
|
774
|
+
|
775
|
+
Rails/HasAndBelongsToMany:
|
776
|
+
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
|
777
|
+
Enabled: true
|
778
|
+
|
779
|
+
Rails/Output:
|
780
|
+
Description: 'Checks for calls to puts, print, etc.'
|
781
|
+
Enabled: true
|
782
|
+
|
783
|
+
Rails/ReadWriteAttribute:
|
784
|
+
Description: 'Checks for read_attribute(:attr) and write_attribute(:attr, val).'
|
785
|
+
Enabled: true
|
786
|
+
|
787
|
+
Rails/ScopeArgs:
|
788
|
+
Description: 'Checks the arguments of ActiveRecord scopes.'
|
789
|
+
Enabled: true
|
790
|
+
|
791
|
+
Rails/Validation:
|
792
|
+
Description: 'Use sexy validations.'
|
793
|
+
Enabled: true
|