rubocop_runner 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +69 -0
- data/Gemfile +2 -0
- data/{LICENSE.txt → LICENSE} +1 -1
- data/README.md +25 -22
- data/Rakefile +2 -0
- data/bin/console +1 -0
- data/lib/rubocop_runner.rb +10 -4
- data/lib/rubocop_runner/version.rb +3 -1
- data/lib/template/pre-commit +1 -0
- data/rubocop_runner.gemspec +5 -4
- metadata +15 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4edae991bbf997137f70923de75efa9f962e3bbbef4adf23153b9665647d7ab3
|
4
|
+
data.tar.gz: 3177e5e82f471687ba7f5bbe1be982ff61009776b5253559e9e796e8426d2459
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8af65c62bc28e8f76e8e182031c7db29d0106389a5a5284fb311ede92976aa687b8f9f91b03d55ad3f57956e8de41c3b27ab206c1fcc2225ed9553bf6be62f6
|
7
|
+
data.tar.gz: b0ecc14943daa0f43b6cc731e5600b0b2843b0ed95d26f2bcbdf39fbb94adee6be5332cf8107d9ff04cd1469db319475538de37e9058e0b11cdabd71b4bb23a6
|
data/CHANGELOG.md
CHANGED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
58
|
+
faith may face temporary or permanent repercussions as determined by other
|
59
|
+
members of the project's leadership.
|
60
|
+
|
61
|
+
## Attribution
|
62
|
+
|
63
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
64
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
65
|
+
|
66
|
+
[homepage]: https://www.contributor-covenant.org
|
67
|
+
|
68
|
+
For answers to common questions about this code of conduct, see
|
69
|
+
https://www.contributor-covenant.org/faq
|
data/Gemfile
CHANGED
data/{LICENSE.txt → LICENSE}
RENAMED
data/README.md
CHANGED
@@ -1,31 +1,32 @@
|
|
1
1
|
# RubocopRunner
|
2
2
|
|
3
|
-
[]
|
3
|
+
[][rubygems]
|
4
4
|
|
5
|
-
This gem provides
|
6
|
-
|
7
|
-
|
5
|
+
This gem provides you with a rake task to install rubocop as a git pre-commit hook.
|
6
|
+
If rubocop finds any issues it will abort the commit. It will try to auto-correct
|
7
|
+
all issues in the files that are being commited, but will abort the commit even
|
8
|
+
if all issues can be auto-corrected so that you can verify the changes before
|
9
|
+
actually commiting them.
|
8
10
|
|
9
|
-
|
10
|
-
|
11
|
-
In case rubocop accepts all code changes the commit continues.
|
12
|
-
|
13
|
-
_Although this gem has no tests it's pretty battle tested and is in use at runtastic since years._
|
11
|
+
_Although this gem has no tests it's battle tested and is in use at runtastic
|
12
|
+
since years._
|
14
13
|
|
15
14
|
## Installation
|
16
15
|
|
17
16
|
Add these lines to your application's Gemfile:
|
18
17
|
|
19
18
|
```ruby
|
20
|
-
|
21
|
-
gem 'rubocop_runner', '~> 2.0', require: false
|
22
|
-
end
|
19
|
+
gem 'rubocop_runner', '~> 2.1', require: false
|
23
20
|
```
|
24
21
|
|
25
22
|
And then execute:
|
26
23
|
|
27
24
|
$ bundle
|
28
25
|
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install rubocop_runner
|
29
|
+
|
29
30
|
## Usage
|
30
31
|
|
31
32
|
To create a rubocop runner pre-commit hook once just run
|
@@ -45,22 +46,24 @@ RubocopRunner::RakeTask.new
|
|
45
46
|
Afterwards, just run the `rake rubocop:install` task to install the pre-commit
|
46
47
|
hook.
|
47
48
|
|
48
|
-
## ToDo
|
49
|
-
|
50
|
-
- add tests
|
51
|
-
- improve gem structure
|
52
|
-
|
53
49
|
## Development
|
54
50
|
|
55
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can
|
51
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can
|
52
|
+
also run `bin/console` for an interactive prompt that will allow you to experiment.
|
56
53
|
|
57
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To
|
54
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
55
|
+
release a new version, update the version number in `version.rb`, and then run
|
56
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
57
|
+
git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
58
58
|
|
59
59
|
## Contributing
|
60
|
-
|
61
60
|
Bug reports and pull requests are welcome on GitHub at https://github.com/runtastic/rubocop_runner.
|
61
|
+
This project is intended to be a safe, welcoming space for collaboration, and
|
62
|
+
contributors are expected to adhere to the [code of conduct][cc].
|
62
63
|
|
63
64
|
## License
|
65
|
+
The gem is available as open source under [the terms of the MIT License][mit].
|
64
66
|
|
65
|
-
|
66
|
-
|
67
|
+
[rubygems]: https://rubygems.org/gems/rubocop_runner
|
68
|
+
[mit]: https://choosealicense.com/licenses/mit/
|
69
|
+
[cc]: ../CODE_OF_CONDUCT.md
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
data/lib/rubocop_runner.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rubocop_runner/version'
|
2
4
|
require 'rubocop'
|
3
5
|
|
@@ -7,6 +9,7 @@ module RubocopRunner
|
|
7
9
|
# from https://github.com/djberg96/ptools/blob/master/lib/ptools.rb#L90
|
8
10
|
def binary?(file)
|
9
11
|
return true if File.ftype(file) != 'file'
|
12
|
+
|
10
13
|
s = (File.read(file, File.stat(file).blksize) || '').split(//)
|
11
14
|
((s.size - s.grep(' '..'~').size) / s.size.to_f) > 0.30
|
12
15
|
end
|
@@ -42,8 +45,8 @@ module RubocopRunner
|
|
42
45
|
end
|
43
46
|
end
|
44
47
|
|
45
|
-
RUBY_PATTERN = /\.(rb|gemspec)
|
46
|
-
RUBY_NAMES = %w
|
48
|
+
RUBY_PATTERN = /\.(rb|gemspec|rake)$/.freeze
|
49
|
+
RUBY_NAMES = %w[Guardfile Gemfile Rakefile config.ru].freeze
|
47
50
|
|
48
51
|
def ruby_file?(filename)
|
49
52
|
RUBY_NAMES.include?(filename) || !(filename =~ RUBY_PATTERN).nil?
|
@@ -55,12 +58,13 @@ module RubocopRunner
|
|
55
58
|
end
|
56
59
|
end
|
57
60
|
|
58
|
-
DEFAULT_ARGS = %w
|
61
|
+
DEFAULT_ARGS = %w[--auto-correct
|
59
62
|
--format fuubar
|
60
63
|
--force-exclusion
|
61
|
-
--fail-level autocorrect
|
64
|
+
--fail-level autocorrect].freeze
|
62
65
|
def run
|
63
66
|
return 0 if staged_ruby_files.empty?
|
67
|
+
|
64
68
|
::RuboCop::CLI.new.run(DEFAULT_ARGS + staged_ruby_files)
|
65
69
|
end
|
66
70
|
|
@@ -73,6 +77,7 @@ module RubocopRunner
|
|
73
77
|
|
74
78
|
def create_backup(pre_commit_path)
|
75
79
|
return unless File.exist?(pre_commit_path)
|
80
|
+
|
76
81
|
FileUtils.mv(pre_commit_path,
|
77
82
|
pre_commit_path.join('.bkp'),
|
78
83
|
force: true)
|
@@ -82,6 +87,7 @@ module RubocopRunner
|
|
82
87
|
require 'fileutils'
|
83
88
|
git_root = Pathname.new "#{root}/.git"
|
84
89
|
return false unless File.exist?(git_root)
|
90
|
+
|
85
91
|
pre_commit_path = git_root.join('hooks', 'pre-commit')
|
86
92
|
create_backup(pre_commit_path)
|
87
93
|
|
data/lib/template/pre-commit
CHANGED
data/rubocop_runner.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'rubocop_runner/version'
|
5
6
|
|
@@ -22,9 +23,9 @@ Gem::Specification.new do |spec|
|
|
22
23
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
23
24
|
spec.require_paths = ['lib']
|
24
25
|
|
25
|
-
spec.add_development_dependency 'bundler', '
|
26
|
+
spec.add_development_dependency 'bundler', '> 1.10', '<3'
|
26
27
|
spec.add_development_dependency 'rake', '~> 10.0'
|
27
28
|
|
28
|
-
spec.add_development_dependency 'rubocop'
|
29
29
|
spec.add_development_dependency 'pry'
|
30
|
+
spec.add_development_dependency 'rubocop'
|
30
31
|
end
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop_runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Eger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.10'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3'
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">"
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '1.10'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rake
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +45,7 @@ dependencies:
|
|
39
45
|
- !ruby/object:Gem::Version
|
40
46
|
version: '10.0'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
48
|
+
name: pry
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - ">="
|
@@ -53,7 +59,7 @@ dependencies:
|
|
53
59
|
- !ruby/object:Gem::Version
|
54
60
|
version: '0'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
62
|
+
name: rubocop
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
65
|
- - ">="
|
@@ -81,8 +87,9 @@ files:
|
|
81
87
|
- ".gitignore"
|
82
88
|
- ".rubocop.yml"
|
83
89
|
- CHANGELOG.md
|
90
|
+
- CODE_OF_CONDUCT.md
|
84
91
|
- Gemfile
|
85
|
-
- LICENSE
|
92
|
+
- LICENSE
|
86
93
|
- README.md
|
87
94
|
- Rakefile
|
88
95
|
- bin/console
|
@@ -111,8 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
118
|
- !ruby/object:Gem::Version
|
112
119
|
version: '0'
|
113
120
|
requirements: []
|
114
|
-
|
115
|
-
rubygems_version: 2.6.13
|
121
|
+
rubygems_version: 3.0.3
|
116
122
|
signing_key:
|
117
123
|
specification_version: 4
|
118
124
|
summary: runs rubocop for all changed files
|