yard-lint 1.4.0 → 1.5.1

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