rubocop-md 1.2.2 → 1.2.3

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: 2e1a8d57e542393892dbdf2f9ffd7229d82e1996e900dd33edec55c0b94371ef
4
- data.tar.gz: 5503ee8519df1ead15a2ae9602ffc4e960a6d6ddd2d36f32e0dea39c6ac87eef
3
+ metadata.gz: c7c6dbb228497df06f33f4c2c5f91b9fc719aa1026428b8ca86e596f4658ffcb
4
+ data.tar.gz: c42e2dea6fe018ec5e0f23dd39caeaff927408729ee69c911f7220446017d1c0
5
5
  SHA512:
6
- metadata.gz: 3e0c6ff91ac90e928919e12774f4b1013e67b2957e1b3dfc958ef177f1c74ec3f2eb494ffe58c1a98946a69bc1eace0f79dd5664055f448388fedd02cbe7e824
7
- data.tar.gz: d24bc990a119f44ddb136047bcf3423934d8252ee340cdc09b9500cf42da09aa352f0a58e8f22d249f9449cad2fb71681f5689c65af760697b493222899e7814
6
+ metadata.gz: d3a4dd5d3e3eb894db690a40f699303f4350664516cd83475127786e8348086b0e23d8209fb2187aa0df33e287f4a6f72f840efe7b9dc7214b0113180299e59f
7
+ data.tar.gz: 5cd2b8c3675fd5fa84676c00d75ce2872dbc193ab4f55fc01283450c5bc3ad3774c80156b712332db467585baa8e3913064f5c14095102eb2bb979b572e1e51e
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 1.2.3 (2024-09-12)
6
+
7
+ - Do no try linting `.mdx` files by default.
8
+
5
9
  ## 1.2.2 (2023-12-01) ❄️
6
10
 
