yard-lint 1.4.0 → 1.5.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/.ruby-version +1 -1
- data/CHANGELOG.md +57 -3
- data/README.md +154 -529
- data/Rakefile +11 -8
- data/bin/yard-lint +64 -5
- data/lib/yard/lint/config.rb +4 -0
- data/lib/yard/lint/config_validator.rb +230 -0
- data/lib/yard/lint/errors.rb +6 -0
- data/lib/yard/lint/path_grouper.rb +70 -0
- data/lib/yard/lint/result_builder.rb +19 -5
- data/lib/yard/lint/results/base.rb +3 -3
- data/lib/yard/lint/templates/default_config.yml +17 -0
- data/lib/yard/lint/templates/strict_config.yml +17 -0
- data/lib/yard/lint/todo_generator.rb +261 -0
- data/lib/yard/lint/validators/base.rb +1 -1
- data/lib/yard/lint/validators/documentation/missing_return/config.rb +23 -0
- data/lib/yard/lint/validators/documentation/missing_return/messages_builder.rb +23 -0
- data/lib/yard/lint/validators/documentation/missing_return/parser.rb +128 -0
- data/lib/yard/lint/validators/documentation/missing_return/result.rb +25 -0
- data/lib/yard/lint/validators/documentation/missing_return/validator.rb +40 -0
- data/lib/yard/lint/validators/documentation/missing_return.rb +49 -0
- data/lib/yard/lint/validators/documentation/undocumented_boolean_methods/parser.rb +1 -1
- data/lib/yard/lint/validators/documentation/undocumented_method_arguments/parser.rb +1 -1
- data/lib/yard/lint/validators/documentation/undocumented_method_arguments/validator.rb +3 -0
- data/lib/yard/lint/validators/documentation/undocumented_objects/parser.rb +1 -1
- data/lib/yard/lint/validators/tags/collection_type/messages_builder.rb +8 -2
- data/lib/yard/lint/validators/tags/collection_type/validator.rb +33 -14
- data/lib/yard/lint/validators/tags/example_style/config.rb +33 -0
- data/lib/yard/lint/validators/tags/example_style/linter_detector.rb +71 -0
- data/lib/yard/lint/validators/tags/example_style/messages_builder.rb +29 -0
- data/lib/yard/lint/validators/tags/example_style/parser.rb +88 -0
- data/lib/yard/lint/validators/tags/example_style/result.rb +42 -0
- data/lib/yard/lint/validators/tags/example_style/rubocop_runner.rb +210 -0
- data/lib/yard/lint/validators/tags/example_style/validator.rb +87 -0
- data/lib/yard/lint/validators/tags/example_style.rb +61 -0
- data/lib/yard/lint/validators/tags/forbidden_tags.rb +2 -2
- data/lib/yard/lint/validators/tags/invalid_types/validator.rb +1 -1
- data/lib/yard/lint/validators/tags/tag_group_separator/parser.rb +1 -1
- data/lib/yard/lint/validators/tags/type_syntax/validator.rb +19 -0
- data/lib/yard/lint/validators/warnings/unknown_tag/parser.rb +1 -1
- data/lib/yard/lint/version.rb +1 -1
- data/mise.toml +2 -0
- data/package-lock.json +329 -0
- data/package.json +7 -0
- data/proxy_types +0 -0
- data/renovate.json +18 -1
- metadata +23 -3
- data/.coditsu/ci.yml +0 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d48c779583f09dd8c1f1be9406a8e7c1973d57fd97d6baeb84f2fbb7566ed64b
|
|
4
|
+
data.tar.gz: 1f632a44bc4efd7cf2e68f7b10e3f56f739807504957e4db9beca84ddc091f06
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6d808d23609be5a0427dec09dd8f6dc06a8e873b70627e4efcc2c73489d18ef1f298353fbd71f75e39acafec52a0bcf651daac34a33cdea8325f4691c95bdf24
|
|
7
|
+
data.tar.gz: 90314098d76b083ffc86cfa5f383c94e7c138e6ecf6980daf9c89296e3df0b66e4e90b7183135cf54a05c23c8564e2e6b52d2dcfa8c17309783aa93733d1c81a
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
4.0
|
|
1
|
+
4.0.2
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# YARD-Lint Changelog
|
|
2
2
|
|
|
3
|
+
## 1.5.0 (2026-04-02)
|
|
4
|
+
- **[Fix]** Skip `@!attribute` methods in `UndocumentedMethodArguments` validator (#115)
|
|
5
|
+
- Methods documented with `@!attribute` directive are attribute accessors whose setter parameter does not need explicit `@param` documentation, matching `attr_accessor` behavior
|
|
6
|
+
- **[Fix]** Extend `CollectionType` validator to enforce style for Array types, not just Hash (#114)
|
|
7
|
+
- YARD supports both long (`Array<String>`, `Array(String, Integer)`) and short (`<String>`, `(String, Integer)`) forms for Array collections
|
|
8
|
+
- The validator now detects and enforces the configured `EnforcedStyle` for Array angle bracket and tuple notation
|
|
9
|
+
- Correction suggestions in messages now cover Array types (e.g., `<String>` → `Array<String>` or vice versa)
|
|
10
|
+
- **[Fix]** Accept tuple (fixed-length array) types as valid YARD syntax in `InvalidTypes` validator (#113)
|
|
11
|
+
- YARD supports tuple notation like `(String, Integer)` for fixed-length arrays with typed positions
|
|
12
|
+
- The `InvalidTypes` validator's sanitize logic did not strip parentheses, causing tuple types to be incorrectly flagged as `InvalidTagType`
|
|
13
|
+
- **[Fix]** Accept symbol, string, and numeric literals as valid YARD types in `TypeSyntax` validator (#109)
|
|
14
|
+
- YARD accepts literal types like `:error`, `"read"`, `'write'`, `-1`, `2.5` in tags, but its `TypesExplainer::Parser` does not support them
|
|
15
|
+
- The `TypeSyntax` validator was using that parser, causing false positives for valid literal types
|
|
16
|
+
- Now skips literal types before passing them to the parser, using strict regexes that only match valid Ruby syntax
|
|
17
|
+
- Supports: simple symbols (`:foo`), predicate/bang/setter symbols (`:foo?`, `:save!`, `:name=`), quoted symbols (`:"content-type"`, `:'x-request-id'`), double and single-quoted strings (`"read"`, `'write'`), integers (`-1`, `0`, `1`), and floats (`1.0`, `-2.5`)
|
|
18
|
+
- **[Feature]** Add configuration validation to catch typos and invalid settings
|
|
19
|
+
- Validates validator names exist before processing files (prevents silent failures)
|
|
20
|
+
- Detects typos in severity levels (e.g., `erro` instead of `error`) with "did you mean" suggestions
|
|
21
|
+
- Validates boolean values for `Enabled` settings
|
|
22
|
+
- Validates global settings in `AllValidators` section (FailOnSeverity, MinCoverage, etc.)
|
|
23
|
+
- Provides helpful error messages pointing to valid options
|
|
24
|
+
- Fails fast with clear error messages instead of silently ignoring invalid configuration
|
|
25
|
+
- Catches common mistakes like using non-existent validator names (e.g., `UndocumentedMethod` instead of `Documentation/UndocumentedObjects`)
|
|
26
|
+
- **[Feature]** Add `Tags/ExampleStyle` validator for linting code examples with RuboCop/StandardRB (#74)
|
|
27
|
+
- Validates code style in `@example` tags using RuboCop or StandardRB
|
|
28
|
+
- Auto-detects RuboCop or StandardRB from project setup (checks for `.rubocop.yml`, `.standard.yml`, Gemfile, or Gemfile.lock)
|
|
29
|
+
- Respects project's `.rubocop.yml` or `.standard.yml` configuration
|
|
30
|
+
- Supports skip patterns for intentional "bad code" examples (e.g., `@example Bad code (skip-lint)`)
|
|
31
|
+
- Opt-in validator (disabled by default, requires RuboCop or StandardRB gem)
|
|
32
|
+
- Convention severity by default for style issues
|
|
33
|
+
- Automatically disables file-level cops irrelevant to code snippets (e.g., `Style/FrozenStringLiteralComment`, metrics cops)
|
|
34
|
+
- Gracefully degrades when no linter is available (no crashes, debug warning only)
|
|
35
|
+
- Ensures code examples follow the same style guidelines as your codebase for consistency
|
|
36
|
+
- Configurable linter selection (`Linter: auto`, `rubocop`, `standard`, or `none`)
|
|
37
|
+
- Supports inline RuboCop directives (e.g., `# rubocop:disable Style/StringLiterals`)
|
|
38
|
+
- **[Feature]** Add `--auto-gen-config` for incremental adoption on legacy codebases (#71)
|
|
39
|
+
- Generates `.yard-lint-todo.yml` with per-validator exclusions for all current violations
|
|
40
|
+
- Allows teams to adopt yard-lint without fixing all existing violations first
|
|
41
|
+
- New CLI flags:
|
|
42
|
+
- `--auto-gen-config`: Generate baseline configuration silencing existing violations
|
|
43
|
+
- `--regenerate-todo`: Regenerate todo file (overwrites existing)
|
|
44
|
+
- `--exclude-limit N`: Min files in directory before grouping into pattern (default: 15)
|
|
45
|
+
- Intelligent path grouping: converts many individual files into patterns (e.g., `lib/legacy/**/*`)
|
|
46
|
+
- Automatically updates `.yard-lint.yml` to inherit from `.yard-lint-todo.yml`
|
|
47
|
+
- Incremental workflow: remove exclusions from todo file to re-expose violations for fixing
|
|
48
|
+
- Use case: Enforce strict standards on new code while incrementally fixing legacy issues
|
|
49
|
+
- Use case: Generate baseline before CI/CD integration to prevent breaking existing builds
|
|
50
|
+
- Inspired by RuboCop's `--auto-gen-config` feature
|
|
51
|
+
- See README "Adopting YARD-Lint on Existing Projects" section for detailed usage
|
|
52
|
+
- **[Feature]** Add optional check for missing `@return` tags (#70, #72, @mensfeld)
|
|
53
|
+
- Enforces `@return` tag presence for all method definitions
|
|
54
|
+
- Excludes `initialize` methods by default (they typically don't need return documentation)
|
|
55
|
+
- Opt-in validator to help catch forgotten return value documentation
|
|
56
|
+
|
|
3
57
|
## 1.4.0 (2026-01-19)
|
|
4
58
|
- **[Fix]** Handle directive definitions depending on file load order (#65, @zaben903)
|
|
5
59
|
- **[CI]** Update Ruby 4.0 from preview2 to stable release as the default version
|
|
@@ -56,7 +110,7 @@
|
|
|
56
110
|
- Now matches patterns against both relative and absolute paths (similar to RuboCop's `PathUtil#match_path?`)
|
|
57
111
|
- Extracted `discover_ruby_files` method for better separation of concerns
|
|
58
112
|
- Added `determine_base_dir`, `excluded_file?`, `relative_path_from`, and `match_path?` helper methods
|
|
59
|
-
- Comprehensive integration tests in `
|
|
113
|
+
- Comprehensive integration tests in `test/integrations/global_exclusions_test.rb`
|
|
60
114
|
- **[Enhancement]** Make PATH argument optional, defaulting to current directory (like RuboCop)
|
|
61
115
|
- Running `yard-lint` without arguments now lints the current directory
|
|
62
116
|
- Maintains backward compatibility with explicit path arguments
|
|
@@ -183,9 +237,9 @@
|
|
|
183
237
|
- Ensures any documentation issue triggers exit code 1 for CI/CD pipelines
|
|
184
238
|
- Provides consistent behavior across all validation rules
|
|
185
239
|
- **[Fix]** Fix integration tests failing due to fixture files being filtered by global exclusions
|
|
186
|
-
- Added `test_config` helper in
|
|
240
|
+
- Added `test_config` helper in test_helper.rb that clears default exclusions for tests
|
|
187
241
|
- Updated all integration test files to use `test_config` instead of `Yard::Lint::Config.new`
|
|
188
|
-
- Prevents test fixtures in `
|
|
242
|
+
- Prevents test fixtures in `test/fixtures/` from being filtered out by `test/**/*` exclusion pattern
|
|
189
243
|
- Ensures integration tests can properly validate linter behavior on fixture files
|
|
190
244
|
- **[Fix]** Remove not needed `bin/` files.
|
|
191
245
|
|