1
- Add a comment describing each gem in your Gemfile.
1
+ Each gem in the Gemfile should have a comment explaining
2
+ its purpose in the project, or the reason for its version
3
+ or source.
2
4
3
- Optionally, the "OnlyFor" configuration
5
+ The optional "OnlyFor" configuration array
4
6
can be used to only register offenses when the gems
5
7
use certain options or have version specifiers.
6
- Add "version_specifiers" and/or the gem option names
7
- you want to check.
8
8
9
- A useful use-case is to enforce a comment when using
9
+ When "version_specifiers" is included, a comment
10
+ will be enforced if the gem has any version specifier.
11
+
12
+ When "restrictive_version_specifiers" is included, a comment
13
+ will be enforced if the gem has a version specifier that
14
+ holds back the version of the gem.
15
+
16
+ For any other value in the array, a comment will be enforced for
17
+ a gem if an option by the same name is present.
18
+ A useful use case is to enforce a comment when using
10
19
options that change the source of a gem:
11
20
12
21
- ` bitbucket `
@@ -16,7 +25,8 @@ options that change the source of a gem:
16
25
- ` source `
17
26
18
27
For a full list of options supported by bundler,
19
- you can check the https://bundler.io/man/gemfile.5.html[official documentation] .
28
+ see https://bundler.io/man/gemfile.5.html
29
+ .
20
30
21
31
### Example: OnlyFor: [ ] (default)
22
32
# bad
@@ -38,6 +48,18 @@ you can check the https://bundler.io/man/gemfile.5.html[official documentation].
38
48
# Version 2.1 introduces breaking change baz
39
49
gem 'foo', '< 2.1'
40
50
51
+ ### Example: OnlyFor: [ 'restrictive_version_specifiers']
52
+ # bad
53
+
54
+ gem 'foo', '< 2.1'
55
+
56
+ # good
57
+
58
+ gem 'foo', '>= 1.0'
59
+
60
+ # Version 2.1 introduces breaking change baz
61
+ gem 'foo', '< 2.1'
62
+
41
63
### Example: OnlyFor: [ 'version_specifiers', 'github']
42
64
# bad
43
65
0 commit comments