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.
24
3- Optionally, the "OnlyFor" configuration
5+ The optional "OnlyFor" configuration array
46can be used to only register offenses when the gems
57use certain options or have version specifiers.
6- Add "version_specifiers" and/or the gem option names
7- you want to check.
88
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
1019options that change the source of a gem:
1120
1221- ` bitbucket `
@@ -16,7 +25,8 @@ options that change the source of a gem:
1625- ` source `
1726
1827For 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+ .
2030
2131### Example: OnlyFor: [ ] (default)
2232 # bad
@@ -38,6 +48,18 @@ you can check the https://bundler.io/man/gemfile.5.html[official documentation].
3848 # Version 2.1 introduces breaking change baz
3949 gem 'foo', '< 2.1'
4050
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+
4163### Example: OnlyFor: [ 'version_specifiers', 'github']
4264 # bad
4365
0 commit comments