guard-rubocop 1.2.0 → 1.3.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
2
  SHA1:
3
- metadata.gz: 1535c13164518a07f9bd376581c0900c514ce4af
4
- data.tar.gz: 279736e6d095f6a5c941ed5d8b2f52850c92c535
3
+ metadata.gz: d24bb6e38394405217e2cdaeadbba31085dc6af6
4
+ data.tar.gz: 607b2fe39bbbe21909ec6e753dc271898fea9c58
5
5
  SHA512:
6
- metadata.gz: 9db576e8a05603ebb436e244bc55a8f62bc436b7c3670211d82e5d4e990660eb8274fad252bcc4fe0b8461cb6130c5afa39d9eec4a5a43b3c81426328ff3011b
7
- data.tar.gz: ae8db14b3b120dfbea98d0086c39348d4bd28f8a76188f463ceedf7fe6d67b3b975847a510430306c333a70d11381c702f3c3c4f16952737e268cc6c1cf786d4
6
+ metadata.gz: e09575c222b8c25ce5948bfa68e1c1da472b6f5b08ee38e756d507766386e2609396eaa3bb2d6942bead8deef1b92f899d9d21eacd5f858d82af9e4b28919b81
7
+ data.tar.gz: bf60d391eab5ec1fc7c718b15b16c1d8fd06cd09ab327a587706efcdf7fe95d15c349ce32567e3875e9f73a33e8ac7692b75d126d633e913fb1160e74d61ace9
data/.gitignore CHANGED
@@ -11,6 +11,7 @@ doc/
11
11
  lib/bundler/man
12
12
  pkg
13
13
  rdoc
14
+ spec/examples.txt
14
15
  spec/reports
15
16
  test/tmp
16
17
  test/version_tmp
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -1,11 +1,30 @@
1
- # The default 79 character limit is sometimes unproductive.
2
- LineLength:
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ Layout/IndentArray:
4
+ EnforcedStyle: consistent
5
+
6
+ Metrics/BlockLength:
7
+ Exclude:
8
+ - 'spec/**/*.rb'
9
+
10
+ Metrics/LineLength:
3
11
  Max: 100
4
12
 
5
- # The default 10 lines limit is unrealistic.
6
- MethodLength:
13
+ Metrics/MethodLength:
7
14
  Max: 15
8
15
 
9
- RegexpLiteral:
16
+ Style/EmptyMethod:
17
+ EnforcedStyle: expanded
18
+
19
+ Style/Encoding:
20
+ Enabled: true
21
+ EnforcedStyle: never
22
+
23
+ Style/MethodMissing:
24
+ Exclude:
25
+ - spec/support/silence_output.rb
26
+
27
+ Style/RegexpLiteral:
10
28
  Exclude:
29
+ - '**/*.gemspec'
11
30
  - '**/Guardfile'
@@ -0,0 +1,12 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2017-06-11 09:55:46 +0900 using RuboCop version 0.49.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: CountComments.
11
+ Metrics/ClassLength:
12
+ Max: 103
@@ -1,9 +1,10 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- - 2.1.0
6
- - jruby-19mode
3
+ - 2.2.7
4
+ - 2.3.4
5
+ - 2.4.1
6
+ - jruby-9.1.10.0
7
7
  script:
8
- - bundle exec rspec
9
- - bundle exec rubocop
8
+ - bundle exec rake ci
9
+ sudo: false
10
+ cache: bundler
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Development
4
4
 
