rubocop-md 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -2
- data/config/default.yml +39 -64
- data/lib/rubocop/markdown/preprocess.rb +6 -2
- data/lib/rubocop/markdown/rubocop_ext.rb +21 -18
- data/lib/rubocop/markdown/version.rb +1 -1
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7c6dbb228497df06f33f4c2c5f91b9fc719aa1026428b8ca86e596f4658ffcb
|
4
|
+
data.tar.gz: c42e2dea6fe018ec5e0f23dd39caeaff927408729ee69c911f7220446017d1c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3a4dd5d3e3eb894db690a40f699303f4350664516cd83475127786e8348086b0e23d8209fb2187aa0df33e287f4a6f72f840efe7b9dc7214b0113180299e59f
|
7
|
+
data.tar.gz: 5cd2b8c3675fd5fa84676c00d75ce2872dbc193ab4f55fc01283450c5bc3ad3774c80156b712332db467585baa8e3913064f5c14095102eb2bb979b572e1e51e
|
data/CHANGELOG.md
CHANGED
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
|
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
|
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
|
-
|
6
|
-
|
7
|
-
|
8
|
-
-
|
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
|
-
|
12
|
-
- '**/*.md'
|
13
|
-
- '**/*.markdown'
|
26
|
+
<<: *markdown_excludes
|
14
27
|
|
15
28
|
Layout/TrailingBlankLines:
|
16
|
-
|
17
|
-
- '**/*.md'
|
18
|
-
- '**/*.markdown'
|
29
|
+
<<: *markdown_excludes
|
19
30
|
|
20
31
|
Layout/TrailingEmptyLines:
|
21
|
-
|
22
|
-
- '**/*.md'
|
23
|
-
- '**/*.markdown'
|
32
|
+
<<: *markdown_excludes
|
24
33
|
|
25
34
|
Layout/EmptyLineBetweenDefs:
|
26
|
-
|
27
|
-
- '**/*.md'
|
28
|
-
- '**/*.markdown'
|
35
|
+
<<: *markdown_excludes
|
29
36
|
|
30
37
|
Lint/DuplicateRequire:
|
31
|
-
|
32
|
-
- '**/*.md'
|
33
|
-
- '**/*.markdown'
|
38
|
+
<<: *markdown_excludes
|
34
39
|
|
35
40
|
Lint/DuplicateMethods:
|
36
|
-
|
37
|
-
- '**/*.md'
|
38
|
-
- '**/*.markdown'
|
41
|
+
<<: *markdown_excludes
|
39
42
|
|
40
43
|
Lint/RedundantCopDisableDirective:
|
41
|
-
|
42
|
-
- '**/*.md'
|
43
|
-
- '**/*.markdown'
|
44
|
+
<<: *markdown_excludes
|
44
45
|
|
45
46
|
Lint/RedundantCopEnableDirective:
|
46
|
-
|
47
|
-
- '**/*.md'
|
48
|
-
- '**/*.markdown'
|
47
|
+
<<: *markdown_excludes
|
49
48
|
|
50
49
|
Lint/RedundantRequireStatement:
|
51
|
-
|
52
|
-
- '**/*.md'
|
53
|
-
- '**/*.markdown'
|
50
|
+
<<: *markdown_excludes
|
54
51
|
|
55
52
|
Lint/UnusedMethodArgument:
|
56
|
-
|
57
|
-
- '**/*.md'
|
58
|
-
- '**/*.markdown'
|
53
|
+
<<: *markdown_excludes
|
59
54
|
|
60
55
|
Lint/UnusedBlockArgument:
|
61
|
-
|
62
|
-
- '**/*.md'
|
63
|
-
- '**/*.markdown'
|
56
|
+
<<: *markdown_excludes
|
64
57
|
|
65
58
|
Lint/UselessAssignment:
|
66
|
-
|
67
|
-
- '**/*.md'
|
68
|
-
- '**/*.markdown'
|
59
|
+
<<: *markdown_excludes
|
69
60
|
|
70
61
|
Lint/UselessMethodDefinition:
|
71
|
-
|
72
|
-
- '**/*.md'
|
73
|
-
- '**/*.markdown'
|
62
|
+
<<: *markdown_excludes
|
74
63
|
|
75
64
|
Lint/UselessAccessModifier:
|
76
|
-
|
77
|
-
- '**/*.md'
|
78
|
-
- '**/*.markdown'
|
65
|
+
<<: *markdown_excludes
|
79
66
|
|
80
67
|
Lint/Void:
|
81
|
-
|
82
|
-
- '**/*.md'
|
83
|
-
- '**/*.markdown'
|
68
|
+
<<: *markdown_excludes
|
84
69
|
|
85
70
|
Naming/FileName:
|
86
|
-
|
87
|
-
- '**/*.md'
|
88
|
-
- '**/*.markdown'
|
71
|
+
<<: *markdown_excludes
|
89
72
|
|
90
73
|
Style/AsciiComments:
|
91
|
-
|
92
|
-
- '**/*.md'
|
93
|
-
- '**/*.markdown'
|
74
|
+
<<: *markdown_excludes
|
94
75
|
|
95
76
|
Style/Documentation:
|
96
|
-
|
97
|
-
- '**/*.md'
|
98
|
-
- '**/*.markdown'
|
77
|
+
<<: *markdown_excludes
|
99
78
|
|
100
79
|
Style/CommentAnnotation:
|
101
|
-
|
102
|
-
- '**/*.md'
|
103
|
-
- '**/*.markdown'
|
80
|
+
<<: *markdown_excludes
|
104
81
|
|
105
82
|
Style/FrozenStringLiteralComment:
|
106
|
-
|
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
|
42
|
+
def restore_and_save!(file)
|
43
43
|
contents = File.read(file)
|
44
|
-
|
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
|
-
#
|
6
|
-
#
|
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.
|
68
|
+
RuboCop::Markdown::Preprocess.restore_and_save!(file)
|
80
69
|
end
|
81
70
|
|
82
|
-
super
|
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
|
102
|
+
super
|
100
103
|
end
|
101
104
|
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.
|
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:
|
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.
|
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.
|
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
|
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
|
91
|
-
changelog_uri: https://github.com/rubocop
|
92
|
-
documentation_uri: https://github.com/rubocop
|
93
|
-
homepage_uri: https://github.com/rubocop
|
94
|
-
source_code_uri: http://github.com/rubocop
|
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.
|
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.
|