yard-junk 0.0.3 → 0.0.4
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 +4 -4
- data/Changelog.md +4 -0
- data/README.md +14 -2
- data/exe/yard-junk +11 -1
- data/lib/yard-junk.rb +1 -0
- data/lib/yard-junk/janitor.rb +19 -9
- data/lib/yard-junk/version.rb +13 -0
- data/yard-junk.gemspec +3 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2951dd9b76ead149237efbb2d837868f334db37
|
4
|
+
data.tar.gz: 6b9e03ce2ec1b7f2c6eebb3fa7a23fa2bad10c95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b007c4ee552650b8c49d13619cbb98fb3dad7855ebf7a807c0c32ded821535197266e6511ef5754097937286a5bf1832e748fb824c38f9529914322e158e810
|
7
|
+
data.tar.gz: f58438719e6d9a11a7bd995d336e09f97b59aeaf5b81094e46fe7852ebfebe9c574f0fcd80455163333213c4f5f4da71130dac193a77b7dacdf73f63a07c89b7
|
data/Changelog.md
CHANGED
data/README.md
CHANGED
@@ -381,6 +381,19 @@ Examples:
|
|
381
381
|
* `yard-junk --text --html build-artifacts/junk-yard.html` (several formatters at once: text to console,
|
382
382
|
HTML to file).
|
383
383
|
|
384
|
+
You can also specify pathes to report (useful when working on large codebases, when you want to check
|
385
|
+
only your recent piece of work):
|
386
|
+
|
387
|
+
```
|
388
|
+
yard-junk --path some/path/
|
389
|
+
yard-junk --path other/path/*sample*.rb
|
390
|
+
yard-junk --path specific/path.rb
|
391
|
+
yard-junk --path several,different/*.rb,patterns.rb
|
392
|
+
```
|
393
|
+
|
394
|
+
Note that `yard-junk` would parse the pathes that set in `.yardopts` as usually, and then
|
395
|
+
**filter report** by pattern specified.
|
396
|
+
|
384
397
|
### Rake task (integrating in CI)
|
385
398
|
|
386
399
|
Add this to your `Rakefile`:
|
@@ -425,8 +438,7 @@ Therefore, this independent tool was made.
|
|
425
438
|
|
426
439
|
* Docs for usage as a system-wide YARD plugin;
|
427
440
|
* Docs for internals;
|
428
|
-
* Documentation quality checks as a next level of YARD checker ([#14](https://github.com/zverok/yard-junk/issues/14))
|
429
|
-
* Option to check only selected parts of code ([#13](https://github.com/zverok/yard-junk/issues/13)).
|
441
|
+
* Documentation quality checks as a next level of YARD checker ([#14](https://github.com/zverok/yard-junk/issues/14)).
|
430
442
|
|
431
443
|
## Some examples of problems found in popular gems:
|
432
444
|
|
data/exe/yard-junk
CHANGED
@@ -8,6 +8,7 @@ require 'yard-junk'
|
|
8
8
|
require 'optparse'
|
9
9
|
|
10
10
|
formatters = {}
|
11
|
+
check_path = nil
|
11
12
|
|
12
13
|
OptionParser.new do |opts|
|
13
14
|
opts.banner = 'Usage: yard-junk [formatters]'
|
@@ -28,6 +29,15 @@ OptionParser.new do |opts|
|
|
28
29
|
opts.separator ''
|
29
30
|
opts.separator 'Other options'
|
30
31
|
|
32
|
+
opts.on('-f', '--path PATTERN1,PATTERN2,PATTERN3', 'Limit output only to this files. Can be path to file or folder, or glob pattern') do |patterns|
|
33
|
+
check_path = patterns.split(',')
|
34
|
+
end
|
35
|
+
|
36
|
+
opts.on_tail('-v', '--version', 'Prints version') do
|
37
|
+
puts "YardJunk #{YardJunk::VERSION}"
|
38
|
+
exit
|
39
|
+
end
|
40
|
+
|
31
41
|
opts.on_tail('-h', '--help', 'Show this message') do
|
32
42
|
puts opts
|
33
43
|
exit
|
@@ -38,4 +48,4 @@ formatters = {text: nil} if formatters.empty?
|
|
38
48
|
|
39
49
|
janitor = YardJunk::Janitor.new
|
40
50
|
janitor.run
|
41
|
-
exit janitor.report(**formatters)
|
51
|
+
exit janitor.report(path: check_path, **formatters)
|
data/lib/yard-junk.rb
CHANGED
data/lib/yard-junk/janitor.rb
CHANGED
@@ -7,9 +7,9 @@ module YardJunk
|
|
7
7
|
class Janitor
|
8
8
|
def run(*opts)
|
9
9
|
YARD::Registry.clear # Somehow loads all Ruby stdlib classes before Rake task started...
|
10
|
-
Logger.instance.format = nil
|
10
|
+
Logger.instance.format = nil # Nothing shouuld be printed
|
11
11
|
|
12
|
-
puts "Running YardJunk janitor...\n\n"
|
12
|
+
puts "Running YardJunk janitor (version #{YardJunk::VERSION})...\n\n"
|
13
13
|
|
14
14
|
@duration = Benchmark.realtime do
|
15
15
|
command = YARD::CLI::Yardoc.new
|
@@ -20,20 +20,20 @@ module YardJunk
|
|
20
20
|
self
|
21
21
|
end
|
22
22
|
|
23
|
-
def stats
|
23
|
+
def stats(path = nil)
|
24
24
|
{
|
25
|
-
errors: errors.count,
|
26
|
-
problems: problems.count,
|
25
|
+
errors: filter(errors, path).count,
|
26
|
+
problems: filter(problems, path).count,
|
27
27
|
duration: @duration || 0
|
28
28
|
}
|
29
29
|
end
|
30
30
|
|
31
|
-
def report(*args, **opts)
|
31
|
+
def report(*args, path: nil, **opts)
|
32
32
|
guess_reporters(*args, **opts).each do |reporter|
|
33
|
-
reporter.section('Errors', 'severe code or formatting problems', errors)
|
34
|
-
reporter.section('Problems', 'mistyped tags or other typos in documentation', problems)
|
33
|
+
reporter.section('Errors', 'severe code or formatting problems', filter(errors, path))
|
34
|
+
reporter.section('Problems', 'mistyped tags or other typos in documentation', filter(problems, path))
|
35
35
|
|
36
|
-
reporter.stats(stats)
|
36
|
+
reporter.stats(stats(path))
|
37
37
|
reporter.finalize
|
38
38
|
end
|
39
39
|
|
@@ -60,6 +60,16 @@ module YardJunk
|
|
60
60
|
messages.select(&:warn?)
|
61
61
|
end
|
62
62
|
|
63
|
+
def filter(messages, pathes)
|
64
|
+
return messages unless pathes
|
65
|
+
filters =
|
66
|
+
Array(pathes)
|
67
|
+
.map { |path| File.directory?(path) ? File.join(path, '**', '*.*') : path }
|
68
|
+
.flat_map(&Dir.method(:[]))
|
69
|
+
.map(&File.method(:expand_path))
|
70
|
+
messages.select { |m| filters.include?(File.expand_path(m.file)) }
|
71
|
+
end
|
72
|
+
|
63
73
|
# TODO: specs for the logic
|
64
74
|
def guess_reporters(*symbols, **symbols_with_args)
|
65
75
|
symbols
|
data/yard-junk.gemspec
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
require_relative 'lib/yard-junk/version'
|
2
|
+
|
1
3
|
Gem::Specification.new do |s|
|
2
4
|
s.name = 'yard-junk'
|
3
|
-
s.version =
|
5
|
+
s.version = YardJunk::VERSION
|
4
6
|
s.authors = ['Victor Shepelev']
|
5
7
|
s.email = 'zverok.offline@gmail.com'
|
6
8
|
s.homepage = 'https://github.com/zverok/junk_yard'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-junk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Shepelev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|
@@ -218,6 +218,7 @@ files:
|
|
218
218
|
- lib/yard-junk/logger.rb
|
219
219
|
- lib/yard-junk/logger/message.rb
|
220
220
|
- lib/yard-junk/rake.rb
|
221
|
+
- lib/yard-junk/version.rb
|
221
222
|
- yard-junk.gemspec
|
222
223
|
homepage: https://github.com/zverok/junk_yard
|
223
224
|
licenses:
|