Skip to content

Commit db17107

Browse files
committed
wip
1 parent e55c22f commit db17107

30 files changed

Lines changed: 809 additions & 104 deletions

.github/workflows/lint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,6 @@ jobs:
8989
bundle update
9090
bundle exec standardrb -r "rubocop-md"
9191
bundle exec erb_lint --lint-all
92+
bundle exec yard-lint
9293
env:
9394
RAILS_VERSION: '~> 8'

.yard-lint.yml

Lines changed: 296 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,296 @@
1+
# YARD-Lint Configuration
2+
# See https://github.com/mensfeld/yard-lint for documentation
3+
4+
# Global settings for all validators
5+
AllValidators:
6+
# YARD command-line options (applied to all validators by default)
7+
YardOptions: []
8+
9+
# Global file exclusion patterns
10+
Exclude:
11+
- '\.git'
12+
- 'vendor/**/*'
13+
- 'node_modules/**/*'
14+
- 'spec/**/*'
15+
- 'test/**/*'
16+
- 'test_engine/**/*'
17+
- 'performance/**/*'
18+
- 'lib/docs/**/*'
19+
- 'lib/generators/**/*'
20+
21+
# Exit code behavior (error, warning, convention, never)
22+
FailOnSeverity: warning
23+
24+
# Minimum documentation coverage percentage (0-100)
25+
# Fails if coverage is below this threshold
26+
# MinCoverage: 80.0
27+
28+
# Diff mode settings
29+
DiffMode:
30+
# Default base ref for --diff (auto-detects main/master if not specified)
31+
DefaultBaseRef: ~
32+
33+
# Documentation validators
34+
Documentation/UndocumentedObjects:
35+
Description: 'Checks for classes, modules, and methods without documentation.'
36+
Enabled: true
37+
Severity: warning
38+
ExcludedMethods:
39+
- 'initialize/0' # Exclude parameter-less initialize
40+
- '/^_/' # Exclude private methods (by convention)
41+
42+
Documentation/UndocumentedMethodArguments:
43+
Description: 'Checks for method parameters without @param tags.'
44+
Enabled: true
45+
Severity: warning
46+
47+
Documentation/UndocumentedBooleanMethods:
48+
Description: 'Checks that question mark methods document their boolean return.'
49+
Enabled: true
50+
Severity: warning
51+
52+
Documentation/UndocumentedOptions:
53+
Description: 'Detects methods with options hash parameters but no @option tags.'
54+
Enabled: true
55+
Severity: warning
56+
57+
Documentation/MarkdownSyntax:
58+
Description: 'Detects common markdown syntax errors in documentation.'
59+
Enabled: true
60+
Severity: warning
61+
62+
Documentation/EmptyCommentLine:
63+
Description: 'Detects empty comment lines at the start or end of documentation blocks.'
64+
Enabled: true
65+
Severity: convention
66+
EnabledPatterns:
67+
Leading: true
68+
Trailing: true
69+
70+
Documentation/BlankLineBeforeDefinition:
71+
Description: 'Detects blank lines between YARD documentation and method definition.'
72+
Enabled: true
73+
Severity: convention
74+
OrphanedSeverity: convention
75+
EnabledPatterns:
76+
SingleBlankLine: true
77+
OrphanedDocs: true
78+
79+
# Tags validators
80+
Tags/Order:
81+
Description: 'Enforces consistent ordering of YARD tags.'
82+
Enabled: true
83+
Severity: convention
84+
EnforcedOrder:
85+
- param
86+
- option
87+
- yield
88+
- yieldparam
89+
- yieldreturn
90+
- return
91+
- raise
92+
- see
93+
- example
94+
- note
95+
- todo
96+
97+
Tags/InvalidTypes:
98+
Description: 'Validates type definitions in @param, @return, @option tags.'
99+
Enabled: true
100+
Severity: warning
101+
ValidatedTags:
102+
- param
103+
- option
104+
- return
105+
106+
Tags/TypeSyntax:
107+
Description: 'Validates YARD type syntax using YARD parser.'
108+
Enabled: true
109+
Severity: warning
110+
ValidatedTags:
111+
- param
112+
- option
113+
- return
114+
- yieldreturn
115+
116+
Tags/MeaninglessTag:
117+
Description: 'Detects @param/@option tags on classes, modules, or constants.'
118+
Enabled: true
119+
Severity: warning
120+
CheckedTags:
121+
- param
122+
- option
123+
InvalidObjectTypes:
124+
- class
125+
- module
126+
- constant
127+
128+
Tags/CollectionType:
129+
Description: 'Validates Hash collection syntax consistency.'
130+
Enabled: true
131+
Severity: convention
132+
EnforcedStyle: long # 'long' for Hash{K => V} (YARD standard), 'short' for {K => V}
133+
ValidatedTags:
134+
- param
135+
- option
136+
- return
137+
- yieldreturn
138+
139+
Tags/TagTypePosition:
140+
Description: 'Validates type annotation position in tags.'
141+
Enabled: true
142+
Severity: convention
143+
CheckedTags:
144+
- param
145+
- option
146+
# EnforcedStyle: 'type_after_name' (YARD standard: @param name [Type])
147+
# or 'type_first' (@param [Type] name)
148+
EnforcedStyle: type_after_name
149+
150+
Tags/ApiTags:
151+
Description: 'Enforces @api tags on public objects.'
152+
Enabled: false # Opt-in validator
153+
Severity: warning
154+
AllowedApis:
155+
- public
156+
- private
157+
- internal
158+
159+
Tags/OptionTags:
160+
Description: 'Requires @option tags for methods with options parameters.'
161+
Enabled: true
162+
Severity: warning
163+
YardOptions: []
164+
165+
Tags/ExampleSyntax:
166+
Description: 'Validates Ruby syntax in @example tags.'
167+
Enabled: true
168+
Severity: warning
169+
170+
Tags/RedundantParamDescription:
171+
Description: 'Detects meaningless parameter descriptions that add no value.'
172+
Enabled: true
173+
Severity: convention
174+
CheckedTags:
175+
- param
176+
- option
177+
Articles:
178+
- The
179+
- the
180+
- A
181+
- a
182+
- An
183+
- an
184+
MaxRedundantWords: 6
185+
GenericTerms:
186+
- object
187+
- instance
188+
- value
189+
- data
190+
- item
191+
- element
192+
EnabledPatterns:
193+
ArticleParam: true
194+
PossessiveParam: true
195+
TypeRestatement: true
196+
ParamToVerb: true
197+
IdPattern: true
198+
DirectionalDate: true
199+
TypeGeneric: true
200+
201+
Tags/InformalNotation:
202+
Description: 'Detects informal tag notation patterns like "Note:" instead of @note.'
203+
Enabled: true
204+
Severity: warning
205+
CaseSensitive: false
206+
RequireStartOfLine: true
207+
Patterns:
208+
Note: '@note'
209+
Todo: '@todo'
210+
TODO: '@todo'
211+
FIXME: '@todo'
212+
See: '@see'
213+
See also: '@see'
214+
Warning: '@deprecated'
215+
Deprecated: '@deprecated'
216+
Author: '@author'
217+
Version: '@version'
218+
Since: '@since'
219+
Returns: '@return'
220+
Raises: '@raise'
221+
Example: '@example'
222+
223+
Tags/NonAsciiType:
224+
Description: 'Detects non-ASCII characters in type annotations.'
225+
Enabled: true
226+
Severity: warning
227+
ValidatedTags:
228+
- param
229+
- option
230+
- return
231+
- yieldreturn
232+
- yieldparam
233+
234+
Tags/TagGroupSeparator:
235+
Description: 'Enforces blank line separators between different YARD tag groups.'
236+
Enabled: false # Opt-in validator
237+
Severity: convention
238+
TagGroups:
239+
param: [param, option]
240+
return: [return]
241+
error: [raise, throws]
242+
example: [example]
243+
meta: [see, note, todo, deprecated, since, version, api]
244+
yield: [yield, yieldparam, yieldreturn]
245+
RequireAfterDescription: false
246+
247+
Tags/ForbiddenTags:
248+
Description: 'Detects forbidden tag and type combinations.'
249+
Enabled: false # Opt-in validator
250+
Severity: convention
251+
ForbiddenPatterns: []
252+
# Example patterns:
253+
# - Tag: return
254+
# Types:
255+
# - void
256+
# - Tag: param
257+
# Types:
258+
# - Object
259+
# - Tag: api # Forbids @api tag entirely (no Types = any occurrence)
260+
261+
# Warnings validators - catches YARD parser errors
262+
Warnings/UnknownTag:
263+
Description: 'Detects unknown YARD tags.'
264+
Enabled: true
265+
Severity: error
266+
267+
Warnings/UnknownDirective:
268+
Description: 'Detects unknown YARD directives.'
269+
Enabled: true
270+
Severity: error
271+
272+
Warnings/InvalidTagFormat:
273+
Description: 'Detects malformed tag syntax.'
274+
Enabled: true
275+
Severity: error
276+
277+
Warnings/InvalidDirectiveFormat:
278+
Description: 'Detects malformed directive syntax.'
279+
Enabled: true
280+
Severity: error
281+
282+
Warnings/DuplicatedParameterName:
283+
Description: 'Detects duplicate @param tags.'
284+
Enabled: true
285+
Severity: error
286+
287+
Warnings/UnknownParameterName:
288+
Description: 'Detects @param tags for non-existent parameters.'
289+
Enabled: true
290+
Severity: error
291+
292+
# Semantic validators
293+
Semantic/AbstractMethods:
294+
Description: 'Ensures @abstract methods do not have real implementations.'
295+
Enabled: true
296+
Severity: warning

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ group :development, :test do
4747
gem "warning"
4848
gem "yard-activesupport-concern", "< 1"
4949
gem "yard", "< 1"
50+
gem "yard-lint", "~> 1"
5051
end

