rdoc-markdown 0.6.0 → 0.7.0
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/.erb_lint.yml +40 -0
- data/.erb_linters/no_embedded_assets.rb +29 -0
- data/.erb_linters/non_raw_html.rb +29 -0
- data/.standard.yml +3 -0
- data/.yard-lint.yml +283 -0
- data/AGENTS.md +48 -0
- data/CHANGELOG.md +14 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +164 -34
- data/README.md +7 -0
- data/Rakefile +12 -8
- data/example/Bird.md +1 -1
- data/gemfiles/rdoc_head.gemfile +5 -0
- data/lib/markdown.rb +1 -0
- data/lib/rdoc/generator/markdown.rb +409 -239
- data/lib/rdoc/markdown/version.rb +4 -1
- data/mutant.yml +15 -0
- data/rdoc-markdown.gemspec +27 -25
- metadata +41 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b8e35102f73fbebb99a831ca7e2210b41c065177ae7c637e86cffb61094560b7
|
|
4
|
+
data.tar.gz: 44d35c36100b1488c2d5c5c689239b0d4ce6ae5f151fcc0ba3dec64f17cb97ac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c54de4099d5966da00719ef1fd7fafe9a9a15823d4e55e6b38489d32bacb366a9ee9b2ea1a8a85500bb8da29bd466bc00853cde0ad65c4f984e052652c35b52a
|
|
7
|
+
data.tar.gz: c08fbcf88edcd97e665def817f22d56113885a37b77ad471f26dfd72e6485912641018c3ab46261e0d019a58d24f007a2c8a480e166c8533432bf9a642500e8a
|
data/.erb_lint.yml
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
glob: "**/*.{md,markdown}.erb"
|
|
3
|
+
EnableDefaultLinters: false
|
|
4
|
+
linters:
|
|
5
|
+
ClosingErbTagIndent:
|
|
6
|
+
enabled: true
|
|
7
|
+
CommentSyntax:
|
|
8
|
+
enabled: true
|
|
9
|
+
ExtraNewline:
|
|
10
|
+
enabled: true
|
|
11
|
+
FinalNewline:
|
|
12
|
+
enabled: true
|
|
13
|
+
NoEmbeddedAssets:
|
|
14
|
+
enabled: true
|
|
15
|
+
NonRawHtml:
|
|
16
|
+
enabled: true
|
|
17
|
+
NoUnusedDisable:
|
|
18
|
+
enabled: true
|
|
19
|
+
ParserErrors:
|
|
20
|
+
enabled: true
|
|
21
|
+
RightTrim:
|
|
22
|
+
enabled: true
|
|
23
|
+
enforced_style: "-"
|
|
24
|
+
Rubocop:
|
|
25
|
+
enabled: true
|
|
26
|
+
only:
|
|
27
|
+
- Lint/Debugger
|
|
28
|
+
- Lint/DuplicateBranch
|
|
29
|
+
- Lint/DuplicateHashKey
|
|
30
|
+
- Lint/EmptyExpression
|
|
31
|
+
- Lint/SelfAssignment
|
|
32
|
+
- Security/Eval
|
|
33
|
+
rubocop_config:
|
|
34
|
+
AllCops:
|
|
35
|
+
TargetRubyVersion: 3.2
|
|
36
|
+
NewCops: enable
|
|
37
|
+
SpaceAroundErbTag:
|
|
38
|
+
enabled: true
|
|
39
|
+
TrailingWhitespace:
|
|
40
|
+
enabled: true
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ERBLint
|
|
4
|
+
module Linters
|
|
5
|
+
class NoEmbeddedAssets < Linter
|
|
6
|
+
include LinterRegistry
|
|
7
|
+
|
|
8
|
+
PATTERNS = [
|
|
9
|
+
[/(?:javascript_tag|javascript_include_tag|javascript_pack_tag|stylesheet_link_tag|stylesheet_pack_tag)\b/i,
|
|
10
|
+
"Avoid Rails JavaScript and stylesheet helpers in markdown ERB templates."],
|
|
11
|
+
[/\bcontent_tag\s*\(?\s*[:"'](?:script|style)\b/i,
|
|
12
|
+
"Avoid helper-generated `<script>` and `<style>` tags in markdown ERB templates."],
|
|
13
|
+
[/\btag\.(?:link|script|style)\b/i,
|
|
14
|
+
"Avoid helper-generated asset tags in markdown ERB templates."]
|
|
15
|
+
].freeze
|
|
16
|
+
|
|
17
|
+
def run(processed_source)
|
|
18
|
+
content = processed_source.file_content
|
|
19
|
+
|
|
20
|
+
PATTERNS.each do |pattern, message|
|
|
21
|
+
content.scan(pattern) do
|
|
22
|
+
match = Regexp.last_match
|
|
23
|
+
add_offense(processed_source.to_source_range(match.begin(0)...match.end(0)), message)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ERBLint
|
|
4
|
+
module Linters
|
|
5
|
+
class NonRawHtml < Linter
|
|
6
|
+
include LinterRegistry
|
|
7
|
+
|
|
8
|
+
HTML_PATTERN = /<!--.*?-->|<!DOCTYPE\b[^>]*>|<\/?[A-Za-z][A-Za-z0-9-]*(?=[\s>\/])[^<>]*\/?>/im
|
|
9
|
+
|
|
10
|
+
def run(processed_source)
|
|
11
|
+
content = processed_source.file_content
|
|
12
|
+
reported_lines = {}
|
|
13
|
+
|
|
14
|
+
content.scan(HTML_PATTERN) do
|
|
15
|
+
match = Regexp.last_match
|
|
16
|
+
source_range = processed_source.to_source_range(match.begin(0)...match.end(0))
|
|
17
|
+
line = source_range.line_range.first
|
|
18
|
+
next if reported_lines[line]
|
|
19
|
+
|
|
20
|
+
reported_lines[line] = true
|
|
21
|
+
add_offense(
|
|
22
|
+
source_range,
|
|
23
|
+
"Avoid raw HTML in markdown ERB templates. Generate markdown instead."
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
data/.standard.yml
ADDED
data/.yard-lint.yml
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
# YARD-Lint Configuration (Strict Mode)
|
|
2
|
+
# See https://github.com/mensfeld/yard-lint for documentation
|
|
3
|
+
|
|
4
|
+
AllValidators:
|
|
5
|
+
YardOptions:
|
|
6
|
+
- --private
|
|
7
|
+
- --protected
|
|
8
|
+
|
|
9
|
+
Exclude:
|
|
10
|
+
- '\.git'
|
|
11
|
+
- "vendor/**/*"
|
|
12
|
+
- "node_modules/**/*"
|
|
13
|
+
- "spec/**/*"
|
|
14
|
+
- "test/**/*"
|
|
15
|
+
- "tmp/**/*"
|
|
16
|
+
|
|
17
|
+
FailOnSeverity: error
|
|
18
|
+
MinCoverage: 100.0
|
|
19
|
+
|
|
20
|
+
DiffMode:
|
|
21
|
+
DefaultBaseRef: ~
|
|
22
|
+
|
|
23
|
+
Documentation/UndocumentedObjects:
|
|
24
|
+
Description: "Checks for classes, modules, and methods without documentation."
|
|
25
|
+
Enabled: true
|
|
26
|
+
Severity: error
|
|
27
|
+
ExcludedMethods:
|
|
28
|
+
- "initialize/0"
|
|
29
|
+
- "/^_/"
|
|
30
|
+
|
|
31
|
+
Documentation/UndocumentedMethodArguments:
|
|
32
|
+
Description: "Checks for method parameters without @param tags."
|
|
33
|
+
Enabled: true
|
|
34
|
+
Severity: error
|
|
35
|
+
|
|
36
|
+
Documentation/UndocumentedBooleanMethods:
|
|
37
|
+
Description: "Checks that question mark methods document their boolean return."
|
|
38
|
+
Enabled: true
|
|
39
|
+
Severity: error
|
|
40
|
+
|
|
41
|
+
Documentation/UndocumentedOptions:
|
|
42
|
+
Description: "Detects methods with options hash parameters but no @option tags."
|
|
43
|
+
Enabled: true
|
|
44
|
+
Severity: error
|
|
45
|
+
|
|
46
|
+
Documentation/MissingReturn:
|
|
47
|
+
Description: "Requires @return tags on all methods."
|
|
48
|
+
Enabled: true
|
|
49
|
+
Severity: error
|
|
50
|
+
ExcludedMethods:
|
|
51
|
+
- "initialize"
|
|
52
|
+
|
|
53
|
+
Documentation/MarkdownSyntax:
|
|
54
|
+
Description: "Detects common markdown syntax errors in documentation."
|
|
55
|
+
Enabled: true
|
|
56
|
+
Severity: error
|
|
57
|
+
|
|
58
|
+
Documentation/EmptyCommentLine:
|
|
59
|
+
Description: "Detects empty comment lines at the start or end of documentation blocks."
|
|
60
|
+
Enabled: true
|
|
61
|
+
Severity: error
|
|
62
|
+
EnabledPatterns:
|
|
63
|
+
Leading: true
|
|
64
|
+
Trailing: true
|
|
65
|
+
|
|
66
|
+
Documentation/BlankLineBeforeDefinition:
|
|
67
|
+
Description: "Detects blank lines between YARD documentation and method definition."
|
|
68
|
+
Enabled: true
|
|
69
|
+
Severity: error
|
|
70
|
+
OrphanedSeverity: error
|
|
71
|
+
EnabledPatterns:
|
|
72
|
+
SingleBlankLine: true
|
|
73
|
+
OrphanedDocs: true
|
|
74
|
+
|
|
75
|
+
Tags/Order:
|
|
76
|
+
Description: "Enforces consistent ordering of YARD tags."
|
|
77
|
+
Enabled: true
|
|
78
|
+
Severity: error
|
|
79
|
+
EnforcedOrder:
|
|
80
|
+
- param
|
|
81
|
+
- option
|
|
82
|
+
- yield
|
|
83
|
+
- yieldparam
|
|
84
|
+
- yieldreturn
|
|
85
|
+
- return
|
|
86
|
+
- raise
|
|
87
|
+
- see
|
|
88
|
+
- example
|
|
89
|
+
- note
|
|
90
|
+
- todo
|
|
91
|
+
|
|
92
|
+
Tags/InvalidTypes:
|
|
93
|
+
Description: "Validates type definitions in @param, @return, @option tags."
|
|
94
|
+
Enabled: true
|
|
95
|
+
Severity: error
|
|
96
|
+
ValidatedTags:
|
|
97
|
+
- param
|
|
98
|
+
- option
|
|
99
|
+
- return
|
|
100
|
+
|
|
101
|
+
Tags/TypeSyntax:
|
|
102
|
+
Description: "Validates YARD type syntax using YARD parser."
|
|
103
|
+
Enabled: true
|
|
104
|
+
Severity: error
|
|
105
|
+
ValidatedTags:
|
|
106
|
+
- param
|
|
107
|
+
- option
|
|
108
|
+
- return
|
|
109
|
+
- yieldreturn
|
|
110
|
+
|
|
111
|
+
Tags/MeaninglessTag:
|
|
112
|
+
Description: "Detects @param/@option tags on classes, modules, or constants."
|
|
113
|
+
Enabled: true
|
|
114
|
+
Severity: error
|
|
115
|
+
CheckedTags:
|
|
116
|
+
- param
|
|
117
|
+
- option
|
|
118
|
+
InvalidObjectTypes:
|
|
119
|
+
- class
|
|
120
|
+
- module
|
|
121
|
+
- constant
|
|
122
|
+
|
|
123
|
+
Tags/CollectionType:
|
|
124
|
+
Description: "Validates Hash collection syntax consistency."
|
|
125
|
+
Enabled: true
|
|
126
|
+
Severity: error
|
|
127
|
+
EnforcedStyle: long
|
|
128
|
+
ValidatedTags:
|
|
129
|
+
- param
|
|
130
|
+
- option
|
|
131
|
+
- return
|
|
132
|
+
- yieldreturn
|
|
133
|
+
|
|
134
|
+
Tags/TagTypePosition:
|
|
135
|
+
Description: "Validates type annotation position in tags."
|
|
136
|
+
Enabled: true
|
|
137
|
+
Severity: error
|
|
138
|
+
CheckedTags:
|
|
139
|
+
- param
|
|
140
|
+
- option
|
|
141
|
+
EnforcedStyle: type_after_name
|
|
142
|
+
|
|
143
|
+
Tags/ApiTags:
|
|
144
|
+
Description: "Enforces @api tags on public objects."
|
|
145
|
+
Enabled: false
|
|
146
|
+
Severity: error
|
|
147
|
+
AllowedApis:
|
|
148
|
+
- public
|
|
149
|
+
- private
|
|
150
|
+
- internal
|
|
151
|
+
|
|
152
|
+
Tags/OptionTags:
|
|
153
|
+
Description: "Requires @option tags for methods with options parameters."
|
|
154
|
+
Enabled: true
|
|
155
|
+
Severity: error
|
|
156
|
+
|
|
157
|
+
Tags/ExampleSyntax:
|
|
158
|
+
Description: "Validates Ruby syntax in @example tags."
|
|
159
|
+
Enabled: true
|
|
160
|
+
Severity: error
|
|
161
|
+
|
|
162
|
+
Tags/ExampleStyle:
|
|
163
|
+
Description: "Validates code style in @example tags using RuboCop/StandardRB."
|
|
164
|
+
Enabled: false
|
|
165
|
+
Severity: convention
|
|
166
|
+
|
|
167
|
+
Tags/RedundantParamDescription:
|
|
168
|
+
Description: "Detects meaningless parameter descriptions that add no value."
|
|
169
|
+
Enabled: true
|
|
170
|
+
Severity: error
|
|
171
|
+
CheckedTags:
|
|
172
|
+
- param
|
|
173
|
+
- option
|
|
174
|
+
Articles:
|
|
175
|
+
- The
|
|
176
|
+
- the
|
|
177
|
+
- A
|
|
178
|
+
- a
|
|
179
|
+
- An
|
|
180
|
+
- an
|
|
181
|
+
MaxRedundantWords: 6
|
|
182
|
+
GenericTerms:
|
|
183
|
+
- object
|
|
184
|
+
- instance
|
|
185
|
+
- value
|
|
186
|
+
- data
|
|
187
|
+
- item
|
|
188
|
+
- element
|
|
189
|
+
EnabledPatterns:
|
|
190
|
+
ArticleParam: true
|
|
191
|
+
PossessiveParam: true
|
|
192
|
+
TypeRestatement: true
|
|
193
|
+
ParamToVerb: true
|
|
194
|
+
IdPattern: true
|
|
195
|
+
DirectionalDate: true
|
|
196
|
+
TypeGeneric: true
|
|
197
|
+
|
|
198
|
+
Tags/InformalNotation:
|
|
199
|
+
Description: 'Detects informal tag notation patterns like "Note:" instead of @note.'
|
|
200
|
+
Enabled: true
|
|
201
|
+
Severity: error
|
|
202
|
+
CaseSensitive: false
|
|
203
|
+
RequireStartOfLine: true
|
|
204
|
+
Patterns:
|
|
205
|
+
Note: "@note"
|
|
206
|
+
Todo: "@todo"
|
|
207
|
+
TODO: "@todo"
|
|
208
|
+
FIXME: "@todo"
|
|
209
|
+
See: "@see"
|
|
210
|
+
See also: "@see"
|
|
211
|
+
Warning: "@deprecated"
|
|
212
|
+
Deprecated: "@deprecated"
|
|
213
|
+
Author: "@author"
|
|
214
|
+
Version: "@version"
|
|
215
|
+
Since: "@since"
|
|
216
|
+
Returns: "@return"
|
|
217
|
+
Raises: "@raise"
|
|
218
|
+
Example: "@example"
|
|
219
|
+
|
|
220
|
+
Tags/NonAsciiType:
|
|
221
|
+
Description: "Detects non-ASCII characters in type annotations."
|
|
222
|
+
Enabled: true
|
|
223
|
+
Severity: error
|
|
224
|
+
ValidatedTags:
|
|
225
|
+
- param
|
|
226
|
+
- option
|
|
227
|
+
- return
|
|
228
|
+
- yieldreturn
|
|
229
|
+
- yieldparam
|
|
230
|
+
|
|
231
|
+
Tags/TagGroupSeparator:
|
|
232
|
+
Description: "Enforces blank line separators between different YARD tag groups."
|
|
233
|
+
Enabled: false
|
|
234
|
+
Severity: error
|
|
235
|
+
TagGroups:
|
|
236
|
+
param: [param, option]
|
|
237
|
+
return: [return]
|
|
238
|
+
error: [raise, throws]
|
|
239
|
+
example: [example]
|
|
240
|
+
meta: [see, note, todo, deprecated, since, version, api]
|
|
241
|
+
yield: [yield, yieldparam, yieldreturn]
|
|
242
|
+
RequireAfterDescription: false
|
|
243
|
+
|
|
244
|
+
Tags/ForbiddenTags:
|
|
245
|
+
Description: "Detects forbidden tag and type combinations."
|
|
246
|
+
Enabled: false
|
|
247
|
+
Severity: error
|
|
248
|
+
ForbiddenPatterns: []
|
|
249
|
+
|
|
250
|
+
Warnings/UnknownTag:
|
|
251
|
+
Description: "Detects unknown YARD tags."
|
|
252
|
+
Enabled: true
|
|
253
|
+
Severity: error
|
|
254
|
+
|
|
255
|
+
Warnings/UnknownDirective:
|
|
256
|
+
Description: "Detects unknown YARD directives."
|
|
257
|
+
Enabled: true
|
|
258
|
+
Severity: error
|
|
259
|
+
|
|
260
|
+
Warnings/InvalidTagFormat:
|
|
261
|
+
Description: "Detects malformed tag syntax."
|
|
262
|
+
Enabled: true
|
|
263
|
+
Severity: error
|
|
264
|
+
|
|
265
|
+
Warnings/InvalidDirectiveFormat:
|
|
266
|
+
Description: "Detects malformed directive syntax."
|
|
267
|
+
Enabled: true
|
|
268
|
+
Severity: error
|
|
269
|
+
|
|
270
|
+
Warnings/DuplicatedParameterName:
|
|
271
|
+
Description: "Detects duplicate @param tags."
|
|
272
|
+
Enabled: true
|
|
273
|
+
Severity: error
|
|
274
|
+
|
|
275
|
+
Warnings/UnknownParameterName:
|
|
276
|
+
Description: "Detects @param tags for non-existent parameters."
|
|
277
|
+
Enabled: true
|
|
278
|
+
Severity: error
|
|
279
|
+
|
|
280
|
+
Semantic/AbstractMethods:
|
|
281
|
+
Description: "Ensures @abstract methods do not have real implementations."
|
|
282
|
+
Enabled: true
|
|
283
|
+
Severity: error
|
data/AGENTS.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
You are working in a Ruby project that uses mutation testing.
|
|
2
|
+
|
|
3
|
+
## Goal
|
|
4
|
+
|
|
5
|
+
Achieve 100% mutation coverage. Verify with:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
bundle exec mutant run
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
When iterating, prefer `--fail-fast` so you address one surviving
|
|
12
|
+
mutant at a time:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
bundle exec mutant run --fail-fast
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## When you find an alive mutation
|
|
19
|
+
|
|
20
|
+
Decide which bucket it falls into:
|
|
21
|
+
|
|
22
|
+
- **A) The code does too much** for what the tests ask for. The
|
|
23
|
+
surviving mutation reveals behavior that no test requires. The
|
|
24
|
+
fix is to simplify the implementation.
|
|
25
|
+
- **B) A test is missing.** The behavior is intentional but no test
|
|
26
|
+
observes it. The fix is to add a test.
|
|
27
|
+
|
|
28
|
+
Decide between A) and B) before changing anything. If unsure, ask
|
|
29
|
+
the user.
|
|
30
|
+
|
|
31
|
+
## Constraints
|
|
32
|
+
|
|
33
|
+
- You may not skip mutants by configuring mutant to ignore them.
|
|
34
|
+
No `expressions:` filters, no `coverage_criteria:` tweaks.
|
|
35
|
+
- You may not use `send` or `__send__` to invoke private methods
|
|
36
|
+
in tests just to satisfy mutant.
|
|
37
|
+
|
|
38
|
+
## Done
|
|
39
|
+
|
|
40
|
+
You are done when all of these are green and not reporting any issues:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
bundle exec rake test
|
|
44
|
+
bundle exec mutant run
|
|
45
|
+
bundle exec rake markdown:validate
|
|
46
|
+
bundle exec yard-lint
|
|
47
|
+
bundle exec erb:lint
|
|
48
|
+
```
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.7.0
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- Relax the development Bundler constraint to allow Bundler 4, and refresh the dependency lockfile with the newer toolchain.
|
|
9
|
+
- Huge refactoring done to template, powered by mutant testing mostly.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- SimpleCov test coverage reporting.
|
|
13
|
+
- Mutation testing coverage
|
|
14
|
+
- StandardRB was added
|
data/Gemfile
CHANGED
|
@@ -7,4 +7,13 @@ gemspec
|
|
|
7
7
|
|
|
8
8
|
gem "rake", "~> 13.0"
|
|
9
9
|
|
|
10
|
+
gem "erb_lint", require: false
|
|
10
11
|
gem "minitest", "~> 5.0"
|
|
12
|
+
gem "standard"
|
|
13
|
+
gem "yard-lint"
|
|
14
|
+
|
|
15
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.3")
|
|
16
|
+
gem "mutant"
|
|
17
|
+
gem "mutant-minitest"
|
|
18
|
+
gem "mutex_m"
|
|
19
|
+
end
|