guard-rubocop 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d24bb6e38394405217e2cdaeadbba31085dc6af6
4
- data.tar.gz: 607b2fe39bbbe21909ec6e753dc271898fea9c58
2
+ SHA256:
3
+ metadata.gz: e66ec8cc26e03e6fc402a04e57ba01155e2811f53e2bbc07537ce83657240ee4
4
+ data.tar.gz: 98c66cd08f8ac9bbf37b259c11250bb24b2e123005c8306c066e0111f6cac935
5
5
  SHA512:
6
- metadata.gz: e09575c222b8c25ce5948bfa68e1c1da472b6f5b08ee38e756d507766386e2609396eaa3bb2d6942bead8deef1b92f899d9d21eacd5f858d82af9e4b28919b81
7
- data.tar.gz: bf60d391eab5ec1fc7c718b15b16c1d8fd06cd09ab327a587706efcdf7fe95d15c349ce32567e3875e9f73a33e8ac7692b75d126d633e913fb1160e74d61ace9
6
+ metadata.gz: '09bf72978e4a18615a30494e8422c7f66cac1fd0f01ede788966ab47f2ea41541b08fe81e6dae2200e09407973cefc821deabe7577e8983b52788e9d005324fa'
7
+ data.tar.gz: '0490a4d82a4fc9385c8e01ffe6cf7bec665d67d494a830b5bd8063b281c8a2b501210f46ea93c2c03d11cfa5f8ae2d883cd4e3db267efb8103f426192a850420'
@@ -0,0 +1,29 @@
1
+ name: CI
2
+ on: [push, pull_request]
3
+ jobs:
4
+ rspec:
5
+ name: RSpec
6
+ runs-on: ubuntu-latest
7
+ strategy:
8
+ matrix:
9
+ ruby: [2.4, 2.5, 2.6, 2.7]
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: ${{ matrix.ruby }}
15
+ - run: bundle install
16
+ - run: bundle exec rspec
17
+ - uses: coverallsapp/github-action@master
18
+ with:
19
+ github-token: ${{ secrets.GITHUB_TOKEN }}
20
+ rubocop:
21
+ name: RuboCop
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - uses: actions/checkout@v2
25
+ - uses: ruby/setup-ruby@v1
26
+ with:
27
+ ruby-version: 2.7
28
+ - run: bundle install
29
+ - run: bundle exec rubocop
@@ -1,28 +1,34 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
- Layout/IndentArray:
3
+ Layout/FirstArrayElementIndentation:
4
4
  EnforcedStyle: consistent
5
5
 
6
+ Layout/LineLength:
7
+ Max: 100
8
+
9
+ Lint/MissingSuper:
10
+ Exclude:
11
+ - spec/support/silence_output.rb
12
+
6
13
  Metrics/BlockLength:
7
14
  Exclude:
8
15
  - 'spec/**/*.rb'
9
16
 
10
- Metrics/LineLength:
11
- Max: 100
12
-
13
17
  Metrics/MethodLength:
14
18
  Max: 15
15
19
 
20
+ Naming/HeredocDelimiterNaming:
21
+ Enabled: false
22
+
23
+ Naming/RescuedExceptionsVariableName:
24
+ PreferredName: error
25
+
16
26
  Style/EmptyMethod:
17
27
  EnforcedStyle: expanded
18
28
 
19
- Style/Encoding:
20
- Enabled: true
21
- EnforcedStyle: never
22
-
23
- Style/MethodMissing:
29
+ Style/FrozenStringLiteralComment:
24
30
  Exclude:
25
- - spec/support/silence_output.rb
31
+ - lib/guard/rubocop/templates/Guardfile
26
32
 
27
33
  Style/RegexpLiteral:
28
34
  Exclude:
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2017-06-11 09:55:46 +0900 using RuboCop version 0.49.1.
3
+ # on 2018-01-20 14:55:30 +0900 using RuboCop version 0.52.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Development
4
4
 
5
+ ## v1.4.0
6
+
7
+ * Support RuboCop 1.0
8
+
5
9
  ## v1.3.0
6
10
 