Gemfile.lock

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ GEM
184184
matrix (0.4.3)
185185
method_source (1.1.0)
186186
mini_mime (1.1.5)
187-
mini_portile2 (2.8.9)
188187
minitest (6.0.2)
189188
drb (~> 2.0)
190189
prism (~> 1.5)
@@ -199,9 +198,6 @@ GEM
199198
net-smtp (0.5.1)
200199
net-protocol
201200
nio4r (2.7.5)
202-
nokogiri (1.19.1)
203-
mini_portile2 (~> 2.8.2)
204-
racc (~> 1.4)
205201
nokogiri (1.19.1-aarch64-linux-gnu)
206202
racc (~> 1.4)
207203
nokogiri (1.19.1-aarch64-linux-musl)
@@ -413,6 +409,9 @@ GEM
413409
yard (0.9.38)
414410
yard-activesupport-concern (0.0.1)
415411
yard (>= 0.8)
412+
yard-lint (1.4.0)
413+
yard (~> 0.9)
414+
zeitwerk (~> 2.6)
416415
zeitwerk (2.7.4)
417416

418417
PLATFORMS
@@ -464,6 +463,7 @@ DEPENDENCIES
464463
warning
465464
yard (< 1)
466465
yard-activesupport-concern (< 1)
466+
yard-lint (~> 1)
467467

