Add yard config and linter

This commit is contained in:
James Smith committed 2025-11-14 19:43:38 +00:00
1 parent b98b258164
commit 524365cac1
4 files changed
+187

No files matched your search

+3
View File
@@ -71,3 +71,6 @@ dump.rdb
# Ignore schema file, it's database-dependent and Manyfold shouldn't be
db/schema.rb
.yardoc
doc
+175
View File
@@ -0,0 +1,175 @@
# YARD-Lint Configuration
# See https://github.com/mensfeld/yard-lint for documentation
# Global settings for all validators
AllValidators:
# YARD command-line options (applied to all validators by default)
YardOptions:
# - --private
# - --protected
# Global file exclusion patterns
Exclude:
- '\.git'
- 'vendor/**/*'
- 'node_modules/**/*'
- 'spec/**/*'
- 'test/**/*'
- 'config/db/**/*'
# Exit code behavior (error, warning, convention, never)
FailOnSeverity: warning
# Minimum documentation coverage percentage (0-100)
# Fails if coverage is below this threshold
# MinCoverage: 80.0
# Diff mode settings
DiffMode:
# Default base ref for --diff (auto-detects main/master if not specified)
DefaultBaseRef: ~
# Documentation validators
Documentation/UndocumentedObjects:
Description: 'Checks for classes, modules, and methods without documentation.'
Enabled: true
Severity: warning
ExcludedMethods:
- 'initialize/0' # Exclude parameter-less initialize
- '/^_/' # Exclude private methods (by convention)
Documentation/UndocumentedMethodArguments:
Description: 'Checks for method parameters without @param tags.'
Enabled: true
Severity: warning
Documentation/UndocumentedBooleanMethods:
Description: 'Checks that question mark methods document their boolean return.'
Enabled: true
Severity: warning
Documentation/UndocumentedOptions:
Description: 'Detects methods with options hash parameters but no @option tags.'
Enabled: true
Severity: warning
Documentation/MarkdownSyntax:
Description: 'Detects common markdown syntax errors in documentation.'
Enabled: true
Severity: warning
# Tags validators
Tags/Order:
Description: 'Enforces consistent ordering of YARD tags.'
Enabled: true
Severity: convention
EnforcedOrder:
- param
- option
- return
- raise
- example
Tags/InvalidTypes:
Description: 'Validates type definitions in @param, @return, @option tags.'
Enabled: true
Severity: warning
ValidatedTags:
- param
- option
- return
Tags/TypeSyntax:
Description: 'Validates YARD type syntax using YARD parser.'
Enabled: true
Severity: warning
ValidatedTags:
- param
- option
- return
- yieldreturn
Tags/MeaninglessTag:
Description: 'Detects @param/@option tags on classes, modules, or constants.'
Enabled: true
Severity: warning
CheckedTags:
- param
- option
InvalidObjectTypes:
- class
- module
- constant
Tags/CollectionType:
Description: 'Validates Hash collection syntax consistency.'
Enabled: true
Severity: convention
EnforcedStyle: long # 'long' for Hash{K => V} (YARD standard), 'short' for {K => V}
ValidatedTags:
- param
- option
- return
- yieldreturn
Tags/TagTypePosition:
Description: 'Validates type annotation position in tags.'
Enabled: true
Severity: convention
CheckedTags:
- param
- option
# EnforcedStyle: 'type_after_name' (YARD standard: @param name [Type])
# or 'type_first' (@param [Type] name)
EnforcedStyle: type_after_name
Tags/ApiTags:
Description: 'Enforces @api tags on public objects.'
Enabled: false # Opt-in validator
Severity: warning
AllowedApis:
- public
- private
- internal
Tags/OptionTags:
Description: 'Requires @option tags for methods with options parameters.'
Enabled: true
Severity: warning
# Warnings validators - catches YARD parser errors
Warnings/UnknownTag:
Description: 'Detects unknown YARD tags.'
Enabled: true
Severity: error
Warnings/UnknownDirective:
Description: 'Detects unknown YARD directives.'
Enabled: true
Severity: error
Warnings/InvalidTagFormat:
Description: 'Detects malformed tag syntax.'
Enabled: true
Severity: error
Warnings/InvalidDirectiveFormat:
Description: 'Detects malformed directive syntax.'
Enabled: true
Severity: error
Warnings/DuplicatedParameterName:
Description: 'Detects duplicate @param tags.'
Enabled: true
Severity: error
Warnings/UnknownParameterName:
Description: 'Detects @param tags for non-existent parameters.'
Enabled: true
Severity: error
# Semantic validators
Semantic/AbstractMethods:
Description: 'Ensures @abstract methods do not have real implementations.'
Enabled: true
Severity: warning
+2
View File
@@ -217,3 +217,5 @@ gem "csv", "~> 3.3"
gem "arel_extensions", "~> 2.3"
gem "assimp-ffi", git: "https://github.com/Kerilk/assimp-ruby.git"
gem "yard-lint", "~> 1.2", group: :development
+7
View File
@@ -924,6 +924,10 @@ GEM
activerecord (>= 7.0)
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.37)
yard-lint (1.2.3)
yard (~> 0.9)
zeitwerk (~> 2.6)
zeitwerk (2.7.3)
zxcvbn (0.1.10)
@@ -1055,6 +1059,7 @@ DEPENDENCIES
web-console (~> 4.1)
webmock (~> 3.26)
with_model (~> 2.2)
yard-lint (~> 1.2)
CHECKSUMS
actioncable (8.0.2.1) sha256=6f1cb20db39fba28a93569e8d5dab42b2749d7ddd4baebb5bbecd4217e49d6a2
@@ -1397,6 +1402,8 @@ CHECKSUMS
websocket-extensions (0.1.5) sha256=1c6ba63092cda343eb53fc657110c71c754c56484aad42578495227d717a8241
with_model (2.2.0) sha256=eb0f498752391917e8c0a990951a343756bb89df2d12190faa5915a3fd99277e
xpath (3.2.0) sha256=6dfda79d91bb3b949b947ecc5919f042ef2f399b904013eb3ef6d20dd3a4082e
yard (0.9.37) sha256=a6e910399e78e613f80ba9add9ba7c394b1a935f083cccbef82903a3d2a26992
yard-lint (1.2.3) sha256=d34b963d6dfa71417fc8dbd3a87743f730780bd94f1abba08290d12e97ce5554
zeitwerk (2.7.3) sha256=b2e86b4a9b57d26ba68a15230dcc7fe6f040f06831ce64417b0621ad96ba3e85
zxcvbn (0.1.10) sha256=46e49a7cadcaab543b0073715341607ed99ffcacfc96d6f883bf1bfefaf0aaa5