makandra-rubocop 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/.gitignore +8 -0
- data/.rubocop.yml +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +22 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +38 -0
- data/LICENSE.txt +21 -0
- data/README.md +95 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/config/default.yml +4314 -0
- data/lib/makandra_rubocop/support/rubocop_spec.rb +11 -0
- data/lib/makandra_rubocop/version.rb +3 -0
- data/lib/makandra_rubocop.rb +4 -0
- data/makandra-rubocop.gemspec +29 -0
- metadata +104 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dc54683fa1e2c0eceae8b06d37d1f4b428f9bf15ca0d2966ead0230cf5a93aeb
|
4
|
+
data.tar.gz: e908e68baa27055a333b79dd3387303c8e0af6b1d0202f18fdb70ce0df7d3100
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d14cc9368ab5ad2480625be0da6786f8a18a594145fdbc908454e71eaafb61cca6700be8c9729b840564c14f10aa5da9359521a6cfc21654710858c57d242e4b
|
7
|
+
data.tar.gz: da13915354010462599284ef98cd92f994ffd2b8aa0d11b0589719fa89679627b2382bf9a11f9a9b30ecdadc93ae7faa4d55e2c871b9059c4c87bf57c15a382d
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
inherit_from: config/default.yml
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.3
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
All notable changes to this project will be documented in this file.
|
2
|
+
|
3
|
+
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
4
|
+
|
5
|
+
|
6
|
+
## Unreleased
|
7
|
+
|
8
|
+
### Breaking changes
|
9
|
+
|
10
|
+
-
|
11
|
+
|
12
|
+
### Compatible changes
|
13
|
+
|
14
|
+
-
|
15
|
+
|
16
|
+
|
17
|
+
## 1.0.0 - 2019-01-15
|
18
|
+
|
19
|
+
### Compatible changes
|
20
|
+
|
21
|
+
- First release of our default rule set. See README on how to integrate with your project.
|
22
|
+
- Rubocop 0.62.0
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
makandra-rubocop (1.0.0)
|
5
|
+
rubocop (~> 0.62.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.0)
|
11
|
+
jaro_winkler (1.5.2)
|
12
|
+
parallel (1.12.1)
|
13
|
+
parser (2.5.3.0)
|
14
|
+
ast (~> 2.4.0)
|
15
|
+
powerpack (0.1.2)
|
16
|
+
rainbow (3.0.0)
|
17
|
+
rake (12.3.2)
|
18
|
+
rubocop (0.62.0)
|
19
|
+
jaro_winkler (~> 1.5.1)
|
20
|
+
parallel (~> 1.10)
|
21
|
+
parser (>= 2.5, != 2.5.1.1)
|
22
|
+
powerpack (~> 0.1)
|
23
|
+
rainbow (>= 2.2.2, < 4.0)
|
24
|
+
ruby-progressbar (~> 1.7)
|
25
|
+
unicode-display_width (~> 1.4.0)
|
26
|
+
ruby-progressbar (1.10.0)
|
27
|
+
unicode-display_width (1.4.1)
|
28
|
+
|
29
|
+
PLATFORMS
|
30
|
+
ruby
|
31
|
+
|
32
|
+
DEPENDENCIES
|
33
|
+
bundler (~> 1.17)
|
34
|
+
makandra-rubocop!
|
35
|
+
rake (~> 12.3)
|
36
|
+
|
37
|
+
BUNDLED WITH
|
38
|
+
1.17.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 makandra
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
This gem holds makandra's default Rubocop configuration.
|
2
|
+
It is currently very relaxed, and will evolve over time.
|
3
|
+
|
4
|
+
Note that we lock each version on a specific Rubocop version, as Rubocop's syntax changes regularly.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'makandra-rubocop'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install makandra-rubocop
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Add `.rubocop.yml` to your project with the following contents:
|
25
|
+
|
26
|
+
```yaml
|
27
|
+
inherit_gem:
|
28
|
+
makandra-rubocop: config/default.yml
|
29
|
+
```
|
30
|
+
|
31
|
+
Any per-project rules can then be defined in `.rubocop.yml`.
|
32
|
+
|
33
|
+
### Executing Rubocop on demand
|
34
|
+
|
35
|
+
Run Rubocop via `bundle exec rubocop` from your project directory.
|
36
|
+
|
37
|
+
For an initial run it might also useful to use the auto-correct option (`bundle exec rubocop --auto-correct`) and carefully check in all changes.
|
38
|
+
|
39
|
+
### Integrating Rubocop into your test suite
|
40
|
+
|
41
|
+
We recommend you add an RSpec test that runs rubocop automatically and confirms that there are no offenses.
|
42
|
+
This gem provides one. Simply add `spec/rubocop_spec.rb` to your project with the following code.
|
43
|
+
|
44
|
+
```
|
45
|
+
require 'makandra_rubocop/support/rubocop_spec'
|
46
|
+
```
|
47
|
+
|
48
|
+
### Configuring exceptions
|
49
|
+
|
50
|
+
Some of our defaults might not fit your project. You can disable specific cops or add exclusions to `.rubocop.yml` in such cases. You basically have two options:
|
51
|
+
|
52
|
+
- Disable cops for specific lines using [Ruby comments in your code](https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md#disabling-cops-within-source-code), like so:
|
53
|
+
|
54
|
+
for x in (0..19) # rubocop:disable Style/For
|
55
|
+
|
56
|
+
- Disable entire files by [adding exclusions](https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md#cop-specific-include-and-exclude) to `.rubocop.yml`, like so:
|
57
|
+
|
58
|
+
Style/For:
|
59
|
+
Exclude:
|
60
|
+
- app/models/example.rb
|
61
|
+
|
62
|
+
See [Rubocop's configuration manual](https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md) for more information.
|
63
|
+
|
64
|
+
Note that disabling cops should be an exception for extremely rare cases where your code can not be aligned with Rubocop's requirements.
|
65
|
+
If our defaults don't match your opinion, you should discuss with the team.
|
66
|
+
|
67
|
+
|
68
|
+
## Development
|
69
|
+
|
70
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
71
|
+
|
72
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
73
|
+
|
74
|
+
### Upgrading Rubocop version being used
|
75
|
+
|
76
|
+
1. Change `rubocop` dependency in gemspec to the release you want to upgrade to.
|
77
|
+
2. `bundle`
|
78
|
+
3. `git add remote rubocop https://github.com/rubocop-hq/rubocop.git`
|
79
|
+
4. `git fetch rubocop --no-tags` (we can't import their tags or they would clash with ours)
|
80
|
+
5. Find out the commit SHA of the release you put into the gemspec.
|
81
|
+
6. `git checkout COMMIT_SHA config/default.yml`
|
82
|
+
7. `git reset` to unstage the changes you just picked
|
83
|
+
8. Review all changes and stage those that you want. Note that cop settings will be reverted to their default settings and that you do not want to add them all.
|
84
|
+
9. Commit.
|
85
|
+
|
86
|
+
|
87
|
+
## Contributing
|
88
|
+
|
89
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/makandra/makandra-rubocop.
|
90
|
+
|
91
|
+
If you make any changes to this gem's Ruby code, make sure to run `rubocop`.
|
92
|
+
|
93
|
+
## License
|
94
|
+
|
95
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'makandra_rubocop'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start(__FILE__)
|