yard-junk 0.0.7 → 0.0.8

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: 1cc08ba16be8c10d61c8aef74b678626aefee885
4
- data.tar.gz: 98b37e4329450c227f5152a23aa6e68d8dafab6e
2
+ SHA256:
3
+ metadata.gz: 5ae36216a5faaa685ff336798cdac734e1e1088925647c2f4daed058bfe9ae24
4
+ data.tar.gz: 9d4bb2f2afd494922f317b5aeb3d29da03bc63bb05c2022fc5cb888eba9eb95b
5
5
  SHA512:
6
- metadata.gz: 37d1bf6cebf4d86a56db9f36f1d5f9b455db62b1d8d54247487ac1978679a39d46a51ef5ea35108a0d26a0b4509c7d179869b94a1768597e47b81d9b3245c78d
7
- data.tar.gz: 4a337f018ed00c53b68f6a60ab86e1ecc9167e0a4649cc6acd361407a16dd9c813b3443f7fef19062267d1ca005e844f7017a6246482fef248a36bf650b023c8
6
+ metadata.gz: 7ca4fee74f9c585756155d3182acbda310236c2a6e54a79c5df18f9a012beb89e40fef48921ddbc55488ea27212b644bb30f2d0959eec014f1e4529df4fa09a6
7
+ data.tar.gz: 809c9b9c79fb371a2d6a3b768000122c4dbddb85f97a8c6f41cae089ff591f7926ca009888826007b6bdcabca8616c033697b82c353b568606c560490383748d
@@ -0,0 +1,32 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ master ]
6
+ pull_request:
7
+ branches: [ master ]
8
+
9
+ jobs:
10
+ main:
11
+ name: >-
12
+ ${{ matrix.ruby }}
13
+ runs-on: ubuntu-latest
14
+ strategy:
15
+ fail-fast: false
16
+ matrix:
17
+ ruby: [ 2.5, 2.6, 2.7, head ]
18
+
19
+ steps:
20
+ - name: checkout
21
+ uses: actions/checkout@v2
22
+ - name: set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby }}
26
+
27
+ - name: install dependencies
28
+ run: bundle install --jobs 3 --retry 3
29
+ - name: spec
30
+ run: bundle exec rake spec
31
+ - name: rubocop
32
+ run: bundle exec rake rubocop
@@ -1,5 +1,10 @@
1
1
  # Yard-Junk changelog
2
2
 
3
+ ## 0.0.8 -- 2020-11-12
4
+
5
+ * Support Ruby 2.7 (and hopefully 3.0)
6
+ * Drop support for Rubies below 2.5 :shrug:
7
+
3
8
  ## 0.0.7 -- 2017-09-21
4
9
 
5
10
  * Fix problems with links resolution for RDoc.
@@ -0,0 +1,90 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ yard-junk (0.0.8)
5
+ backports (>= 3.18)
6
+ rainbow
7
+ yard
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ ast (2.4.1)
13
+ backports (3.18.2)
14
+ diff-lcs (1.4.4)
15
+ docile (1.1.5)
16
+ fakefs (1.2.2)
17
+ json (2.3.1)
18
+ json (2.3.1-java)
19
+ kramdown (2.3.0)
20
+ rexml
21
+ parallel (1.20.0)
22
+ parser (2.7.2.0)
23
+ ast (~> 2.4.1)
24
+ rainbow (3.0.0)
25
+ rake (13.0.1)
26
+ regexp_parser (1.8.2)
27
+ rexml (3.2.4)
28
+ rspec (3.10.0)
29
+ rspec-core (~> 3.10.0)
30
+ rspec-expectations (~> 3.10.0)
31
+ rspec-mocks (~> 3.10.0)
32
+ rspec-core (3.10.0)
33
+ rspec-support (~> 3.10.0)
34
+ rspec-expectations (3.10.0)
35
+ diff-lcs (>= 1.2.0, < 2.0)
36
+ rspec-support (~> 3.10.0)
37
+ rspec-its (1.2.0)
38
+ rspec-core (>= 3.0.0)
39
+ rspec-expectations (>= 3.0.0)
40
+ rspec-mocks (3.10.0)
41
+ diff-lcs (>= 1.2.0, < 2.0)
42
+ rspec-support (~> 3.10.0)
43
+ rspec-support (3.10.0)
44
+ rubocop (1.3.0)
45
+ parallel (~> 1.10)
46
+ parser (>= 2.7.1.5)
47
+ rainbow (>= 2.2.2, < 4.0)
48
+ regexp_parser (>= 1.8)
49
+ rexml
50
+ rubocop-ast (>= 1.1.1)
51
+ ruby-progressbar (~> 1.7)
52
+ unicode-display_width (>= 1.4.0, < 2.0)
53
+ rubocop-ast (1.1.1)
54
+ parser (>= 2.7.1.5)
55
+ rubocop-rspec (2.0.0)
56
+ rubocop (~> 1.0)
57
+ rubocop-ast (>= 1.1.0)
58
+ ruby-progressbar (1.10.1)
59
+ ruby2_keywords (0.0.2)
60
+ rubygems-tasks (0.2.4)
61
+ saharspec (0.0.8)
62
+ ruby2_keywords
63
+ simplecov (0.15.0)
64
+ docile (~> 1.1.0)
65
+ json (>= 1.8, < 3)
66
+ simplecov-html (~> 0.10.0)
67
+ simplecov-html (0.10.2)
68
+ unicode-display_width (1.7.0)
69
+ yard (0.9.25)
70
+
71
+ PLATFORMS
72
+ java
73
+ ruby
74
+
75
+ DEPENDENCIES
76
+ fakefs
77
+ kramdown
78
+ rake
79
+ rspec (>= 3)
80
+ rspec-its (~> 1)
81
+ rubocop
82
+ rubocop-rspec
83
+ rubygems-tasks
84
+ saharspec
85
+ simplecov (~> 0.9)
86
+ yard
87
+ yard-junk!
88
+
89
+ BUNDLED WITH
90
+ 1.17.3
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Yard-Junk: get rid of junk in your YARD docs!
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/yard-junk.svg)](http://badge.fury.io/rb/yard-junk)
4
- [![Build Status](https://travis-ci.org/zverok/yard-junk.svg?branch=master)](https://travis-ci.org/zverok/yard-junk)
4
+ ![Build Status](https://github.com/zverok/yard-junk/workflows/CI/badge.svg?branch=master)
5
5
 
6
6
  Yard-Junk is [yard](https://github.com/lsegal/yard) plugin/patch, that provides:
7
7
 
@@ -14,7 +14,8 @@ OptionParser.new do |opts| # rubocop:disable Metrics/BlockLength
14
14
  opts.banner = 'Usage: yard-junk [formatters]'
15
15
  opts.separator ''
16
16
  opts.separator 'Formatters'
17
- opts.separator '(you can use several at once, for example --text to print in console and --html to save HTML report somewhere)'
17
+ opts.separator '(you can use several at once, for example --text to print in console '\
18
+ 'and --html to save HTML report somewhere)'
18
19
  opts.separator 'Default is: text formatter, printing to STDOUT.'
19
20
  opts.separator ''
20
21
 
@@ -22,18 +23,23 @@ OptionParser.new do |opts| # rubocop:disable Metrics/BlockLength
22
23
  formatters[:text] = path
23
24
  end
24
25
 
25
- opts.on('--html [PATH]', 'HTML formatter, useful as CI artifact (prints to STDOUT by default)') do |path|
26
+ opts.on('--html [PATH]',
27
+ 'HTML formatter, useful as CI artifact (prints to STDOUT by default)') do |path|
26
28
  formatters[:html] = path
27
29
  end
28
30
 
29
31
  opts.separator ''
30
32
  opts.separator 'Other options'
31
33
 
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|
34
+ opts.on('-f', '--path PATTERN1,PATTERN2,PATTERN3',
35
+ 'Limit output only to this files. '\
36
+ 'Can be path to file or folder, or glob pattern') do |patterns|
33
37
  options[:pathes] = patterns.split(',')
34
38
  end
35
39
 
36
- opts.on('-s', '--sanity', 'Sanity check for docs: just catch mistyped tags and similar stuff. On large codebases, MUCH faster than full check.') do
40
+ opts.on('-s', '--sanity',
41
+ 'Sanity check for docs: just catch mistyped tags and similar stuff. '\
42
+ 'On large codebases, MUCH faster than full check.') do
37
43
  options[:mode] = :sanity
38
44
  end
39
45
 
@@ -8,11 +8,15 @@ module YardJunk
8
8
  opts.separator ''
9
9
  opts.separator 'YardJunk plugin options'
10
10
 
11
- opts.on('--junk-log-format [FMT]', "YardJunk::Logger format string, by default #{Logger::Message::DEFAULT_FORMAT.inspect}") do |format|
11
+ opts.on('--junk-log-format [FMT]',
12
+ 'YardJunk::Logger format string, by default '\
13
+ "#{Logger::Message::DEFAULT_FORMAT.inspect}") do |format|
12
14
  Logger.instance.format = format
13
15
  end
14
16
 
15
- opts.on('--junk-log-ignore [TYPE1,TYPE2,...]', "YardJunk::Logger message types to ignore, by default #{Logger::DEFAULT_IGNORE.map(&:inspect).join(', ')}") do |ignore|
17
+ opts.on('--junk-log-ignore [TYPE1,TYPE2,...]',
18
+ 'YardJunk::Logger message types to ignore, by default '\
19
+ "#{Logger::DEFAULT_IGNORE.map(&:inspect).join(', ')}") do |ignore|
16
20
  Logger.instance.ignore = ignore.to_s.split(',')
17
21
  end
18
22
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'benchmark'
4
4
  require 'backports/2.3.0/enumerable/grep_v'
5
+ require 'backports/2.6.0/array/to_h'
5
6
 
6
7
  module YardJunk
7
8
  class Janitor
@@ -46,9 +47,11 @@ module YardJunk
46
47
  end
47
48
 
48
49
  def exit_code
49
- return 2 unless errors.empty?
50
- return 1 unless problems.empty?
51
- 0
50
+ case
51
+ when !errors.empty? then 2
52
+ when !problems.empty? then 1
53
+ else 0
54
+ end
52
55
  end
53
56
 
54
57
  private
@@ -58,9 +61,10 @@ module YardJunk
58
61
  BASE_OPTS = %w[--no-save --no-progress --no-stats --no-output --no-cache].freeze
59
62
 
60
63
  def prepare_options(opts)
61
- if mode == :full || mode == :sanity && files.nil?
64
+ case
65
+ when mode == :full || mode == :sanity && files.nil?
62
66
  [*BASE_OPTS, *opts]
63
- elsif mode == :sanity
67
+ when mode == :sanity
64
68
  # TODO: specs
65
69
  [*BASE_OPTS, '--no-yardopts', *yardopts_with_files(files)]
66
70
  else
@@ -92,6 +96,7 @@ module YardJunk
92
96
 
93
97
  def expand_pathes(pathes)
94
98
  return unless pathes
99
+
95
100
  Array(pathes)
96
101
  .map { |path| File.directory?(path) ? File.join(path, '**', '*.*') : path }
97
102
  .flat_map(&Dir.method(:[]))
@@ -101,9 +106,11 @@ module YardJunk
101
106
  # TODO: specs for the logic
102
107
  def guess_reporters(*symbols, **symbols_with_args)
103
108
  symbols
104
- .map { |sym| [sym, nil] }.to_h.merge(symbols_with_args)
109
+ .to_h { |sym| [sym, nil] }.merge(symbols_with_args)
105
110
  .map { |sym, args| ["#{sym.to_s.capitalize}Reporter", args] }
106
- .each { |name, _| Janitor.const_defined?(name) or fail(ArgumentError, "Reporter #{name} not found") }
111
+ .each { |name,|
112
+ Janitor.const_defined?(name) or fail(ArgumentError, "Reporter #{name} not found")
113
+ }
107
114
  .map { |name, args| Janitor.const_get(name).new(*args) }
108
115
  end
109
116
  end
@@ -19,7 +19,7 @@ module YardJunk
19
19
  #
20
20
  # @overload initialize(filename)
21
21
  # @param filename [String] Name of file to save the output.
22
- def initialize(io_or_filename = STDOUT)
22
+ def initialize(io_or_filename = $stdout)
23
23
  @io =
24
24
  case io_or_filename
25
25
  when ->(i) { i.respond_to?(:puts) } # quacks!
@@ -35,6 +35,7 @@ module YardJunk
35
35
 
36
36
  def section(title, explanation, messages)
37
37
  return if messages.empty?
38
+
38
39
  header(title, explanation)
39
40
 
40
41
  messages
@@ -43,7 +44,7 @@ module YardJunk
43
44
  end
44
45
 
45
46
  def stats(**stat)
46
- _stats(stat.merge(duration: humanize_duration(stat[:duration])))
47
+ _stats(**stat.merge(duration: humanize_duration(stat[:duration])))
47
48
  end
48
49
 
49
50
  private
@@ -8,7 +8,7 @@ module YardJunk
8
8
  # for usage with Jenkins. See {BaseReporter} for details about reporters.
9
9
  #
10
10
  class HtmlReporter < BaseReporter
11
- HEADER = <<-HTML.freeze
11
+ HEADER = <<-HTML
12
12
  <!DOCTYPE html>
13
13
  <html lang="en">
14
14
  <header>
@@ -46,23 +46,23 @@ module YardJunk
46
46
  <h1>YARD Validation Report</h1>
47
47
  HTML
48
48
 
49
- FOOTER = <<-HTML.freeze
49
+ FOOTER = <<-HTML
50
50
  </body>
51
51
  </html>
52
52
  HTML
53
53
 
54
- SECTION = <<-HTML.freeze
54
+ SECTION = <<-HTML
55
55
  <h2 class="<%= title == 'Notices' ? 'notice' : 'problem' %>">
56
56
  <%= title %>
57
57
  <small>(<%= explanation %>)</small>
58
58
  </h2>
59
59
  HTML
60
60
 
61
- ROW = <<-HTML.freeze
61
+ ROW = <<-HTML
62
62
  <li><span class="path"><%= file %>:<%= line %></span>: <%= message %></li>
63
63
  HTML
64
64
 
65
- STATS = <<-HTML.freeze
65
+ STATS = <<-HTML
66
66
  <p class="stats">
67
67
  <span class="<%= 'problem' unless errors.zero? %>"><%= errors %> failures</span>,
68
68
  <span class="<%= 'problem' unless problems.zero? %>"><%= problems %> problems</span>
@@ -7,10 +7,11 @@ module YardJunk
7
7
  include YARD::Templates::Helpers::MarkupHelper
8
8
 
9
9
  # This one is copied from real YARD output
10
- OBJECT_MESSAGE_PATTERN = 'In file `%{file}\':%{line}: Cannot resolve link to %{name} from text: %{link}'.freeze
10
+ OBJECT_MESSAGE_PATTERN = "In file `%{file}':%{line}: " \
11
+ 'Cannot resolve link to %{name} from text: %{link}'
11
12
 
12
13
  # ...while this one is totally invented, YARD doesn't check file existance at all
13
- FILE_MESSAGE_PATTERN = "In file `%{file}':%{line}: File '%{name}' does not exist: %{link}".freeze
14
+ FILE_MESSAGE_PATTERN = "In file `%{file}':%{line}: File '%{name}' does not exist: %{link}"
14
15
 
15
16
  def self.resolve_all(yard_options)
16
17
  YARD::Registry.all.map(&:base_docstring).each { |ds| new(ds, yard_options).resolve }
@@ -32,6 +33,7 @@ module YardJunk
32
33
  def resolve
33
34
  markup_meth = "html_markup_#{markup}"
34
35
  return unless respond_to?(markup_meth)
36
+
35
37
  send(markup_meth, @string)
36
38
  .gsub(%r{<(code|tt|pre)[^>]*>(.*?)</\1>}im, '')
37
39
  .scan(/{[^}]+}/).flatten
@@ -76,13 +78,19 @@ module YardJunk
76
78
 
77
79
  def resolve_file(name, link)
78
80
  return if options.files.any? { |f| f.name == name || f.filename == name }
79
- Logger.instance.register(FILE_MESSAGE_PATTERN % {file: file, line: line, name: name, link: link})
81
+
82
+ Logger.instance.register(
83
+ FILE_MESSAGE_PATTERN % {file: file, line: line, name: name, link: link}
84
+ )
80
85
  end
81
86
 
82
87
  def resolve_code_object(name, link)
83
88
  resolved = YARD::Registry.resolve(@root_object, name, true, true)
84
89
  return unless resolved.is_a?(YARD::CodeObjects::Proxy)
85
- Logger.instance.register(OBJECT_MESSAGE_PATTERN % {file: file, line: line, name: name, link: link})
90
+
91
+ Logger.instance.register(
92
+ OBJECT_MESSAGE_PATTERN % {file: file, line: line, name: name, link: link}
93
+ )
86
94
  end
87
95
 
88
96
  # Used by HtmlHelper for RDoc
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'tty/color'
4
3
  require 'rainbow'
5
4
 
6
5
  module YardJunk
@@ -12,27 +11,24 @@ module YardJunk
12
11
  private
13
12
 
14
13
  def _stats(**stat)
15
- @io.puts "\n#{colorized_stats(stat)}"
14
+ @io.puts "\n#{colorized_stats(**stat)}"
16
15
  end
17
16
 
18
17
  def colorized_stats(errors:, problems:, duration:)
19
- colorize(format('%i failures, %i problems', errors, problems), status_color(errors, problems)) +
20
- format(' (%s to run)', duration)
18
+ colorize(
19
+ format('%i failures, %i problems', errors, problems), status_color(errors, problems)
20
+ ) + format(' (%s to run)', duration)
21
21
  end
22
22
 
23
23
  def colorize(text, color)
24
- return text unless TTY::Color.supports?
25
24
  Rainbow(text).color(color)
26
25
  end
27
26
 
28
27
  def status_color(errors, problems)
29
28
  case
30
- when errors > 0
31
- :red
32
- when problems > 0
33
- :yellow
34
- else
35
- :green
29
+ when errors.positive? then :red
30
+ when problems.positive? then :yellow
31
+ else :green
36
32
  end
37
33
  end
38
34
 
@@ -40,7 +36,7 @@ module YardJunk
40
36
  @io.puts
41
37
  @io.puts title
42
38
  @io.puts '-' * title.length
43
- @io.puts explanation + "\n\n"
39
+ @io.puts "#{explanation}\n\n"
44
40
  end
45
41
 
46
42
  def row(msg)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module YardJunk
2
4
  class Janitor
3
5
  # Allows to properly parse `.yardopts` or other option file YARD supports and gracefully replace
@@ -13,9 +15,9 @@ module YardJunk
13
15
  @extra_files = internal.options.files
14
16
  end
15
17
 
16
- def set_files(*files) # rubocop:disable Style/AccessorMethodName
18
+ def set_files(*files) # rubocop:disable Naming/AccessorMethodName
17
19
  # TODO: REALLY fragile :(
18
- @files, @extra_files = files.partition { |f| f =~ /\.(rb|c|cxx|cpp)/ }
20
+ @files, @extra_files = files.partition { |f| f =~ /\.(rb|c|cxx|cpp|rake)/ }
19
21
  self
20
22
  end
21
23
 
@@ -23,6 +25,7 @@ module YardJunk
23
25
  [short, long].compact.each do |o|
24
26
  i = @options.index(o)
25
27
  next unless i
28
+
26
29
  @options.delete_at(i)
27
30
  @options.delete_at(i) unless @options[i].start_with?('-') # it was argument
28
31
  end
@@ -30,7 +33,8 @@ module YardJunk
30
33
  end
31
34
 
32
35
  def to_a
33
- (@options + @files).tap { |res| res.concat(['-', *@extra_files]) unless @extra_files.empty? }
36
+ (@options + @files)
37
+ .tap { |res| res.concat(['-', *@extra_files]) unless @extra_files.empty? }
34
38
  end
35
39
 
36
40
  # The easiest way to think like Yardoc is to become Yardoc, you know.
@@ -3,6 +3,8 @@
3
3
  require 'singleton'
4
4
  require 'pp'
5
5
 
6
+ require 'backports/2.7.0/enumerable/filter_map'
7
+
6
8
  module YardJunk
7
9
  class Logger
8
10
  require_relative 'logger/message'
@@ -16,9 +18,10 @@ module YardJunk
16
18
  end
17
19
 
18
20
  def register(msg, severity = :warn)
19
- message = Message.registry
20
- .map { |t| t.try_parse(msg, severity: severity, file: @current_parsed_file) }
21
- .compact.first || Message.new(message: msg, file: @current_parsed_file)
21
+ message =
22
+ Message.registry.filter_map { |t|
23
+ t.try_parse(msg, severity: severity, file: @current_parsed_file)
24
+ }.first || Message.new(message: msg, file: @current_parsed_file)
22
25
  messages << message
23
26
  puts message.to_s(@format) if output?(message)
24
27
  end
@@ -44,8 +47,10 @@ module YardJunk
44
47
  end
45
48
 
46
49
  def ignore=(list)
47
- @ignore = Array(list).map(&:to_s)
48
- .each { |type| Message.valid_type?(type) or fail(ArgumentError, "Unrecognized message type to ignore: #{type}") }
50
+ @ignore = Array(list).map(&:to_s).each do |type|
51
+ Message.valid_type?(type) or
52
+ fail(ArgumentError, "Unrecognized message type to ignore: #{type}")
53
+ end
49
54
  end
50
55
 
51
56
  private
@@ -10,7 +10,7 @@ module YardJunk
10
10
  def initialize(message:, severity: :warn, code_object: nil, file: nil, line: nil, **extra)
11
11
  @message = message.gsub(/\s{2,}/, ' ')
12
12
  @file = file
13
- @line = line && line.to_i
13
+ @line = line&.to_i
14
14
  @code_object = code_object
15
15
  @severity = severity
16
16
  @extra = extra
@@ -25,7 +25,7 @@ module YardJunk
25
25
  type: type,
26
26
  message: message,
27
27
  file: file,
28
- line: (line && line.to_i) || 1
28
+ line: line&.to_i || 1
29
29
  }.merge(extra)
30
30
  end
31
31
 
@@ -33,7 +33,7 @@ module YardJunk
33
33
  other.is_a?(self.class) && to_h == other.to_h
34
34
  end
35
35
 
36
- DEFAULT_FORMAT = '%{file}:%{line}: [%{type}] %{message}'.freeze
36
+ DEFAULT_FORMAT = '%{file}:%{line}: [%{type}] %{message}'
37
37
 
38
38
  def to_s(format = DEFAULT_FORMAT)
39
39
  format % to_h
@@ -62,8 +62,8 @@ module YardJunk
62
62
  def try_parse(line, **context)
63
63
  @pattern or fail StandardError, "Pattern is not defined for #{self}"
64
64
  match = @pattern.match(line) or return nil
65
- data = context.reject { |_, v| v.nil? }
66
- .merge(match.names.map(&:to_sym).zip(match.captures).to_h.reject { |_, v| v.nil? })
65
+ data = context.compact
66
+ .merge(match.names.map(&:to_sym).zip(match.captures).to_h.compact)
67
67
  data = guard_line(data)
68
68
  new(**data)
69
69
  end
@@ -78,17 +78,17 @@ module YardJunk
78
78
 
79
79
  private
80
80
 
81
- def guard_line(data) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
81
+ def guard_line(data) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
82
82
  # FIXME: Ugly, huh?
83
83
  data[:file] && data[:line] && @search_up or return data
84
84
  data = data.merge(line: data[:line].to_i)
85
85
  data = data.merge(code_object: find_object(data[:file], data[:line]))
86
86
  lines = File.readlines(data[:file]) rescue (return data) # rubocop:disable Style/RescueModifier
87
- pattern = Regexp.new(@search_up % data.map { |k, v| [k, Regexp.escape(v.to_s)] }.to_h)
87
+ pattern = Regexp.new(@search_up % data.transform_values { |v| Regexp.escape(v.to_s) })
88
88
  _, num = lines.map
89
89
  .with_index { |ln, i| [ln, i + 1] }
90
90
  .first(data[:line]).reverse
91
- .detect { |ln, _| pattern.match(ln) }
91
+ .detect { |ln,| pattern.match(ln) }
92
92
  num or return data
93
93
 
94
94
  data.merge(line: num)
@@ -100,6 +100,7 @@ module YardJunk
100
100
  end
101
101
  end
102
102
 
103
+ # rubocop:disable Layout/LineLength
103
104
  class UnknownTag < Message
104
105
  pattern %r{^(?<message>Unknown tag (?<tag>@\S+))( in file `(?<file>[^`]+)` near line (?<line>\d+))?$}
105
106
  search_up '%{tag}(\W|$)'
@@ -230,5 +231,6 @@ module YardJunk
230
231
  pattern %r{^In file `(?<file>[^']+)':(?<line>\d+): (?<message>File '(?<object>\S+)' does not exist:\s+(?<quote>.+))$}
231
232
  search_up '%{quote}'
232
233
  end
234
+ # rubocop:enable Layout/LineLength
233
235
  end
234
236
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  begin
4
4
  require 'did_you_mean'
5
- rescue LoadError # rubocop:disable Lint/HandleExceptions
5
+ rescue LoadError # rubocop:disable Lint/SuppressedException
6
6
  end
7
7
 
8
8
  module YardJunk
@@ -42,7 +42,7 @@ module YardJunk
42
42
  def spell_check(error, dictionary)
43
43
  SpellFinder.new(error, dictionary).suggestions
44
44
  end
45
- else
45
+ else # rubocop:disable Lint/DuplicateBranch -- actually, just impossibility catcher
46
46
  def spell_check(*)
47
47
  []
48
48
  end
@@ -6,7 +6,7 @@ module YardJunk
6
6
  # @private
7
7
  MINOR = 0
8
8
  # @private
9
- PATCH = 7
9
+ PATCH = 8
10
10
 
11
11
  # @private
12
12
  VERSION = [MINOR, MAJOR, PATCH].join('.')
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  EOF
14
14
  s.licenses = ['MIT']
15
15
 
16
- s.required_ruby_version = '>= 2.1.0'
16
+ s.required_ruby_version = '>= 2.5.0'
17
17
 
18
18
  s.files = `git ls-files`.split($RS).reject do |file|
19
19
  file =~ /^(?:
@@ -35,18 +35,18 @@ Gem::Specification.new do |s|
35
35
 
36
36
  s.add_dependency 'yard'
37
37
  s.add_dependency 'did_you_mean' if RUBY_VERSION < '2.3'
38
- s.add_dependency 'backports'
38
+ s.add_dependency 'backports', '>= 3.18'
39
39
  s.add_dependency 'rainbow'
40
- s.add_dependency 'tty-color'
41
40
 
42
- s.add_development_dependency 'rubocop', '= 0.49' # 0.50 breaks current rubocop-rspec
41
+ s.add_development_dependency 'rubocop'
43
42
  s.add_development_dependency 'rspec', '>= 3'
44
- s.add_development_dependency 'rubocop-rspec', '= 1.15.1' # 1.16+ is broken on JRuby
43
+ s.add_development_dependency 'rubocop-rspec'
45
44
  s.add_development_dependency 'rspec-its', '~> 1'
46
- #s.add_development_dependency 'saharspec' # saharspec is moving target!
45
+ s.add_development_dependency 'saharspec'
47
46
  s.add_development_dependency 'fakefs'
48
47
  s.add_development_dependency 'simplecov', '~> 0.9'
49
48
  s.add_development_dependency 'rake'
50
49
  s.add_development_dependency 'rubygems-tasks'
51
50
  s.add_development_dependency 'yard'
51
+ s.add_development_dependency 'kramdown'
52
52
  end
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.7
4
+ version: 0.0.8
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-21 00:00:00.000000000 Z
11
+ date: 2020-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yard
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '3.18'
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'
40
+ version: '3.18'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rainbow
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -53,33 +53,19 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: tty-color
56
+ name: rubocop
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
- type: :runtime
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
68
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rubocop
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '='
74
- - !ruby/object:Gem::Version
75
- version: '0.49'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '='
81
- - !ruby/object:Gem::Version
82
- version: '0.49'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: rspec
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -98,16 +84,16 @@ dependencies:
98
84
  name: rubocop-rspec
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
- - - '='
87
+ - - ">="
102
88
  - !ruby/object:Gem::Version
103
- version: 1.15.1
89
+ version: '0'
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
- - - '='
94
+ - - ">="
109
95
  - !ruby/object:Gem::Version
110
- version: 1.15.1
96
+ version: '0'
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: rspec-its
113
99
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +108,20 @@ dependencies:
122
108
  - - "~>"
123
109
  - !ruby/object:Gem::Version
124
110
  version: '1'
111
+ - !ruby/object:Gem::Dependency
112
+ name: saharspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: fakefs
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -192,6 +192,20 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: kramdown
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
195
209
  description: " YardJunk is structured logger/error validator plugin for YARD documentation
196
210
  gem.\n"
197
211
  email: zverok.offline@gmail.com
@@ -200,7 +214,9 @@ executables:
200
214
  extensions: []
201
215
  extra_rdoc_files: []
202
216
  files:
217
+ - ".github/workflows/ci.yml"
203
218
  - Changelog.md
219
+ - Gemfile.lock
204
220
  - README.md
205
221
  - examples/bare_log.rb
206
222
  - examples/formatted_log.rb
@@ -234,15 +250,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
234
250
  requirements:
235
251
  - - ">="
236
252
  - !ruby/object:Gem::Version
237
- version: 2.1.0
253
+ version: 2.5.0
238
254
  required_rubygems_version: !ruby/object:Gem::Requirement
239
255
  requirements:
240
256
  - - ">="
241
257
  - !ruby/object:Gem::Version
242
258
  version: '0'
243
259
  requirements: []
244
- rubyforge_project:
245
- rubygems_version: 2.6.10
260
+ rubygems_version: 3.0.3
246
261
  signing_key:
247
262
  specification_version: 4
248
263
  summary: Get rid of the junk in your YARD docs