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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6496eae0006789063c795fdb605512ea77a818f7
4
- data.tar.gz: ad9196ee1bcb21cce83302616a0e697cacc65ca9
2
+ SHA256:
3
+ metadata.gz: 4edae991bbf997137f70923de75efa9f962e3bbbef4adf23153b9665647d7ab3
4
+ data.tar.gz: 3177e5e82f471687ba7f5bbe1be982ff61009776b5253559e9e796e8426d2459
5
5
  SHA512:
6
- metadata.gz: c1bc3c7d665d73db37cd303bca169baf5136dbf4c3d92f29a958611e775004a0669de1090ac803480c82e6a60ba27ca5b84649b0e20ea591c69b3d7f4b06f01c
7
- data.tar.gz: 105b51b7973490909180f69aa17224429c30af58cc408504e1e0707e2c9696c3a54e268df985057dd1ac04fbd551ce346a9462e22a08361b5c1682bfb129363a
6
+ metadata.gz: c8af65c62bc28e8f76e8e182031c7db29d0106389a5a5284fb311ede92976aa687b8f9f91b03d55ad3f57956e8de41c3b27ab206c1fcc2225ed9553bf6be62f6
7
+ data.tar.gz: b0ecc14943daa0f43b6cc731e5600b0b2843b0ed95d26f2bcbdf39fbb94adee6be5332cf8107d9ff04cd1469db319475538de37e9058e0b11cdabd71b4bb23a6
@@ -5,6 +5,11 @@ Changelog
5
5
  master
6
6
  ---
7
7
 
8
+ 2.2.0
9
+ ---
10
+
11
+ - also inspect `.rake` files
12
+ - readme format changes
8
13
 
9
14
  2.1.0
10
15
  ---
@@ -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
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
  gemspec
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017 Runtastic
3
+ Copyright (c) 2019 runtastic GmbH
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,31 +1,32 @@
1
1
  # RubocopRunner
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/rubocop_runner.svg)](https://badge.fury.io/rb/rubocop_runner)
3
+ [![Gem Version](https://badge.fury.io/rb/rubocop_runner.svg)][rubygems]
4
4
 
5
- This gem provides means of running rubocop including auto-correct on all files
6
- which are currently staged in git. This can be easily used as pre-commit hook
7
- with the included template.
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
- If rubocop can fix all detected issues itself via autocorrect it will will do
10
- so. The commit will abort in this situation.
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
- group :development do
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 also run `bin/console` for an interactive prompt that will allow you to experiment.
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 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).
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
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
 
3
5
  begin
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'rubocop_runner'
@@ -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(Guardfile Gemfile Rakefile config.ru).freeze
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(--auto-correct
61
+ DEFAULT_ARGS = %w[--auto-correct
59
62
  --format fuubar
60
63
  --force-exclusion
61
- --fail-level autocorrect).freeze
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
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RubocopRunner
2
- VERSION = '2.1.0'.freeze
4
+ VERSION = '2.2.0'
3
5
  end
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  begin
4
5
  require 'bundler/setup'
@@ -1,5 +1,6 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
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', '~> 1.10'
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.1.0
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: 2018-01-02 00:00:00.000000000 Z
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: rubocop
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: pry
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.txt
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
- rubyforge_project:
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