5
+ ## v1.3.0
6
+
7
+ * Add `:launchy` option ([#21](https://github.com/yujinakayama/guard-rubocop/pull/21), [#35](https://github.com/yujinakayama/guard-rubocop/pull/35))
8
+ * Modify the `Guardfile` template so that RuboCop can be run when `.rubocop_todo.yml` is modified ([#36](https://github.com/yujinakayama/guard-rubocop/pull/36))
9
+
5
10
  ## v1.2.0
6
11
 
7
12
  * Add `:hide_stdout` option ([#15](https://github.com/yujinakayama/guard-rubocop/pull/15))
data/Gemfile CHANGED
@@ -3,14 +3,5 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  group :test do
6
- gem 'coveralls', '~> 0.6'
7
- gem 'simplecov-rcov', '~> 0.2'
8
- gem 'ci_reporter', '~> 1.8'
9
- end
10
-
11
- platforms :rbx do
12
- gem 'rubysl'
13
- gem 'rubinius-developer_tools'
14
- gem 'json'
15
- gem 'racc' # Needed for RuboCop
6
+ gem 'coveralls', '~> 0.6'
16
7
  end
data/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  **guard-rubocop** allows you to automatically check Ruby code style with [RuboCop](https://github.com/bbatsov/rubocop) when files are modified.
10
10
 
11
- Tested on MRI 1.9, 2.0, 2.1, JRuby in 1.9 mode and Rubinius.
11
+ Tested on MRI 2.2, 2.3, 2.4 and JRuby 9000.
12
12
 
13
13
  ## Installation
14
14
 
@@ -34,7 +34,7 @@ or install it yourself as:
34
34
  $ gem install guard-rubocop
35
35
  ```
36
36
 
37
- Add the default Guard::Rubocop definition to your `Guardfile` by running:
37
+ Add the default Guard::RuboCop definition to your `Guardfile` by running:
38
38
 
39
39
  ```sh
40
40
  $ guard init rubocop
@@ -62,7 +62,7 @@ all_on_start: true # Check all files at Guard startup.
62
62
  cli: '--rails' # Pass arbitrary RuboCop CLI arguments.
63
63
  # An array or string is acceptable.
64
64
  # default: nil
65
- hide_stdout: false # Do not display console output (in case outputting to file).
65
+ hide_stdout: false # Do not display console output (in case outputting to file).
66
66
  # default: false
67
67
  keep_failed: true # Keep failed files until they pass.
68
68
  # default: true
@@ -71,6 +71,19 @@ notification: :failed # Display Growl notification after each run.
71
71
  # false - Never notify
72
72
  # :failed - Notify only when failed
73
73
  # default: :failed
74
+ launchy: nil # Filename to launch using Launchy after RuboCop runs.
75
+ # default: nil
76
+ ```
77
+
78
+ ### Using Launchy to view results
79
+
80
+ guard-rubocop can be configured to launch a results file in lieu of or in addition to outputing results to the terminal.
81
+ Configure your Guardfile with the launchy option:
82
+
83
+ ``` ruby
84
+ guard :rubocop, cli: %w(--format fuubar --format html -o ./tmp/rubocop_results.html), launchy: './tmp/rubocop_results.html' do
85
+ # ...
86
+ end
74
87
  ```
75
88
 
76
89
  ## Advanced Tips
data/Rakefile CHANGED
@@ -1,5 +1,3 @@
1
- # coding: utf-8
2
-
3
1
  require 'bundler/gem_tasks'
4
2
  require 'rspec/core/rake_task'
5
3
  require 'rubocop/rake_task'
@@ -7,19 +5,4 @@ require 'rubocop/rake_task'
7
5
  RSpec::Core::RakeTask.new(:spec)
8
6
  RuboCop::RakeTask.new(:style)
9
7
 
10
- namespace :ci do
11
- task :spec do
12
- ENV['CI'] = 'true'
13
-
14
- ENV['CI_REPORTS'] = 'spec/reports'
15
- require 'ci/reporter/rake/rspec'
16
- Rake::Task['ci:setup:rspec'].invoke
17
-
18
- Rake::Task['spec'].invoke
19
- end
20
- end
21
-
22
- desc 'Run RSpec and RuboCop'
23
- task all: [:spec, :style]
24
-
25
- task default: :all
8
+ task ci: %i[spec style]
@@ -1,5 +1,3 @@
1
- # coding: utf-8
2
-
3
1
  lib = File.expand_path('../lib', __FILE__)
4
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
3
 
@@ -7,11 +5,11 @@ require 'guard/rubocop/version'
7
5
 
8
6
  Gem::Specification.new do |spec|
9
7
  spec.name = 'guard-rubocop'
10
- spec.version = Guard::RuboCopVersion.to_s
8
+ spec.version = GuardRuboCopVersion.to_s
11
9
  spec.authors = ['Yuji Nakayama']
12
10
  spec.email = ['nkymyj@gmail.com']
13
11
  spec.summary = 'Guard plugin for RuboCop'
14
- spec.description = 'Guard::Rubocop automatically checks Ruby code style with RuboCop ' \
12
+ spec.description = 'Guard::RuboCop automatically checks Ruby code style with RuboCop ' \
15
13
  'when files are modified.'
16
14
  spec.homepage = 'https://github.com/yujinakayama/guard-rubocop'
17
15
  spec.license = 'MIT'
@@ -25,9 +23,10 @@ Gem::Specification.new do |spec|
25
23
  spec.add_runtime_dependency 'rubocop', '~> 0.20'
26
24
 
27
25
  spec.add_development_dependency 'bundler', '~> 1.3'
28
- spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'rake', '~> 12.0'
29
27
  spec.add_development_dependency 'rspec', '~> 3.0'
30
28
  spec.add_development_dependency 'simplecov', '~> 0.7'
31
29
  spec.add_development_dependency 'guard-rspec', '>= 4.2.3', '< 5.0'
32
30
  spec.add_development_dependency 'ruby_gntp', '~> 0.3'
31
+ spec.add_development_dependency 'launchy', '~> 2.4'
33
32
  end
@@ -1,5 +1,3 @@
1
- # coding: utf-8
2
-
3
1
  require 'guard'
4
2
  require 'guard/plugin'
5
3
 
@@ -1,5 +1,3 @@
1
- # coding: utf-8
2
-
3
1
  require 'json'
4
2
 
5
3
  module Guard
@@ -22,6 +20,8 @@ module Guard
22
20
  notify(passed)
23
21
  end
24
22
 
23
+ open_launchy_if_needed
24
+
25
25
  passed
26
26
  end
27
27
 
@@ -29,7 +29,7 @@ module Guard
29
29
  command = ['rubocop']
30
30
 
31
31
  if should_add_default_formatter_for_console?
32
- command.concat(%w(--format progress)) # Keep default formatter for console.
32
+ command.concat(%w[--format progress]) # Keep default formatter for console.
33
33
  end
34
34
 
35
35
  command.concat(['--format', 'json', '--out', json_file_path])
@@ -49,7 +49,7 @@ module Guard
49
49
  when Array then args
50
50
  when String then args.shellsplit
51
51
  when NilClass then []
52
- else fail ':cli option must be either an array or string'
52
+ else raise ArgumentError, ':cli option must be either an array or string'
53
53
  end
54
54
  end
55
55
  end
@@ -115,7 +115,7 @@ module Guard
115
115
  def pluralize(number, thing, options = {})
116
116
  text = ''
117
117
 
118
- if number == 0 && options[:no_for_zero]
118
+ if number.zero? && options[:no_for_zero]
119
119
  text = 'no'
120
120
  else
121
121
  text << number.to_s
@@ -126,6 +126,13 @@ module Guard
126
126
 
127
127
  text
128
128
  end
129
+
130
+ def open_launchy_if_needed
131
+ return unless (output_path = @options[:launchy])
132
+ return unless File.exist?(output_path)
133
+ require 'launchy'
134
+ ::Launchy.open(output_path)
135
+ end
129
136
  end
130
137
  end
131
138
  end
@@ -1,4 +1,4 @@
1
1
  guard :rubocop do
2
2
  watch(%r{.+\.rb$})
3
- watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
3
+ watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
4
4
  end
@@ -1,16 +1,12 @@
1
- # coding: utf-8
1
+ # A workaround for declaring `class RuboCop`
2
+ # before `class RuboCop < Guard` in rubocop.rb
3
+ module GuardRuboCopVersion
4
+ # http://semver.org/
5
+ MAJOR = 1
6
+ MINOR = 3
7
+ PATCH = 0
2
8
 
3
- module Guard
4
- # A workaround for declaring `class RuboCop`
5
- # before `class RuboCop < Guard` in rubocop.rb
6
- module RuboCopVersion
7
- # http://semver.org/
8
- MAJOR = 1
9
- MINOR = 2
10
- PATCH = 0
11
-
12
- def self.to_s
13
- [MAJOR, MINOR, PATCH].join('.')
14
- end
9
+ def self.to_s
10
+ [MAJOR, MINOR, PATCH].join('.')
15
11
  end
16
12
  end
@@ -1,8 +1,6 @@
1
- # coding: utf-8
1
+ require 'launchy'
2
2
 
3
- require 'spec_helper.rb'
4
-
5
- describe Guard::RuboCop::Runner do
3
+ RSpec.describe Guard::RuboCop::Runner do
6
4
  subject(:runner) { Guard::RuboCop::Runner.new(options) }
7
5
  let(:options) { {} }
8
6
 
@@ -77,39 +75,52 @@ describe Guard::RuboCop::Runner do
77
75
 
78
76
  context 'when :notification option is true' do
79
77
  let(:options) { { notification: true } }
80
- include_examples 'notification', { passed: true, failed: true }
78
+ include_examples 'notification', passed: true, failed: true
81
79
  end
82
80
 
83
81
  context 'when :notification option is :failed' do
84
82
  let(:options) { { notification: :failed } }
85
- include_examples 'notification', { passed: false, failed: true }
83
+ include_examples 'notification', passed: false, failed: true
86
84
  end
87
85
 
88
86
  context 'when :notification option is false' do
89
87
  let(:options) { { notification: false } }
90
- include_examples 'notification', { passed: false, failed: false }
88
+ include_examples 'notification', passed: false, failed: false
89
+ end
90
+
91
+ context 'when :launchy option is present' do
92
+ let(:options) { { launchy: 'launchy_path' } }
93
+
94
+ before do
95
+ allow(File).to receive(:exist?).with('launchy_path').and_return(true)
96
+ end
97
+
98
+ it 'opens Launchy' do
99
+ expect(Launchy).to receive(:open).with('launchy_path')
100
+ runner.run(paths)
101
+ end
91
102
  end
92
103
  end
93
104
 
94
105
  describe '#build_command' do
95
106
  subject(:build_command) { runner.build_command(paths) }
96
- let(:options) { { cli: %w(--debug --rails) } }
97
- let(:paths) { %w(file1.rb file2.rb) }
107
+ let(:options) { { cli: %w[--debug --rails] } }
108
+ let(:paths) { %w[file1.rb file2.rb] }
98
109
 
99
110
  context 'when :hide_stdout is not set' do
100
111
  context 'and :cli option includes formatter for console' do
101
- before { options[:cli] = %w(--format simple) }
112
+ before { options[:cli] = %w[--format simple] }
102
113
 
103
114
  it 'does not add args for the default formatter for console' do
104
- expect(build_command[0..2]).not_to eq(%w(rubocop --format progress))
115
+ expect(build_command[0..2]).not_to eq(%w[rubocop --format progress])
105
116
  end
106
117
  end
107
118
 
108
119
  context 'and :cli option does not include formatter for console' do
109
- before { options[:cli] = %w(--format simple --out simple.txt) }
120
+ before { options[:cli] = %w[--format simple --out simple.txt] }
110
121
 
111
122
  it 'adds args for the default formatter for console' do
112
- expect(build_command[0..2]).to eq(%w(rubocop --format progress))
123
+ expect(build_command[0..2]).to eq(%w[rubocop --format progress])
113
124
  end
114
125
  end
115
126
  end
@@ -118,24 +129,24 @@ describe Guard::RuboCop::Runner do
118
129
  before { options[:hide_stdout] = true }
119
130
 
120
131
  context 'and :cli option includes formatter for console' do
121
- before { options[:cli] = %w(--format simple) }
132
+ before { options[:cli] = %w[--format simple] }
122
133
 
123
134
  it 'does not add args for the default formatter for console' do
124
- expect(build_command[0..2]).not_to eq(%w(rubocop --format progress))
135
+ expect(build_command[0..2]).not_to eq(%w[rubocop --format progress])
125
136
  end
126
137
  end
127
138
 
128
139
  context 'and :cli option does not include formatter for console' do
129
- before { options[:cli] = %w(--format simple --out simple.txt) }
140
+ before { options[:cli] = %w[--format simple --out simple.txt] }
130
141
 
131
142
  it 'does not add args for the default formatter for console' do
132
- expect(build_command[0..2]).not_to eq(%w(rubocop --format progress))
143
+ expect(build_command[0..2]).not_to eq(%w[rubocop --format progress])
133
144
  end
134
145
  end
135
146
  end
136
147
 
137
148
  it 'adds args for JSON formatter' do
138
- expect(build_command[3..4]).to eq(%w(--format json))
149
+ expect(build_command[3..4]).to eq(%w[--format json])
139
150
  end
140
151
 
141
152
  it 'adds args for output file path of JSON formatter' do
@@ -148,11 +159,11 @@ describe Guard::RuboCop::Runner do
148
159
  end
149
160
 
150
161
  it 'adds args specified by user' do
151
- expect(build_command[8..9]).to eq(%w(--debug --rails))
162
+ expect(build_command[8..9]).to eq(%w[--debug --rails])
152
163
  end
153
164
 
154
165
  it 'adds the passed paths' do
155
- expect(build_command[10..-1]).to eq(%w(file1.rb file2.rb))
166
+ expect(build_command[10..-1]).to eq(%w[file1.rb file2.rb])
156
167
  end
157
168
  end
158
169
 
@@ -185,7 +196,7 @@ describe Guard::RuboCop::Runner do
185
196
  let(:options) { { cli: { key: 'value' } } }
186
197
 
187
198
  it 'raises error' do
188
- expect { runner.args_specified_by_user }.to raise_error
199
+ expect { runner.args_specified_by_user }.to raise_error(ArgumentError)
189
200
  end
190
201
  end
191
202
  end
@@ -195,7 +206,7 @@ describe Guard::RuboCop::Runner do
195
206
 
196
207
  context 'when the passed args include a -f/--format' do
197
208
  context 'but does not include an -o/--output' do
198
- let(:args) { %w(--format simple --debug) }
209
+ let(:args) { %w[--format simple --debug] }
199
210
 
200
211
  it 'returns true' do
201
212
  expect(include_formatter_for_console?).to be_truthy
@@ -203,7 +214,7 @@ describe Guard::RuboCop::Runner do
203
214
  end
204
215
 
205
216
  context 'and include an -o/--output just after the -f/--format' do
206
- let(:args) { %w(--format simple --out simple.txt) }
217
+ let(:args) { %w[--format simple --out simple.txt] }
207
218
 
208
219
  it 'returns false' do
209
220
  expect(include_formatter_for_console?).to be_falsey
@@ -211,7 +222,7 @@ describe Guard::RuboCop::Runner do
211
222
  end
212
223
 
213
224
  context 'and include an -o/--output after the -f/--format across another arg' do
214
- let(:args) { %w(--format simple --debug --out simple.txt) }
225
+ let(:args) { %w[--format simple --debug --out simple.txt] }
215
226
 
216
227
  it 'returns false' do
217
228
  expect(include_formatter_for_console?).to be_falsey
@@ -221,7 +232,7 @@ describe Guard::RuboCop::Runner do
221
232
 
222
233
  context 'when the passed args include a -f with its arg without separator' do
223
234
  context 'but does not include an -o/--output' do
224
- let(:args) { %w(-fs --debug) }
235
+ let(:args) { %w[-fs --debug] }
225
236
 
226
237
  it 'returns true' do
227
238
  expect(include_formatter_for_console?).to be_truthy
@@ -229,7 +240,7 @@ describe Guard::RuboCop::Runner do
229
240
  end
230
241
 
231
242
  context 'and include an -o with its arg without separator just after the -f/--format' do
232
- let(:args) { %w(-fs -osimple.txt) }
243
+ let(:args) { %w[-fs -osimple.txt] }
233
244
 
234
245
  it 'returns false' do
235
246
  expect(include_formatter_for_console?).to be_falsey
@@ -239,7 +250,7 @@ describe Guard::RuboCop::Runner do
239
250
 
240
251
  context 'when the passed args include multiple -f/--format' do
241
252
  context 'and all -f/--format have associated -o/--out' do
242
- let(:args) { %w(--format simple --out simple.txt --format emacs --out emacs.txt) }
253
+ let(:args) { %w[--format simple --out simple.txt --format emacs --out emacs.txt] }
243
254
 
244
255
  it 'returns false' do
245
256
  expect(include_formatter_for_console?).to be_falsey
@@ -247,7 +258,7 @@ describe Guard::RuboCop::Runner do
247
258
  end
248
259
 
249
260
  context 'and any -f/--format has associated -o/--out' do
250
- let(:args) { %w(--format simple --format emacs --out emacs.txt) }
261
+ let(:args) { %w[--format simple --format emacs --out emacs.txt] }
251
262
 
252
263
  it 'returns true' do
253
264
  expect(include_formatter_for_console?).to be_truthy
@@ -255,7 +266,7 @@ describe Guard::RuboCop::Runner do
255
266
  end
256
267
 
257
268
  context 'and no -f/--format has associated -o/--out' do
258
- let(:args) { %w(--format simple --format emacs) }
269
+ let(:args) { %w[--format simple --format emacs] }
259
270
 
260
271
  it 'returns true' do
261
272
  expect(include_formatter_for_console?).to be_truthy
@@ -264,7 +275,7 @@ describe Guard::RuboCop::Runner do
264
275
  end
265
276
 
266
277
  context 'when the passed args do not include -f/--format' do
267
- let(:args) { %w(--debug) }
278
+ let(:args) { %w[--debug] }
268
279
 
269
280
  it 'returns false' do
270
281
  expect(include_formatter_for_console?).to be_falsey
@@ -334,12 +345,10 @@ describe Guard::RuboCop::Runner do
334
345
  describe '#notify' do
335
346
  before do
336
347
  allow(runner).to receive(:result).and_return(
337
- {
338
- summary: {
339
- offense_count: 4,
340
- target_file_count: 3,
341
- inspected_file_count: 2
342
- }
348
+ summary: {
349
+ offense_count: 4,
350
+ target_file_count: 3,
351
+ inspected_file_count: 2
343
352
  }
344
353
  )
345
354
  end
@@ -380,12 +389,10 @@ describe Guard::RuboCop::Runner do
380
389
  describe '#summary_text' do
381
390
  before do
382
391
  allow(runner).to receive(:result).and_return(
383
- {
384
- summary: {
385
- offense_count: offense_count,
386
- target_file_count: target_file_count,
387
- inspected_file_count: inspected_file_count
388
- }
392
+ summary: {
393
+ offense_count: offense_count,
394
+ target_file_count: target_file_count,
395
+ inspected_file_count: inspected_file_count
389
396
  }
390
397
  )
391
398
  end
@@ -441,12 +448,10 @@ describe Guard::RuboCop::Runner do
441
448
  context 'with spelling "offence" in old RuboCop' do
442
449
  before do
443
450
  allow(runner).to receive(:result).and_return(
444
- {
445
- summary: {
446
- offence_count: 2,
447
- target_file_count: 1,
448
- inspected_file_count: 1
449
- }
451
+ summary: {
452
+ offence_count: 2,
453
+ target_file_count: 1,
454
+ inspected_file_count: 1
450
455
  }
451
456
  )
452
457
  end
@@ -1,8 +1,4 @@
1
- # coding: utf-8
2
-
3
- require 'spec_helper.rb'
4
-
5
- describe Guard::RuboCop, :silence_output do
1
+ RSpec.describe Guard::RuboCop, :silence_output do
6
2
  subject(:guard) { Guard::RuboCop.new(options) }
7
3
  let(:options) { {} }
8
4
 
@@ -111,7 +107,7 @@ describe Guard::RuboCop, :silence_output do
111
107
  end
112
108
  end
113
109
 
114
- [:run_on_additions, :run_on_modifications].each do |method|
110
+ %i[run_on_additions run_on_modifications].each do |method|
115
111
  describe "##{method}", :processes_after_running do
116
112
  subject { super().send(method, changed_paths) }
117
113
  let(:changed_paths) do
@@ -1,33 +1,31 @@
1
- # coding: utf-8
2
-
3
1
  RSpec.configure do |config|
4
- config.expect_with :rspec do |c|
5
- c.syntax = :expect
2
+ config.expect_with :rspec do |expectations|
3
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
6
4
  end
7
5
 
8
- config.mock_with :rspec do |c|
9
- c.syntax = :expect
6
+ config.mock_with :rspec do |mocks|
7
+ mocks.verify_partial_doubles = true
10
8
  end
11
- end
12
9
 
13
- Dir[File.join(File.dirname(__FILE__), 'support', '*')].each do |path|
14
- require path
15
- end
10
+ config.filter_run_when_matching :focus
11
+
12
+ config.example_status_persistence_file_path = 'spec/examples.txt'
16
13
 
17
- require 'simplecov'
18
- SimpleCov.coverage_dir(File.join('spec', 'coverage'))
14
+ config.disable_monkey_patching!
19
15
 
20
- if ENV['TRAVIS']
21
- require 'coveralls'
22
- SimpleCov.formatter = Coveralls::SimpleCov::Formatter
23
- elsif ENV['CI']
24
- require 'simplecov-rcov'
25
- SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
16
+ config.default_formatter = 'doc' if config.files_to_run.one?
17
+
18
+ config.order = :random
19
+
20
+ Kernel.srand config.seed
26
21
  end
27
22
 
28
- SimpleCov.start do
29
- add_filter '/spec/'
30
- add_filter '/vendor/bundle/'
23
+ Dir[File.join(File.dirname(__FILE__), 'support', '*')].each do |path|
24
+ require path
31
25
  end
32
26
 
27
+ # Initialize Guard for running tests.
28
+ require 'guard'
29
+ Guard.setup(notify: false)
30
+
33
31
  require 'guard/rubocop'
@@ -1,6 +1,4 @@
1
- # coding: utf-8
2
-
3
- shared_context 'silence output', silence_output: true do
1
+ RSpec.shared_context 'silence output', :silence_output do
4
2
  null_object = BasicObject.new
5
3
 
6
4
  class << null_object
@@ -0,0 +1,11 @@
1
+ require 'simplecov'
2
+
3
+ if ENV['CI']
4
+ require 'coveralls'
5
+ SimpleCov.formatter = Coveralls::SimpleCov::Formatter
6
+ end
7
+
8
+ SimpleCov.start do
9
+ add_filter '/spec/'
10
+ add_filter '/vendor/bundle/'
11
+ end
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.2.0
4
+ version: 1.3.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: 2014-11-05 00:00:00.000000000 Z
11
+ date: 2017-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '12.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '12.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -128,7 +128,21 @@ dependencies:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0.3'
131
- description: Guard::Rubocop automatically checks Ruby code style with RuboCop when
131
+ - !ruby/object:Gem::Dependency
132
+ name: launchy
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '2.4'
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '2.4'
145
+ description: Guard::RuboCop automatically checks Ruby code style with RuboCop when
132
146
  files are modified.
133
147
  email:
134
148
  - nkymyj@gmail.com
@@ -137,7 +151,9 @@ extensions: []
137
151
  extra_rdoc_files: []
138
152
  files:
139
153
  - ".gitignore"
154
+ - ".rspec"
140
155
  - ".rubocop.yml"
156
+ - ".rubocop_todo.yml"
141
157
  - ".travis.yml"
142
158
  - ".yardopts"
143
159
  - CHANGELOG.md
@@ -151,11 +167,11 @@ files:
151
167
  - lib/guard/rubocop/runner.rb
152
168
  - lib/guard/rubocop/templates/Guardfile
153
169
  - lib/guard/rubocop/version.rb
154
- - spec/.rubocop.yml
155
170
  - spec/guard/rubocop/runner_spec.rb
156
171
  - spec/guard/rubocop_spec.rb
157
172
  - spec/spec_helper.rb
158
173
  - spec/support/silence_output.rb
174
+ - spec/support/simplecov.rb
159
175
  homepage: https://github.com/yujinakayama/guard-rubocop
160
176
  licenses:
161
177
  - MIT
@@ -176,14 +192,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
192
  version: '0'
177
193
  requirements: []
178
194
  rubyforge_project:
179
- rubygems_version: 2.4.2
195
+ rubygems_version: 2.6.11
180
196
  signing_key:
181
197
  specification_version: 4
182
198
  summary: Guard plugin for RuboCop
183
199
  test_files:
184
- - spec/.rubocop.yml
185
200
  - spec/guard/rubocop/runner_spec.rb
186
201
  - spec/guard/rubocop_spec.rb
187
202
  - spec/spec_helper.rb
188
203
  - spec/support/silence_output.rb
189
- has_rdoc:
204
+ - spec/support/simplecov.rb
@@ -1,5 +0,0 @@
1
- inherit_from: ../.rubocop.yml
2
-
3
- # Sometimes I want to indicate that “This is a hash” explicitly with #and_return.
4
- BracesAroundHashParameters:
5
- Enabled: false