rdoc_rubocop 0.1.0 → 0.1.1

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
2
  SHA256:
3
- metadata.gz: 8bde0ed87ddc4498c6a230db6759d21174d1915e2af9c454238979b9e7f2b29d
4
- data.tar.gz: e79f99e1b731881249835d5264cfa7998ac33bdc6958238b2e5990ca217c6120
3
+ metadata.gz: 6b63973fa39336e9076bf266fbc9b1befa5b72bf3f05216ced86702327fd7794
4
+ data.tar.gz: b5945fcaf720a68e50c0d588f974c5f40c3a68006625a063a89c58e774295895
5
5
  SHA512:
6
- metadata.gz: 9210096527aa02b7225a68e188372863bb86fe431cb825e09332d8424eba1037ffce39c624656d3f93d07e39d35af960c46a0d7d689f79d9579069de6cd02f42
7
- data.tar.gz: bd30af737512479b43e02eddd27f33f8ddb57afb66e24c66572282c8786ebb5672f86b851dabb870bd322c1c76decbf062aa4d3266bbc6e4f6c868fe9ca13b4f
6
+ metadata.gz: c577e35ba541ad0f951fdc1ec9e0a619418cc16006a7d52124174c85aba0ead6c1cf385689d63fb54473338ee8d10d0a1f91435d78bfcff8c3183faab5f609dc
7
+ data.tar.gz: 9972b60eb46eeca29766a215bb27a80ccefe0c50860565cf73a35a4ec2c91d6d01f00ec9b0c5aa259370412069b3e31022377f50d9a61c3432da8b2c90d7f246
data/exe/rdoc-rubocop CHANGED
@@ -5,7 +5,19 @@ $LOAD_PATH.unshift("#{__dir__}/../lib")
5
5
  require "rdoc_rubocop"
6
6
 
7
7
  options, paths = RDocRuboCop::Options.new.parse(ARGV)
8
- paths = Dir.glob("**/*.rb") if paths.empty? if paths.empty?
9
8
 
10
- runner = RDocRuboCop::RuboCopRunner.new(paths, options: options)
9
+ paths = ["."] if paths.empty?
10
+ paths =
11
+ paths.
12
+ uniq.
13
+ flat_map do |path|
14
+ path = Pathname.new(path)
15
+ if path.directory?
16
+ path.glob("**/*.rb")
17
+ else
18
+ path
19
+ end
20
+ end
21
+
22
+ runner = RDocRuboCop::RuboCopRunner.new(paths.map(&:to_s), options: options)
11
23
  runner.run
@@ -21,19 +21,27 @@ module RDocRuboCop
21
21
 
22
22
  def format
23
23
  targets = source_files
24
-
25
24
  file_paths = targets.flat_map(&:source_code_file_paths)
26
- exit_code = run_cli(file_paths)
27
25
 
28
- targets.each(&:correct!)
26
+ if file_paths.empty?
27
+ report_zero
28
+ else
29
+ exit_code = run_cli(file_paths)
30
+ targets.each(&:correct!)
29
31
 
30
- exit_code
32
+ exit_code
33
+ end
31
34
  end
32
35
 
33
36
  def style_check
34
37
  targets = source_files
35
38
  file_paths = targets.flat_map(&:source_code_file_paths)
36
- run_cli(file_paths)
39
+
40
+ if file_paths.empty?
41
+ report_zero
42
+ else
43
+ run_cli(file_paths)
44
+ end
37
45
  end
38
46
 
39
47
  def run_cli(source_code_file_paths)
@@ -43,5 +51,14 @@ module RDocRuboCop
43
51
  def source_files
44
52
  @paths.map(&SourceFile.method(:build))
45
53
  end
54
+
55
+ # Report with a message: "Inspecting 0 files"
56
+ def report_zero
57
+ non_existing_filepath = Dir.glob("#{__dir__}/*").sort.last.succ
58
+
59
+ options, _ = RuboCop::Options.new.parse(@options)
60
+ config_store = RuboCop::ConfigStore.new
61
+ runner = RuboCop::Runner.new(options, config_store).run([non_existing_filepath])
62
+ end
46
63
  end
47
64
  end
@@ -1,3 +1,3 @@
1
1
  module RDocRuboCop
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdoc_rubocop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loose Coupling
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-23 00:00:00.000000000 Z
11
+ date: 2018-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop