rubocop-md 2.0.2 → 2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dfd20848e16e37aefa999ffc4a391843b6d6658d6cf2e5e33ae6cbbe50068bac
4
- data.tar.gz: 4667da5e80a158d094fd7a2d2fb00421f5e7a9e2d7bb156196d5ee992be56800
3
+ metadata.gz: c3daa631b2f266f022b572d333bca39c035fca85c6cd3616c855f3cd796f04f7
4
+ data.tar.gz: 3e78b24aee5905d444d632d7ff92f348f1ad6bbf1c8747a0c149be1373ec8a6f
5
5
  SHA512:
6
- metadata.gz: 0bf40642608500292b2ea9d7e1f5c5b7d5252176aa4de3ec8af4a2d5f3779aae2ffe50826487eb116c74d101f8768dd5692de84892e0f06cc74da18d94b9fce1
7
- data.tar.gz: 4b0905fddf974a01c6310ff211b42d94ea4cb1a0e576b1a263b526d3f357e0d2edc960a5ef7461432953551e1ff8b5b29f5ba2da94445e38ce1e8f55d9353546
6
+ metadata.gz: 02ed290d0f3cbfcb6d8a28f762ff7ee9d2382f391b1b6464a57f9354cbd481cfe8967bd4e1274b70ed97c1526832029efe8e4a997f7477dc3b2256c2e67e54dd
7
+ data.tar.gz: cd2fdbe1a09b41dcf83ca2aa63edb827adfae08259c9a48b6a21e59710a8c0feffd9ec3ed7e418eb720904764e5ca69f69855ba9eadaae1b42d6a61ef66e7a3b
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 2.0.4 (2026-01-28)
6
+
7
+ - Enable caching when no offenses detected.
8
+
9
+ ## 2.0.3 (2025-09-30)
10
+
11
+ - Fix compatibility with RuboCop upstream (`get_processed_source` signature)
12
+
5
13
  ## 2.0.2 (2025-08-20)
6
14
 
7
15
  - Support metadata in code blocks.
@@ -33,21 +33,41 @@ end
33
33
 
34
34
  RuboCop::Runner.prepend(Module.new do
35
35
  # Set config store for Markdown
36
- def get_processed_source(*args)
36
+ def get_processed_source(...)
37
37
  RuboCop::Markdown.config_store = @config_store unless RuboCop::Markdown.config_store
38
38
 
39
39
  super
40
40
  end
41
41
 
42
- # Do not cache markdown files, 'cause cache doesn't know about processing.
42
+ # Only cache markdown files if they have no offenses, 'cause cache doesn't know about processing.
43
43
  # NOTE: we should involve preprocessing in RuboCop::CachedData#deserialize_offenses
44
- def file_offense_cache(file)
45
- return yield if RuboCop::Markdown.markdown_file?(file)
44
+ # rubocop:disable Metrics/MethodLength, Metrics/PerceivedComplexity
45
+ def file_offense_cache(file, ...)
46
+ if cached_run? && RuboCop::Markdown.markdown_file?(file)
47
+ config = @config_store.for_file(file)
48
+ cache = cached_result(file, standby_team(config))
46
49
 
47
- super
50
+ if cache&.valid?
51
+ offenses = cache.load
52
+
53
+ real_run_needed = offenses.any?
54
+ else
55
+ real_run_needed = true
56
+ end
57
+
58
+ if real_run_needed
59
+ offenses = yield
60
+ save_in_cache(cache, offenses) if offenses.empty?
61
+ end
62
+
63
+ offenses
64
+ else
65
+ super
66
+ end
48
67
  end
68
+ # rubocop:enable Metrics/MethodLength, Metrics/PerceivedComplexity
49
69
 
50
- def file_finished(file, offenses)
70
+ def file_finished(file, offenses, ...)
51
71
  return super unless RuboCop::Markdown.markdown_file?(file)
52
72
 
53
73
  # Run Preprocess.restore if file has been autocorrected
@@ -75,14 +95,14 @@ end)
75
95
 
76
96
  # Allow Rubocop to analyze markdown files
77
97
  RuboCop::TargetFinder.prepend(Module.new do
78
- def ruby_file?(file)
98
+ def ruby_file?(file, ...)
79
99
  super || RuboCop::Markdown.markdown_file?(file)
80
100
  end
81
101
  end)
82
102
 
83
103
  # Extend ProcessedSource#parse with pre-processing
84
104
  RuboCop::ProcessedSource.prepend(Module.new do
85
- def parse(src, *args)
105
+ def parse(src, ...)
86
106
  # only process Markdown files
87
107
  src = RuboCop::Markdown::Preprocess.new(path).call(src) if
88
108
  path && RuboCop::Markdown.markdown_file?(path)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Markdown
5
- VERSION = "2.0.2"
5
+ VERSION = "2.0.4"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-md
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-20 00:00:00.000000000 Z
11
+ date: 2026-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lint_roller