7
11
  - Fix analyzing code blocks with backticks.
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  [![Gem Version](https://badge.fury.io/rb/rubocop-md.svg)](http://badge.fury.io/rb/rubocop-md)
2
- ![Test](https://github.com/rubocop-hq/rubocop-md/workflows/Test/badge.svg)
2
+ ![Test](https://github.com/rubocop/rubocop-md/workflows/Test/badge.svg)
3
3
 
4
4
  # Rubocop Markdown
5
5
 
@@ -158,7 +158,7 @@ To install this gem onto your local machine, run `bundle exec rake install`.
158
158
 
159
159
  ## Contributing
160
160
 
161
- Bug reports and pull requests are welcome on GitHub at https://github.com/rubocop-hq/rubocop-md.
161
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rubocop/rubocop-md.
162
162
 
163
163
  ## License
164
164
 
data/config/default.yml CHANGED
@@ -1,111 +1,86 @@
1
+ inherit_mode:
2
+ merge:
3
+ - Include
4
+ - Exclude
5
+
1
6
  Markdown:
2
7
  WarnInvalid: true
3
8
  Autodetect: true
4
9
 
5
- Layout/CommentIndentation:
6
- Exclude:
7
- - '**/*.md'
8
- - '**/*.markdown'
10
+ # Keep in sync with MARKDOWN_EXTENSIONS
11
+ Layout/CommentIndentation: &markdown_excludes
12
+ Exclude:
13
+ - "**/*.md"
14
+ - "**/*.livemd"
15
+ - "**/*.markdown"
16
+ - "**/*.mdown"
17
+ - "**/*.mdwn"
18
+ - "**/*.mkd"
19
+ - "**/*.mkdn"
20
+ - "**/*.mkdown"
21
+ - "**/*.ronn"
22
+ - "**/*.scd"
23
+ - "**/*.workbook"
9
24
 
10
25
  Layout/LeadingCommentSpace:
11
- Exclude:
12
- - '**/*.md'
13
- - '**/*.markdown'
26
+ <<: *markdown_excludes
14
27
 
15
28
  Layout/TrailingBlankLines:
16
- Exclude:
17
- - '**/*.md'
18
- - '**/*.markdown'
29
+ <<: *markdown_excludes
19
30
 
20
31
  Layout/TrailingEmptyLines:
21
- Exclude:
22
- - '**/*.md'
23
- - '**/*.markdown'
32
+ <<: *markdown_excludes
24
33
 
25
34
  Layout/EmptyLineBetweenDefs:
26
- Exclude:
27
- - '**/*.md'
28
- - '**/*.markdown'
35
+ <<: *markdown_excludes
29
36
 
30
37
  Lint/DuplicateRequire:
31
- Exclude:
32
- - '**/*.md'
33
- - '**/*.markdown'
38
+ <<: *markdown_excludes
34
39
 
35
40
  Lint/DuplicateMethods:
36
- Exclude:
37
- - '**/*.md'
38
- - '**/*.markdown'
41
+ <<: *markdown_excludes
39
42
 
40
43
  Lint/RedundantCopDisableDirective:
41
- Exclude:
42
- - '**/*.md'
43
- - '**/*.markdown'
44
+ <<: *markdown_excludes
44
45
 
45
46
  Lint/RedundantCopEnableDirective:
46
- Exclude:
47
- - '**/*.md'
48
- - '**/*.markdown'
47
+ <<: *markdown_excludes
49
48
 
50
49
  Lint/RedundantRequireStatement:
51
- Exclude:
52
- - '**/*.md'
53
- - '**/*.markdown'
50
+ <<: *markdown_excludes
54
51
 
55
52
  Lint/UnusedMethodArgument:
56
- Exclude:
57
- - '**/*.md'
58
- - '**/*.markdown'
53
+ <<: *markdown_excludes
59
54
 
60
55
  Lint/UnusedBlockArgument:
61
- Exclude:
62
- - '**/*.md'
63
- - '**/*.markdown'
56
+ <<: *markdown_excludes
64
57
 
65
58
  Lint/UselessAssignment:
66
- Exclude:
67
- - '**/*.md'
68
- - '**/*.markdown'
59
+ <<: *markdown_excludes
69
60
 
70
61
  Lint/UselessMethodDefinition:
71
- Exclude:
72
- - '**/*.md'
73
- - '**/*.markdown'
62
+ <<: *markdown_excludes
74
63
 
75
64
  Lint/UselessAccessModifier:
76
- Exclude:
77
- - '**/*.md'
78
- - '**/*.markdown'
65
+ <<: *markdown_excludes
79
66
 
80
67
  Lint/Void:
81
- Exclude:
82
- - '**/*.md'
83
- - '**/*.markdown'
68
+ <<: *markdown_excludes
84
69
 
85
70
  Naming/FileName:
86
- Exclude:
87
- - '**/*.md'
88
- - '**/*.markdown'
71
+ <<: *markdown_excludes
89
72
 
90
73
  Style/AsciiComments:
91
- Exclude:
92
- - '**/*.md'
93
- - '**/*.markdown'
74
+ <<: *markdown_excludes
94
75
 
95
76
  Style/Documentation:
96
- Exclude:
97
- - '**/*.md'
98
- - '**/*.markdown'
77
+ <<: *markdown_excludes
99
78
 
100
79
  Style/CommentAnnotation:
101
- Exclude:
102
- - '**/*.md'
103
- - '**/*.markdown'
80
+ <<: *markdown_excludes
104
81
 
105
82
  Style/FrozenStringLiteralComment:
106
- Exclude:
107
- - '**/*.md'
108
- - '**/*.markdown'
83
+ <<: *markdown_excludes
109
84
 
110
85
  Layout/LineLength:
111
86
  IgnoredPatterns:
@@ -39,11 +39,15 @@ module RuboCop
39
39
  # using preproccessed source buffer.
40
40
  #
41
41
  # We have to restore it.
42
- def restore!(file)
42
+ def restore_and_save!(file)
43
43
  contents = File.read(file)
44
- contents.gsub!(/^##{MARKER}/m, "")
44
+ restore!(contents)
45
45
  File.write(file, contents)
46
46
  end
47
+
48
+ def restore!(src)
49
+ src.gsub!(/^##{MARKER}/m, "")
50
+ end
47
51
  end
48
52
 
49
53
  attr_reader :config
@@ -2,18 +2,19 @@
2
2
 
3
3
  module RuboCop
4
4
  module Markdown # :nodoc:
5
- # According to Linguist.
6
- # See https://github.com/github/linguist/blob/96ca71ab99c2f9928d5d69f4c08fd2a51440d045/lib/linguist/languages.yml#L3065-L3083
5
+ # See https://github.com/github-linguist/linguist/blob/8c380f360ce00b95fa08d14ce0ebccd481af1b33/lib/linguist/languages.yml#L4088-L4098
6
+ # Keep in sync with config/default.yml
7
7
  MARKDOWN_EXTENSIONS = %w[
8
8
  .md
9
+ .livemd
9
10
  .markdown
10
11
  .mdown
11
12
  .mdwn
12
- .mdx
13
13
  .mkd
14
14
  .mkdn
15
15
  .mkdown
16
16
  .ronn
17
+ .scd
17
18
  .workbook
18
19
  ].freeze
19
20
 
@@ -59,27 +60,29 @@ RuboCop::Runner.prepend(Module.new do
59
60
  super
60
61
  end
61
62
 
62
- def inspect_file(*args)
63
- super.tap do |(offenses, *)|
64
- # Skip offenses reported for ignored MD source (trailing whitespaces, etc.)
65
- marker_comment = "##{RuboCop::Markdown::Preprocess::MARKER}"
66
- offenses.reject! do |offense|
67
- next if RuboCop::Markdown::MARKDOWN_OFFENSE_COPS.include?(offense.cop_name)
68
-
69
- offense.location.source_line.start_with?(marker_comment)
70
- end
71
- end
72
- end
73
-
74
63
  def file_finished(file, offenses)
75
64
  return super unless RuboCop::Markdown.markdown_file?(file)
76
65
 
77
66
  # Run Preprocess.restore if file has been autocorrected
78
67
  if @options[:auto_correct] || @options[:autocorrect]
79
- RuboCop::Markdown::Preprocess.restore!(file)
68
+ RuboCop::Markdown::Preprocess.restore_and_save!(file)
80
69
  end
81
70
 
82
- super(file, offenses)
71
+ super
72
+ end
73
+ end)
74
+
75
+ RuboCop::Cop::Commissioner::InvestigationReport.prepend(Module.new do
76
+ # Skip offenses reported for ignored MD source (trailing whitespaces, etc.)
77
+ def offenses
78
+ @offenses ||= begin
79
+ marker_comment = "##{RuboCop::Markdown::Preprocess::MARKER}"
80
+ offenses_per_cop.flatten(1).reject do |offense|
81
+ next if RuboCop::Markdown::MARKDOWN_OFFENSE_COPS.include?(offense.cop_name)
82
+
83
+ offense.location.source_line.start_with?(marker_comment)
84
+ end
85
+ end
83
86
  end
84
87
  end)
85
88
 
@@ -96,6 +99,6 @@ RuboCop::ProcessedSource.prepend(Module.new do
96
99
  # only process Markdown files
97
100
  src = RuboCop::Markdown::Preprocess.new(path).call(src) if
98
101
  path && RuboCop::Markdown.markdown_file?(path)
99
- super(src, *args)
102
+ super
100
103
  end
101
104
  end)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RuboCop
4
4
  module Markdown
5
- VERSION = "1.2.2"
5
+ VERSION = "1.2.3"
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: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-01 00:00:00.000000000 Z
11
+ date: 2024-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '1.45'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '1.45'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -83,16 +83,16 @@ files:
83
83
  - lib/rubocop/markdown/preprocess.rb
84
84
  - lib/rubocop/markdown/rubocop_ext.rb
85
85
  - lib/rubocop/markdown/version.rb
86
- homepage: https://github.com/rubocop-hq/rubocop-md
86
+ homepage: https://github.com/rubocop/rubocop-md
87
87
  licenses:
88
88
  - MIT
89
89
  metadata:
90
- bug_tracker_uri: http://github.com/rubocop-hq/rubocop-md/issues
91
- changelog_uri: https://github.com/rubocop-hq/rubocop-md/blob/master/CHANGELOG.md
92
- documentation_uri: https://github.com/rubocop-hq/rubocop-md/blob/master/README.md
93
- homepage_uri: https://github.com/rubocop-hq/rubocop-md
94
- source_code_uri: http://github.com/rubocop-hq/rubocop-md
95
- post_install_message:
90
+ bug_tracker_uri: http://github.com/rubocop/rubocop-md/issues
91
+ changelog_uri: https://github.com/rubocop/rubocop-md/blob/master/CHANGELOG.md
92
+ documentation_uri: https://github.com/rubocop/rubocop-md/blob/master/README.md
93
+ homepage_uri: https://github.com/rubocop/rubocop-md
94
+ source_code_uri: http://github.com/rubocop/rubocop-md
95
+ post_install_message:
96
96
  rdoc_options: []
97
97
  require_paths:
98
98
  - lib
@@ -107,8 +107,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0'
109
109
  requirements: []
110
- rubygems_version: 3.4.20
111
- signing_key:
110
+ rubygems_version: 3.4.19
111
+ signing_key:
112
112
  specification_version: 4
113
113
  summary: Run Rubocop against your Markdown files to make sure that code examples follow
114
114
  style guidelines.