rubocop-rails_config 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +41 -2
- data/config/rails.yml +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b12c0f626b900e41ed88143a0f704e04e18e5f95ca42b7e31f43f2389a799723
|
4
|
+
data.tar.gz: 7009f6339dbff57b2545139424fe0b696b3867dd3965749d3ca3779c06dadb6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c273ac0553a3de3664ed667b8199efc1a43f3f4134939fc74642e62e73b4859bfe31d3b206d3bc9ce454f65bc04d181bf05de3c34f0fce812f9d965471e5b28b
|
7
|
+
data.tar.gz: 013c23118cd049e590fdd01ef09036590bae57ce68ba80eb912ca5b35da0709e9b5e45484c5305dbffd3ca46077d59b33efac22ceca24c9dc9db3452d7644b4e
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2019 Toshimaru Enomoto
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
6
|
|
data/README.md
CHANGED
@@ -17,7 +17,7 @@ gem "rubocop-rails_config"
|
|
17
17
|
|
18
18
|
## Usage
|
19
19
|
|
20
|
-
Add this line to your application's `.rubocop.yml
|
20
|
+
Add this line to your application's `.rubocop.yml`:
|
21
21
|
|
22
22
|
```yml
|
23
23
|
inherit_gem:
|
@@ -25,17 +25,56 @@ inherit_gem:
|
|
25
25
|
- config/rails.yml
|
26
26
|
```
|
27
27
|
|
28
|
+
Or just run:
|
29
|
+
|
30
|
+
```console
|
31
|
+
$ rails generate rubocop_rails_config:install
|
32
|
+
```
|
33
|
+
|
34
|
+
## Configuration
|
35
|
+
|
36
|
+
### TargetRubyVersion
|
37
|
+
|
38
|
+
Although Rails 6 only supports Ruby 2.5 or more, rubocop-rails_config still supports Ruby 2.3 or more to support as many Ruby versions as possible.
|
39
|
+
|
40
|
+
If you'd like to change `TargetRubyVersion`, see [Customization](#customization).
|
41
|
+
|
42
|
+
### Rails/AssertNot, Rails/RefuteMethods
|
43
|
+
|
44
|
+
| cop | description |
|
45
|
+
| --- | --- |
|
46
|
+
| `Rails/AssertNot` | Prefer assert_not over assert |
|
47
|
+
| `Rails/RefuteMethods` | Prefer assert_not_x over refute_x |
|
48
|
+
|
49
|
+
`assert_not` and `assert_not_xxx` methods are Rails assertion extension, so if you want to use these methods, require `activesupport` gem and inherit `ActiveSupport::TestCase`.
|
50
|
+
|
51
|
+
```rb
|
52
|
+
class AssertNotTest < ActiveSupport::TestCase
|
53
|
+
def test_assert_not_method
|
54
|
+
assert_not ...(code)...
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_assert_not_nil_method
|
58
|
+
assert_not_nil ...(code)...
|
59
|
+
end
|
60
|
+
end
|
61
|
+
```
|
62
|
+
|
63
|
+
See also. [ActiveSupport::TestCase](https://api.rubyonrails.org/classes/ActiveSupport/TestCase.html)
|
64
|
+
|
28
65
|
## Customization
|
29
66
|
|
30
|
-
If you'd like to customize the rubocop setting, you can override it.
|
67
|
+
If you'd like to customize the rubocop setting on your project, you can override it.
|
31
68
|
|
32
69
|
For example, if you want to change `TargetRubyVersion`, you can do it like:
|
33
70
|
|
34
71
|
```yml
|
72
|
+
# .rubocop.yml
|
35
73
|
inherit_gem:
|
36
74
|
rubocop-rails_config:
|
37
75
|
- config/rails.yml
|
38
76
|
|
77
|
+
# Override Setting
|
39
78
|
AllCops:
|
40
79
|
TargetRubyVersion: 2.6
|
41
80
|
```
|
data/config/rails.yml
CHANGED
@@ -3,6 +3,7 @@ require:
|
|
3
3
|
- rubocop-rails
|
4
4
|
|
5
5
|
AllCops:
|
6
|
+
# rubocop-rails_config still supports Ruby 2.3
|
6
7
|
TargetRubyVersion: 2.3
|
7
8
|
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
8
9
|
# to ignore them, so only the ones explicitly set in this file are enabled.
|
@@ -43,6 +44,9 @@ Style/AndOr:
|
|
43
44
|
Layout/CaseIndentation:
|
44
45
|
Enabled: true
|
45
46
|
|
47
|
+
Layout/ClosingHeredocIndentation:
|
48
|
+
Enabled: true
|
49
|
+
|
46
50
|
# Align comments with method definitions.
|
47
51
|
Layout/CommentIndentation:
|
48
52
|
Enabled: true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-rails_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toshimaru
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-11-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rubocop
|