468468
CHECKSUMS
469469
action_text-trix (2.1.16) sha256=f645a2c21821b8449fd1d6770708f4031c91a2eedf9ef476e9be93c64e703a8a
@@ -529,15 +529,13 @@ CHECKSUMS
529529
matrix (0.4.3) sha256=a0d5ab7ddcc1973ff690ab361b67f359acbb16958d1dc072b8b956a286564c5b
530530
method_source (1.1.0) sha256=181301c9c45b731b4769bc81e8860e72f9161ad7d66dd99103c9ab84f560f5c5
531531
mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef
532-
mini_portile2 (2.8.9) sha256=0cd7c7f824e010c072e33f68bc02d85a00aeb6fce05bb4819c03dfd3c140c289
533532
minitest (6.0.2) sha256=db6e57956f6ecc6134683b4c87467d6dd792323c7f0eea7b93f66bd284adbc3d
534533
minitest-mock (5.27.0) sha256=7040ed7185417a966920987eaa6eaf1be4ea1fc5b25bb03ff4703f98564a55b0
535534
net-imap (0.6.2) sha256=08caacad486853c61676cca0c0c47df93db02abc4a8239a8b67eb0981428acc6
536535
net-pop (0.1.2) sha256=848b4e982013c15b2f0382792268763b748cce91c9e91e36b0f27ed26420dff3
537536
net-protocol (0.2.2) sha256=aa73e0cba6a125369de9837b8d8ef82a61849360eba0521900e2c3713aa162a8
538537
net-smtp (0.5.1) sha256=ed96a0af63c524fceb4b29b0d352195c30d82dd916a42f03c62a3a70e5b70736
539538
nio4r (2.7.5) sha256=6c90168e48fb5f8e768419c93abb94ba2b892a1d0602cb06eef16d8b7df1dca1
540-
nokogiri (1.19.1) sha256=598b327f36df0b172abd57b68b18979a6e14219353bca87180c31a51a00d5ad3
541539
nokogiri (1.19.1-aarch64-linux-gnu) sha256=cfdb0eafd9a554a88f12ebcc688d2b9005f9fce42b00b970e3dc199587b27f32
542540
nokogiri (1.19.1-aarch64-linux-musl) sha256=1e2150ab43c3b373aba76cd1190af7b9e92103564063e48c474f7600923620b5
543541
nokogiri (1.19.1-arm-linux-gnu) sha256=0a39ed59abe3bf279fab9dd4c6db6fe8af01af0608f6e1f08b8ffa4e5d407fa3
@@ -627,6 +625,7 @@ CHECKSUMS
627625
xpath (3.2.0) sha256=6dfda79d91bb3b949b947ecc5919f042ef2f399b904013eb3ef6d20dd3a4082e
628626
yard (0.9.38) sha256=721fb82afb10532aa49860655f6cc2eaa7130889df291b052e1e6b268283010f
629627
yard-activesupport-concern (0.0.1) sha256=be790cb0efc23e2e87677063598ac8b743586154657bbd9655a7f03ce78390ef
628+
yard-lint (1.4.0) sha256=7dd88fbb08fd77cb840bea899d58812817b36d92291b5693dd0eeb3af9f91f0f
630629
zeitwerk (2.7.4) sha256=2bef90f356bdafe9a6c2bd32bcd804f83a4f9b8bc27f3600fff051eb3edcec8b
631630

632631
RUBY VERSION

0 commit comments

Comments
 (0)