7
11
  * Add `:launchy` option ([#21](https://github.com/yujinakayama/guard-rubocop/pull/21), [#35](https://github.com/yujinakayama/guard-rubocop/pull/35))
data/Gemfile CHANGED
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  gemspec
4
6
 
5
7
  group :test do
6
- gem 'coveralls', '~> 0.6'
8
+ gem 'simplecov-lcov'
7
9
  end
data/Guardfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # A sample Guardfile
2
4
  # More info at https://github.com/guard/guard#readme
3
5
 
data/README.md CHANGED
@@ -1,14 +1,13 @@
1
- [![Gem Version](http://img.shields.io/gem/v/guard-rubocop.svg)](http://badge.fury.io/rb/guard-rubocop)
2
- [![Dependency Status](http://img.shields.io/gemnasium/yujinakayama/guard-rubocop.svg)](https://gemnasium.com/yujinakayama/guard-rubocop)
3
- [![Build Status](https://travis-ci.org/yujinakayama/guard-rubocop.svg?branch=master)](https://travis-ci.org/yujinakayama/guard-rubocop)
4
- [![Coverage Status](http://img.shields.io/coveralls/yujinakayama/guard-rubocop/master.svg)](https://coveralls.io/r/yujinakayama/guard-rubocop)
5
- [![Code Climate](http://img.shields.io/codeclimate/github/yujinakayama/guard-rubocop.svg)](https://codeclimate.com/github/yujinakayama/guard-rubocop)
1
+ [![Gem Version](https://badge.fury.io/rb/guard-rubocop.svg)](http://badge.fury.io/rb/guard-rubocop)
2
+ [![CI](https://github.com/yujinakayama/guard-rubocop/workflows/CI/badge.svg)](https://github.com/yujinakayama/guard-rubocop/actions)
3
+ [![Coverage Status](https://coveralls.io/repos/yujinakayama/guard-rubocop/badge.svg?branch=master&service=github)](https://coveralls.io/github/yujinakayama/guard-rubocop?branch=master)
4
+ [![Code Climate](https://codeclimate.com/github/yujinakayama/guard-rubocop/badges/gpa.svg)](https://codeclimate.com/github/yujinakayama/guard-rubocop)
6
5
 
7
6
  # guard-rubocop
8
7
 
9
8
  **guard-rubocop** allows you to automatically check Ruby code style with [RuboCop](https://github.com/bbatsov/rubocop) when files are modified.
10
9
 
11
- Tested on MRI 2.2, 2.3, 2.4 and JRuby 9000.
10
+ Tested on MRI 2.4 - 2.7.
12
11
 
13
12
  ## Installation
14
13
 
@@ -94,7 +93,7 @@ you might be uncomfortable with the offense reports from RuboCop in the red-gree
94
93
  * In the red-green phase, you're not necessarily required to write clean code – you just focus writing code to pass the test. It means, in this phase, `guard-rspec` should be run but `guard-rubocop` should not.
95
94
  * In the refactor phase, you're required to make the code clean while keeping the test passing. In this phase, both `guard-rspec` and `guard-rubocop` should be run.
96
95
 
97
- In this case, you may think the following `Guardfile` structure useful:
96
+ In this case, you may consider making use of the [group method](https://github.com/guard/guard/wiki/Guardfile-DSL---Configuring-Guard#group) in your `Guardfile`:
98
97
 
99
98
  ```ruby
100
99
  # This group allows to skip running RuboCop when RSpec failed.
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
  require 'rubocop/rake_task'
@@ -1,4 +1,6 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
 
4
6
  require 'guard/rubocop/version'
@@ -14,19 +16,20 @@ Gem::Specification.new do |spec|
14
16
  spec.homepage = 'https://github.com/yujinakayama/guard-rubocop'
15
17
  spec.license = 'MIT'
16
18
 
19
+ spec.required_ruby_version = '>= 2.4'
20
+
17
21
  spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
18
22
  spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
19
23
  spec.test_files = spec.files.grep(/^spec\//)
20
24
  spec.require_paths = ['lib']
21
25
 
22
26
  spec.add_runtime_dependency 'guard', '~> 2.0'
23
- spec.add_runtime_dependency 'rubocop', '~> 0.20'
27
+ spec.add_runtime_dependency 'rubocop', '< 2.0'
24
28
 
25
- spec.add_development_dependency 'bundler', '~> 1.3'
26
- spec.add_development_dependency 'rake', '~> 12.0'
27
- spec.add_development_dependency 'rspec', '~> 3.0'
28
- spec.add_development_dependency 'simplecov', '~> 0.7'
29
+ spec.add_development_dependency 'bundler'
29
30
  spec.add_development_dependency 'guard-rspec', '>= 4.2.3', '< 5.0'
30
- spec.add_development_dependency 'ruby_gntp', '~> 0.3'
31
31
  spec.add_development_dependency 'launchy', '~> 2.4'
32
+ spec.add_development_dependency 'rake', '>= 12.0'
33
+ spec.add_development_dependency 'rspec', '~> 3.0'
34
+ spec.add_development_dependency 'simplecov', '~> 0.7'
32
35
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'guard'
2
4
  require 'guard/plugin'
3
5
 
@@ -14,7 +16,7 @@ module Guard
14
16
 
15
17
  @options = {
16
18
  all_on_start: true,
17
- keep_failed: true,
19
+ keep_failed: true,
18
20
  notification: :failed,
19
21
  cli: nil,
20
22
  hide_stdout: false
@@ -63,7 +65,7 @@ module Guard
63
65
  passed = runner.run(paths)
64
66
  @failed_paths = runner.failed_paths
65
67
  throw :task_has_failed unless passed
66
- rescue => error
68
+ rescue StandardError => error
67
69
  UI.error 'The following exception occurred while running guard-rubocop: ' \
68
70
  "#{error.backtrace.first} #{error.message} (#{error.class.name})"
69
71
  end
@@ -74,6 +76,7 @@ module Guard
74
76
  paths.uniq!
75
77
  paths.reject! do |path|
76
78
  next true unless File.exist?(path)
79
+
77
80
  included_in_other_path?(path, paths)
78
81
  end
79
82
  paths
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  module Guard
@@ -113,13 +115,12 @@ module Guard
113
115
  end
114
116
 
115
117
  def pluralize(number, thing, options = {})
116
- text = ''
117
-
118
- if number.zero? && options[:no_for_zero]
119
- text = 'no'
120
- else
121
- text << number.to_s
122
- end
118
+ text =
119
+ if number.zero? && options[:no_for_zero]
120
+ +'no'
121
+ else
122
+ number.to_s
123
+ end
123
124
 
124
125
  text << " #{thing}"
125
126
  text << 's' unless number == 1
@@ -130,6 +131,7 @@ module Guard
130
131
  def open_launchy_if_needed
131
132
  return unless (output_path = @options[:launchy])
132
133
  return unless File.exist?(output_path)
134
+
133
135
  require 'launchy'
134
136
  ::Launchy.open(output_path)
135
137
  end
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # A workaround for declaring `class RuboCop`
2
4
  # before `class RuboCop < Guard` in rubocop.rb
3
5
  module GuardRuboCopVersion
4
6
  # http://semver.org/
5
7
  MAJOR = 1
6
- MINOR = 3
8
+ MINOR = 4
7
9
  PATCH = 0
8
10
 
9
11
  def self.to_s
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'launchy'
2
4
 
3
5
  RSpec.describe Guard::RuboCop::Runner do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Guard::RuboCop, :silence_output do
2
4
  subject(:guard) { Guard::RuboCop.new(options) }
3
5
  let(:options) { {} }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.configure do |config|
2
4
  config.expect_with :rspec do |expectations|
3
5
  expectations.include_chain_clauses_in_custom_matcher_descriptions = true
@@ -20,7 +22,7 @@ RSpec.configure do |config|
20
22
  Kernel.srand config.seed
21
23
  end
22
24
 
23
- Dir[File.join(File.dirname(__FILE__), 'support', '*')].each do |path|
25
+ Dir[File.join(File.dirname(__FILE__), 'support', '*')].sort.each do |path|
24
26
  require path
25
27
  end
26
28
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.shared_context 'silence output', :silence_output do
2
4
  null_object = BasicObject.new
3
5
 
@@ -7,6 +9,10 @@ RSpec.shared_context 'silence output', :silence_output do
7
9
  true
8
10
  end
9
11
 
12
+ def respond_to_missing?(*)
13
+ true
14
+ end
15
+
10
16
  def method_missing(*)
11
17
  end
12
18
  end
@@ -1,8 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'simplecov'
2
4
 
3
5
  if ENV['CI']
4
- require 'coveralls'
5
- SimpleCov.formatter = Coveralls::SimpleCov::Formatter
6
+ require 'simplecov-lcov'
7
+
8
+ SimpleCov::Formatter::LcovFormatter.config do |config|
9
+ config.report_with_single_file = true
10
+ config.single_report_path = 'coverage/lcov.info'
11
+ end
12
+
13
+ SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
6
14
  end
7
15
 
8
16
  SimpleCov.start do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Nakayama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-11 00:00:00.000000000 Z
11
+ date: 2020-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -28,120 +28,106 @@ dependencies:
28
28
  name: rubocop
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - "<"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.20'
33
+ version: '2.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - "<"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.20'
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.3'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.3'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
56
+ name: guard-rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '12.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
59
+ - - ">="
67
60
  - !ruby/object:Gem::Version
68
- version: '12.0'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
61
+ version: 4.2.3
62
+ - - "<"
74
63
  - !ruby/object:Gem::Version
75
- version: '3.0'
64
+ version: '5.0'
76
65
  type: :development
77
66
  prerelease: false
78
67
  version_requirements: !ruby/object:Gem::Requirement
79
68
  requirements:
80
- - - "~>"
69
+ - - ">="
81
70
  - !ruby/object:Gem::Version
82
- version: '3.0'
71
+ version: 4.2.3
72
+ - - "<"
73
+ - !ruby/object:Gem::Version
74
+ version: '5.0'
83
75
  - !ruby/object:Gem::Dependency
84
- name: simplecov
76
+ name: launchy
85
77
  requirement: !ruby/object:Gem::Requirement
86
78
  requirements:
87
79
  - - "~>"
88
80
  - !ruby/object:Gem::Version
89
- version: '0.7'
81
+ version: '2.4'
90
82
  type: :development
91
83
  prerelease: false
92
84
  version_requirements: !ruby/object:Gem::Requirement
93
85
  requirements:
94
86
  - - "~>"
95
87
  - !ruby/object:Gem::Version
96
- version: '0.7'
88
+ version: '2.4'
97
89
  - !ruby/object:Gem::Dependency
98
- name: guard-rspec
90
+ name: rake
99
91
  requirement: !ruby/object:Gem::Requirement
100
92
  requirements:
101
93
  - - ">="
102
94
  - !ruby/object:Gem::Version
103
- version: 4.2.3
104
- - - "<"
105
- - !ruby/object:Gem::Version
106
- version: '5.0'
95
+ version: '12.0'
107
96
  type: :development
108
97
  prerelease: false
109
98
  version_requirements: !ruby/object:Gem::Requirement
110
99
  requirements:
111
100
  - - ">="
112
101
  - !ruby/object:Gem::Version
113
- version: 4.2.3
114
- - - "<"
115
- - !ruby/object:Gem::Version
116
- version: '5.0'
102
+ version: '12.0'
117
103
  - !ruby/object:Gem::Dependency
118
- name: ruby_gntp
104
+ name: rspec
119
105
  requirement: !ruby/object:Gem::Requirement
120
106
  requirements:
121
107
  - - "~>"
122
108
  - !ruby/object:Gem::Version
123
- version: '0.3'
109
+ version: '3.0'
124
110
  type: :development
125
111
  prerelease: false
126
112
  version_requirements: !ruby/object:Gem::Requirement
127
113
  requirements:
128
114
  - - "~>"
129
115
  - !ruby/object:Gem::Version
130
- version: '0.3'
116
+ version: '3.0'
131
117
  - !ruby/object:Gem::Dependency
132
- name: launchy
118
+ name: simplecov
133
119
  requirement: !ruby/object:Gem::Requirement
134
120
  requirements:
135
121
  - - "~>"
136
122
  - !ruby/object:Gem::Version
137
- version: '2.4'
123
+ version: '0.7'
138
124
  type: :development
139
125
  prerelease: false
140
126
  version_requirements: !ruby/object:Gem::Requirement
141
127
  requirements:
142
128
  - - "~>"
143
129
  - !ruby/object:Gem::Version
144
- version: '2.4'
130
+ version: '0.7'
145
131
  description: Guard::RuboCop automatically checks Ruby code style with RuboCop when
146
132
  files are modified.
147
133
  email:
@@ -150,11 +136,11 @@ executables: []
150
136
  extensions: []
151
137
  extra_rdoc_files: []
152
138
  files:
139
+ - ".github/workflows/ci.yml"
153
140
  - ".gitignore"
154
141
  - ".rspec"
155
142
  - ".rubocop.yml"
156
143
  - ".rubocop_todo.yml"
157
- - ".travis.yml"
158
144
  - ".yardopts"
159
145
  - CHANGELOG.md
160
146
  - Gemfile
@@ -184,15 +170,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
170
  requirements:
185
171
  - - ">="
186
172
  - !ruby/object:Gem::Version
187
- version: '0'
173
+ version: '2.4'
188
174
  required_rubygems_version: !ruby/object:Gem::Requirement
189
175
  requirements:
190
176
  - - ">="
191
177
  - !ruby/object:Gem::Version
192
178
  version: '0'
193
179
  requirements: []
194
- rubyforge_project:
195
- rubygems_version: 2.6.11
180
+ rubygems_version: 3.1.2
196
181
  signing_key:
197
182
  specification_version: 4
198
183
  summary: Guard plugin for RuboCop
@@ -1,10 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.7
4
- - 2.3.4
5
- - 2.4.1
6
- - jruby-9.1.10.0
7
- script:
8
- - bundle exec rake ci
9
- sudo: false
10
- cache: bundler