yard-lint 1.0.0 → 1.2.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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +77 -0
  3. data/README.md +160 -268
  4. data/bin/yard-lint +100 -8
  5. data/lib/yard/lint/command_cache.rb +17 -1
  6. data/lib/yard/lint/config.rb +20 -2
  7. data/lib/yard/lint/config_generator.rb +200 -0
  8. data/lib/yard/lint/ext/irb_notifier_shim.rb +95 -0
  9. data/lib/yard/lint/git.rb +125 -0
  10. data/lib/yard/lint/results/aggregate.rb +22 -2
  11. data/lib/yard/lint/runner.rb +4 -3
  12. data/lib/yard/lint/stats_calculator.rb +157 -0
  13. data/lib/yard/lint/validators/base.rb +36 -0
  14. data/lib/yard/lint/validators/documentation/markdown_syntax/config.rb +20 -0
  15. data/lib/yard/lint/validators/documentation/markdown_syntax/messages_builder.rb +44 -0
  16. data/lib/yard/lint/validators/documentation/markdown_syntax/parser.rb +53 -0
  17. data/lib/yard/lint/validators/documentation/markdown_syntax/result.rb +25 -0
  18. data/lib/yard/lint/validators/documentation/markdown_syntax/validator.rb +38 -0
  19. data/lib/yard/lint/validators/documentation/markdown_syntax.rb +37 -0
  20. data/lib/yard/lint/validators/documentation/undocumented_boolean_methods.rb +26 -1
  21. data/lib/yard/lint/validators/documentation/undocumented_method_arguments.rb +26 -1
  22. data/lib/yard/lint/validators/documentation/undocumented_objects.rb +131 -2
  23. data/lib/yard/lint/validators/documentation/undocumented_options/config.rb +20 -0
  24. data/lib/yard/lint/validators/documentation/undocumented_options/parser.rb +53 -0
  25. data/lib/yard/lint/validators/documentation/undocumented_options/result.rb +29 -0
  26. data/lib/yard/lint/validators/documentation/undocumented_options/validator.rb +38 -0
  27. data/lib/yard/lint/validators/documentation/undocumented_options.rb +40 -0
  28. data/lib/yard/lint/validators/semantic/abstract_methods.rb +31 -1
  29. data/lib/yard/lint/validators/tags/api_tags.rb +34 -1
  30. data/lib/yard/lint/validators/tags/collection_type/config.rb +2 -1
  31. data/lib/yard/lint/validators/tags/collection_type/messages_builder.rb +40 -11
  32. data/lib/yard/lint/validators/tags/collection_type/parser.rb +6 -5
  33. data/lib/yard/lint/validators/tags/collection_type/validator.rb +26 -7
  34. data/lib/yard/lint/validators/tags/collection_type.rb +38 -2
  35. data/lib/yard/lint/validators/tags/example_syntax/config.rb +20 -0
  36. data/lib/yard/lint/validators/tags/example_syntax/messages_builder.rb +28 -0
  37. data/lib/yard/lint/validators/tags/example_syntax/parser.rb +79 -0
  38. data/lib/yard/lint/validators/tags/example_syntax/result.rb +42 -0
  39. data/lib/yard/lint/validators/tags/example_syntax/validator.rb +88 -0
  40. data/lib/yard/lint/validators/tags/example_syntax.rb +42 -0
  41. data/lib/yard/lint/validators/tags/invalid_types/validator.rb +2 -2
  42. data/lib/yard/lint/validators/tags/invalid_types.rb +25 -1
  43. data/lib/yard/lint/validators/tags/meaningless_tag/validator.rb +2 -4
  44. data/lib/yard/lint/validators/tags/meaningless_tag.rb +31 -3
  45. data/lib/yard/lint/validators/tags/option_tags/validator.rb +7 -1
  46. data/lib/yard/lint/validators/tags/option_tags.rb +26 -1
  47. data/lib/yard/lint/validators/tags/order.rb +25 -1
  48. data/lib/yard/lint/validators/tags/redundant_param_description/config.rb +33 -0
  49. data/lib/yard/lint/validators/tags/redundant_param_description/messages_builder.rb +61 -0
  50. data/lib/yard/lint/validators/tags/redundant_param_description/parser.rb +67 -0
  51. data/lib/yard/lint/validators/tags/redundant_param_description/result.rb +25 -0
  52. data/lib/yard/lint/validators/tags/redundant_param_description/validator.rb +148 -0
  53. data/lib/yard/lint/validators/tags/redundant_param_description.rb +168 -0
  54. data/lib/yard/lint/validators/tags/tag_type_position/validator.rb +2 -4
  55. data/lib/yard/lint/validators/tags/tag_type_position.rb +39 -2
  56. data/lib/yard/lint/validators/tags/type_syntax.rb +26 -2
  57. data/lib/yard/lint/validators/warnings/duplicated_parameter_name.rb +26 -1
  58. data/lib/yard/lint/validators/warnings/invalid_directive_format.rb +26 -1
  59. data/lib/yard/lint/validators/warnings/invalid_tag_format.rb +25 -1
  60. data/lib/yard/lint/validators/warnings/unknown_directive.rb +26 -1
  61. data/lib/yard/lint/validators/warnings/unknown_parameter_name.rb +23 -1
  62. data/lib/yard/lint/validators/warnings/unknown_tag.rb +26 -1
  63. data/lib/yard/lint/version.rb +1 -1
  64. data/lib/yard/lint.rb +38 -2
  65. data/lib/yard-lint.rb +5 -0
  66. metadata +28 -1
@@ -0,0 +1,168 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Yard
4
+ module Lint
5
+ module Validators
6
+ # Tags validators - validate YARD tag quality and consistency
7
+ module Tags
8
+ # RedundantParamDescription validator
9
+ #
10
+ # Detects parameter descriptions that add no meaningful information beyond
11
+ # what's already obvious from the parameter name and type. This validator
12
+ # helps maintain high-quality documentation by flagging descriptions that
13
+ # should either be expanded with meaningful details or removed entirely.
14
+ #
15
+ # ## Why This Matters
16
+ #
17
+ # Documentation is most valuable when AI assistants and human developers
18
+ # can trust it. Redundant descriptions like `@param user [User] The user`
19
+ # create noise without adding value, training both humans and AI to ignore
20
+ # parameter documentation. Better to have no description (letting the type
21
+ # speak for itself) than a redundant one.
22
+ #
23
+ # @example Redundant - Article + param name (will be flagged)
24
+ # # @param appointment [Appointment] The appointment
25
+ # # @param user [User] the user
26
+ # def process(appointment, user)
27
+ # end
28
+ #
29
+ # @example Redundant - Possessive form (will be flagged)
30
+ # # @param appointment [Appointment] The event's appointment
31
+ # def schedule(appointment)
32
+ # end
33
+ #
34
+ # @example Redundant - Type restatement (will be flagged)
35
+ # # @param user [User] User object
36
+ # # @param value [Integer] Integer value
37
+ # def update(user, value)
38
+ # end
39
+ #
40
+ # @example Redundant - Parameter to verb pattern (will be flagged)
41
+ # # @param payments [Array] Payments to count
42
+ # # @param user [User] User to notify
43
+ # def process(payments, user)
44
+ # end
45
+ #
46
+ # @example Redundant - ID pattern (will be flagged)
47
+ # # @param treatment_id [String] ID of the treatment
48
+ # # @param uuid [String] Unique identifier for the list
49
+ # def find(treatment_id, uuid)
50
+ # end
51
+ #
52
+ # @example Redundant - Directional date (will be flagged)
53
+ # # @param from [Date] from this date
54
+ # # @param till [Date] till this date
55
+ # def filter(from, till)
56
+ # end
57
+ #
58
+ # @example Redundant - Type + generic term (will be flagged)
59
+ # # @param payment [Payment] Payment object
60
+ # # @param data [Hash] Hash data
61
+ # def process(payment, data)
62
+ # end
63
+ #
64
+ # @example Good - No description (type is self-explanatory)
65
+ # # @param appointment [Appointment]
66
+ # # @param user [User]
67
+ # def process(appointment, user)
68
+ # end
69
+ #
70
+ # @example Good - Long, meaningful descriptions with context
71
+ # # @param date [Date, nil] the date that can describe the event starting information or nil if event did not yet start
72
+ # # @param user [User] the user who initiated the request and will receive notifications
73
+ # # @param data [Hash] configuration options for the API endpoint including timeout and retry settings
74
+ # def configure(date, user, data)
75
+ # end
76
+ #
77
+ # @example Good - Short but adds value beyond param name
78
+ # # @param count [Integer] maximum number of retries before giving up
79
+ # # @param timeout [Integer] seconds to wait before timing out the connection
80
+ # # @param enabled [Boolean] whether the feature is enabled for this account
81
+ # def setup(count, timeout, enabled)
82
+ # end
83
+ #
84
+ # @example Good - Starts similar but continues with valuable info
85
+ # # @param user [User] the current user, or guest if not authenticated
86
+ # # @param data [Hash] the request payload containing user preferences
87
+ # # @param id [String] unique identifier used for tracking across systems
88
+ # def track(user, data, id)
89
+ # end
90
+ #
91
+ # ## Configuration
92
+ #
93
+ # The validator is highly configurable to match your project's needs:
94
+ #
95
+ # Tags/RedundantParamDescription:
96
+ # Description: 'Detects meaningless parameter descriptions.'
97
+ # Enabled: true
98
+ # Severity: convention
99
+ # CheckedTags:
100
+ # - param
101
+ # - option
102
+ # # Articles that trigger the article_param pattern
103
+ # Articles:
104
+ # - The
105
+ # - the
106
+ # - A
107
+ # - a
108
+ # - An
109
+ # - an
110
+ # # Maximum word count for redundant descriptions (longer descriptions are never flagged)
111
+ # MaxRedundantWords: 6
112
+ # # Generic terms that trigger the type_generic pattern
113
+ # GenericTerms:
114
+ # - object
115
+ # - instance
116
+ # - value
117
+ # - data
118
+ # - item
119
+ # - element
120
+ # # Pattern toggles (enable/disable specific detection patterns)
121
+ # EnabledPatterns:
122
+ # ArticleParam: true # "The user", "the appointment"
123
+ # PossessiveParam: true # "The event's appointment"
124
+ # TypeRestatement: true # "User object", "Appointment"
125
+ # ParamToVerb: true # "Payments to count"
126
+ # IdPattern: true # "ID of the treatment" for *_id params
127
+ # DirectionalDate: true # "from this date" for from/to/till
128
+ # TypeGeneric: true # "Payment object", "Hash data"
129
+ #
130
+ # ## Pattern Types
131
+ #
132
+ # The validator detects 7 different redundancy patterns:
133
+ #
134
+ # 1. **ArticleParam**: `"The user"`, `"the appointment"` - Article + parameter name
135
+ # 2. **PossessiveParam**: `"The event's appointment"` - Possessive form + parameter name
136
+ # 3. **TypeRestatement**: `"User object"`, `"Appointment"` - Just repeats the type
137
+ # 4. **ParamToVerb**: `"Payments to count"` - Parameter name + "to" + verb
138
+ # 5. **IdPattern**: `"ID of the treatment"` - For `_id` or `_uuid` suffixed parameters
139
+ # 6. **DirectionalDate**: `"from this date"` - For `from`, `to`, `till` parameters
140
+ # 7. **TypeGeneric**: `"Payment object"` - Type + generic term like "object", "instance"
141
+ #
142
+ # You can disable individual patterns while keeping others enabled.
143
+ #
144
+ # ## False Positive Prevention
145
+ #
146
+ # The validator uses multiple strategies to prevent false positives:
147
+ #
148
+ # 1. **Word count threshold**: Descriptions longer than `MaxRedundantWords` (default: 6)
149
+ # are never flagged, even if they start with a redundant pattern
150
+ # 2. **EXACT pattern matching**: Only flags complete matches, not partial/prefix matches
151
+ # 3. **Configurable patterns**: Disable patterns that don't work for your codebase
152
+ #
153
+ # This means `"the date that can describe the event starting information"` (9 words)
154
+ # will never be flagged, even though it starts with "the date".
155
+ #
156
+ # ## Disabling
157
+ #
158
+ # To disable this validator:
159
+ #
160
+ # Tags/RedundantParamDescription:
161
+ # Enabled: false
162
+ #
163
+ module RedundantParamDescription
164
+ end
165
+ end
166
+ end
167
+ end
168
+ end
@@ -94,15 +94,13 @@ module Yard
94
94
 
95
95
  # @return [String] the enforced style ('type_after_name' (standard) or 'type_first')
96
96
  def enforced_style
97
- config.validator_config('Tags/TagTypePosition', 'EnforcedStyle') || 'type_after_name'
97
+ config_or_default('EnforcedStyle')
98
98
  end
99
99
 
100
100
  # Array of tag names to check, formatted for YARD query
101
101
  # @return [String] Ruby array literal string
102
102
  def checked_tags_array
103
- tags = config.validator_config(
104
- 'Tags/TagTypePosition', 'CheckedTags'
105
- ) || %w[param option]
103
+ tags = config_or_default('CheckedTags')
106
104
  "[#{tags.map { |t| "\"#{t}\"" }.join(',')}]"
107
105
  end
108
106
  end
@@ -4,8 +4,45 @@ module Yard
4
4
  module Lint
5
5
  module Validators
6
6
  module Tags
7
- # TagTypePosition validator module
8
- # Detects type annotations in incorrect position (after param name instead of before)
7
+ # TagTypePosition validator
8
+ #
9
+ # Ensures consistent type annotation positioning in YARD documentation tags.
10
+ # By default, it enforces YARD standard style where the type appears after
11
+ # the parameter name (`@param name [Type]`), but you can configure it to
12
+ # enforce `type_first` style if your team prefers that convention.
13
+ # This validator is enabled by default.
14
+ #
15
+ # @example Good - Type after parameter name (YARD standard)
16
+ # # @param name [String] the user's name
17
+ # # @param age [Integer] the user's age
18
+ # # @param options [Hash{Symbol => Object}] configuration options
19
+ # def create_user(name, age, options = {})
20
+ # end
21
+ #
22
+ # @example Bad - Type before parameter name (when using default style)
23
+ # # @param [String] name the user's name
24
+ # # @param [Integer] age the user's age
25
+ # def create_user(name, age)
26
+ # end
27
+ #
28
+ # ## Configuration
29
+ #
30
+ # To use type_first style instead:
31
+ #
32
+ # Tags/TagTypePosition:
33
+ # EnforcedStyle: type_first
34
+ #
35
+ # @example Good - When EnforcedStyle is type_first
36
+ # # @param [String] name the user's name
37
+ # # @param [Integer] age the user's age
38
+ # def create_user(name, age)
39
+ # end
40
+ #
41
+ # To disable this validator:
42
+ #
43
+ # Tags/TagTypePosition:
44
+ # Enabled: false
45
+ #
9
46
  module TagTypePosition
10
47
  end
11
48
  end
@@ -4,8 +4,32 @@ module Yard
4
4
  module Lint
5
5
  module Validators
6
6
  module Tags
7
- # TypeSyntax validator module
8
- # Validates YARD type syntax using YARD's TypesExplainer::Parser
7
+ # TypeSyntax validator
8
+ #
9
+ # Validates YARD type syntax using YARD's TypesExplainer::Parser. This
10
+ # validator ensures that type annotations can be properly parsed by YARD
11
+ # and follow YARD's type specification format. This validator is enabled
12
+ # by default.
13
+ #
14
+ # @example Bad - Invalid type syntax that YARD cannot parse
15
+ # # @param data [{String, Integer}] invalid hash syntax
16
+ # # @return [String]] extra closing bracket
17
+ # def process(data)
18
+ # end
19
+ #
20
+ # @example Good - Valid parseable YARD type syntax
21
+ # # @param data [Hash{String => Integer}] valid hash syntax
22
+ # # @return [String] correct bracket usage
23
+ # def process(data)
24
+ # end
25
+ #
26
+ # ## Configuration
27
+ #
28
+ # To disable this validator:
29
+ #
30
+ # Tags/TypeSyntax:
31
+ # Enabled: false
32
+ #
9
33
  module TypeSyntax
10
34
  end
11
35
  end
@@ -5,7 +5,32 @@ module Yard
5
5
  module Validators
6
6
  # Validators for checking YARD warnings
7
7
  module Warnings
8
- # DuplicatedParameterName validator module
8
+ # DuplicatedParameterName validator
9
+ #
10
+ # Detects duplicate `@param` tags for the same parameter name. If a parameter
11
+ # is documented multiple times, it's unclear which documentation is correct
12
+ # and can confuse both readers and YARD's parser. This validator is enabled
13
+ # by default.
14
+ #
15
+ # @example Bad - Duplicate @param tags
16
+ # # @param name [String] the name
17
+ # # @param name [Symbol] oops, documented again
18
+ # def process(name)
19
+ # end
20
+ #
21
+ # @example Good - Each parameter documented once
22
+ # # @param name [String] the name
23
+ # # @param age [Integer] the age
24
+ # def process(name, age)
25
+ # end
26
+ #
27
+ # ## Configuration
28
+ #
29
+ # To disable this validator:
30
+ #
31
+ # Warnings/DuplicatedParameterName:
32
+ # Enabled: false
33
+ #
9
34
  module DuplicatedParameterName
10
35
  end
11
36
  end
@@ -5,7 +5,32 @@ module Yard
5
5
  module Validators
6
6
  # Validators for checking YARD warnings
7
7
  module Warnings
8
- # InvalidDirectiveFormat validator module
8
+ # InvalidDirectiveFormat validator
9
+ #
10
+ # Detects malformed YARD directive syntax. Directives have specific format
11
+ # requirements (like `@!attribute [r] name` for read-only attributes), and
12
+ # this validator ensures those requirements are met. This validator is
13
+ # enabled by default.
14
+ #
15
+ # @example Bad - Malformed directive syntax
16
+ # # @!attribute name missing brackets
17
+ # # @!method [r] foo wrong format for method
18
+ # class User
19
+ # end
20
+ #
21
+ # @example Good - Correctly formatted directives
22
+ # # @!attribute [r] name
23
+ # # @!method foo(bar)
24
+ # class User
25
+ # end
26
+ #
27
+ # ## Configuration
28
+ #
29
+ # To disable this validator:
30
+ #
31
+ # Warnings/InvalidDirectiveFormat:
32
+ # Enabled: false
33
+ #
9
34
  module InvalidDirectiveFormat
10
35
  end
11
36
  end
@@ -5,7 +5,31 @@ module Yard
5
5
  module Validators
6
6
  # Validators for checking YARD warnings
7
7
  module Warnings
8
- # InvalidTagFormat validator module
8
+ # InvalidTagFormat validator
9
+ #
10
+ # Detects malformed YARD tag syntax. This validator checks that tags follow
11
+ # the correct format expected by YARD, such as proper spacing, brackets for
12
+ # types, and required components. This validator is enabled by default.
13
+ #
14
+ # @example Bad - Malformed tag syntax
15
+ # # @param name[String] missing space before type
16
+ # # @return [String the result missing closing bracket
17
+ # def process(name)
18
+ # end
19
+ #
20
+ # @example Good - Correctly formatted tags
21
+ # # @param name [String] the name
22
+ # # @return [String] the result
23
+ # def process(name)
24
+ # end
25
+ #
26
+ # ## Configuration
27
+ #
28
+ # To disable this validator:
29
+ #
30
+ # Warnings/InvalidTagFormat:
31
+ # Enabled: false
32
+ #
9
33
  module InvalidTagFormat
10
34
  end
11
35
  end
@@ -5,7 +5,32 @@ module Yard
5
5
  module Validators
6
6
  # Validators for checking YARD warnings
7
7
  module Warnings
8
- # UnknownDirective validator module
8
+ # UnknownDirective validator
9
+ #
10
+ # Detects usage of unrecognized YARD directives in documentation. Directives
11
+ # are special YARD commands (like `@!attribute`, `@!method`) that control
12
+ # documentation generation. This validator flags unknown directives that
13
+ # could indicate errors. This validator is enabled by default.
14
+ #
15
+ # @example Bad - Unknown or misspelled directive
16
+ # # @!attribute [r] name
17
+ # # @!method foo
18
+ # class User
19
+ # end
20
+ #
21
+ # @example Good - Standard YARD directives
22
+ # # @!attribute [r] name
23
+ # # @!method foo
24
+ # class User
25
+ # end
26
+ #
27
+ # ## Configuration
28
+ #
29
+ # To disable this validator:
30
+ #
31
+ # Warnings/UnknownDirective:
32
+ # Enabled: false
33
+ #
9
34
  module UnknownDirective
10
35
  end
11
36
  end
@@ -5,7 +5,29 @@ module Yard
5
5
  module Validators
6
6
  # Validators for checking YARD warnings
7
7
  module Warnings
8
- # UnknownParameterName validator module
8
+ # UnknownParameterName validator
9
+ #
10
+ # Detects `@param` tags that document parameters which don't exist in the
11
+ # method signature. This often occurs after refactoring when parameter names
12
+ # change but documentation isn't updated. This validator is enabled by default.
13
+ #
14
+ # @example Bad - @param documents non-existent parameter
15
+ # # @param old_name [String] this parameter doesn't exist anymore
16
+ # def process(new_name)
17
+ # end
18
+ #
19
+ # @example Good - @param matches actual parameters
20
+ # # @param new_name [String] the name to process
21
+ # def process(new_name)
22
+ # end
23
+ #
24
+ # ## Configuration
25
+ #
26
+ # To disable this validator:
27
+ #
28
+ # Warnings/UnknownParameterName:
29
+ # Enabled: false
30
+ #
9
31
  module UnknownParameterName
10
32
  end
11
33
  end
@@ -5,7 +5,32 @@ module Yard
5
5
  module Validators
6
6
  # Validators for checking YARD warnings
7
7
  module Warnings
8
- # UnknownTag validator module
8
+ # UnknownTag validator
9
+ #
10
+ # Detects usage of unrecognized YARD tags in documentation. This validator
11
+ # checks against YARD's standard tag set and flags any tags that YARD
12
+ # doesn't recognize, which could indicate typos or unsupported tags.
13
+ # This validator is enabled by default.
14
+ #
15
+ # @example Bad - Misspelled or non-existent tags
16
+ # # @param name [String] typo in param tag
17
+ # # @returns [String] should be @return not @returns
18
+ # def process(name)
19
+ # end
20
+ #
21
+ # @example Good - Standard YARD tags
22
+ # # @param name [String] the name
23
+ # # @return [String] the result
24
+ # def process(name)
25
+ # end
26
+ #
27
+ # ## Configuration
28
+ #
29
+ # To disable this validator:
30
+ #
31
+ # Warnings/UnknownTag:
32
+ # Enabled: false
33
+ #
9
34
  module UnknownTag
10
35
  end
11
36
  end
@@ -3,6 +3,6 @@
3
3
  module Yard
4
4
  module Lint
5
5
  # @return [String] version of the YARD Lint gem
6
- VERSION = '1.0.0'
6
+ VERSION = '1.2.0'
7
7
  end
8
8
  end
data/lib/yard/lint.rb CHANGED
@@ -19,10 +19,20 @@ module Yard
19
19
  # @param config_file [String, nil] path to config file
20
20
  # (auto-loads .yard-lint.yml if not specified)
21
21
  # @param progress [Boolean] show progress indicator (default: true for TTY)
22
+ # @param diff [Hash, nil] diff mode options
23
+ # - :mode [Symbol] one of :ref, :staged, :changed
24
+ # - :base_ref [String, nil] base ref for :ref mode (auto-detects main/master if nil)
22
25
  # @return [Yard::Lint::Result] result object with offenses
23
- def run(path:, config: nil, config_file: nil, progress: nil)
26
+ def run(path:, config: nil, config_file: nil, progress: nil, diff: nil)
24
27
  config ||= load_config(config_file)
25
- files = expand_path(path, config)
28
+
29
+ # Determine files to lint based on diff mode or normal path expansion
30
+ files = if diff
31
+ get_diff_files(diff, path, config)
32
+ else
33
+ expand_path(path, config)
34
+ end
35
+
26
36
  runner = Runner.new(files, config)
27
37
 
28
38
  # Enable progress by default if output is a TTY
@@ -45,6 +55,32 @@ module Yard
45
55
  end
46
56
  end
47
57
 
58
+ # Get files from git diff based on diff mode
59
+ # @param diff [Hash] diff mode options
60
+ # @param path [String, Array<String>] path or array of paths to filter within
61
+ # @param config [Yard::Lint::Config] configuration object
62
+ # @return [Array<String>] array of absolute file paths
63
+ def get_diff_files(diff, path, config)
64
+ # Get changed files from git based on mode
65
+ git_files = case diff[:mode]
66
+ when :ref
67
+ Git.changed_files(diff[:base_ref], path)
68
+ when :staged
69
+ Git.staged_files(path)
70
+ when :changed
71
+ Git.uncommitted_files(path)
72
+ else
73
+ raise ArgumentError, "Unknown diff mode: #{diff[:mode]}"
74
+ end
75
+
76
+ # Apply exclusion patterns
77
+ git_files.reject do |file|
78
+ config.exclude.any? do |pattern|
79
+ File.fnmatch(pattern, file, File::FNM_PATHNAME | File::FNM_EXTGLOB)
80
+ end
81
+ end
82
+ end
83
+
48
84
  # Expand path/glob patterns into an array of files
49
85
  # @param path [String, Array<String>] path or array of paths
50
86
  # @param config [Yard::Lint::Config] configuration object
data/lib/yard-lint.rb CHANGED
@@ -1,10 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Load IRB notifier shim before YARD to avoid IRB dependency in Ruby 3.5+
4
+ # This must be loaded before any YARD code is required
5
+ require_relative 'yard/lint/ext/irb_notifier_shim'
6
+
3
7
  require 'zeitwerk'
4
8
 
5
9
  # Setup Zeitwerk loader for gem
6
10
  loader = Zeitwerk::Loader.for_gem(warn_on_extra_files: false)
7
11
  loader.ignore(__FILE__)
12
+ loader.ignore("#{__dir__}/yard/lint/ext")
8
13
  loader.setup
9
14
 
10
15
  # Manually load the main module since it contains class-level methods
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-lint
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -60,9 +60,12 @@ files:
60
60
  - lib/yard/lint.rb
61
61
  - lib/yard/lint/command_cache.rb
62
62
  - lib/yard/lint/config.rb
63
+ - lib/yard/lint/config_generator.rb
63
64
  - lib/yard/lint/config_loader.rb
64
65
  - lib/yard/lint/errors.rb
66
+ - lib/yard/lint/ext/irb_notifier_shim.rb
65
67
  - lib/yard/lint/formatters/progress.rb
68
+ - lib/yard/lint/git.rb
66
69
  - lib/yard/lint/parsers/base.rb
67
70
  - lib/yard/lint/parsers/one_line_base.rb
68
71
  - lib/yard/lint/parsers/two_line_base.rb
@@ -70,8 +73,15 @@ files:
70
73
  - lib/yard/lint/results/aggregate.rb
71
74
  - lib/yard/lint/results/base.rb
72
75
  - lib/yard/lint/runner.rb
76
+ - lib/yard/lint/stats_calculator.rb
73
77
  - lib/yard/lint/validators/base.rb
74
78
  - lib/yard/lint/validators/config.rb
79
+ - lib/yard/lint/validators/documentation/markdown_syntax.rb
80
+ - lib/yard/lint/validators/documentation/markdown_syntax/config.rb
81
+ - lib/yard/lint/validators/documentation/markdown_syntax/messages_builder.rb
82
+ - lib/yard/lint/validators/documentation/markdown_syntax/parser.rb
83
+ - lib/yard/lint/validators/documentation/markdown_syntax/result.rb
84
+ - lib/yard/lint/validators/documentation/markdown_syntax/validator.rb
75
85
  - lib/yard/lint/validators/documentation/undocumented_boolean_methods.rb
76
86
  - lib/yard/lint/validators/documentation/undocumented_boolean_methods/config.rb
77
87
  - lib/yard/lint/validators/documentation/undocumented_boolean_methods/parser.rb
@@ -89,6 +99,11 @@ files:
89
99
  - lib/yard/lint/validators/documentation/undocumented_objects/parser.rb
90
100
  - lib/yard/lint/validators/documentation/undocumented_objects/result.rb
91
101
  - lib/yard/lint/validators/documentation/undocumented_objects/validator.rb
102
+ - lib/yard/lint/validators/documentation/undocumented_options.rb
103
+ - lib/yard/lint/validators/documentation/undocumented_options/config.rb
104
+ - lib/yard/lint/validators/documentation/undocumented_options/parser.rb
105
+ - lib/yard/lint/validators/documentation/undocumented_options/result.rb
106
+ - lib/yard/lint/validators/documentation/undocumented_options/validator.rb
92
107
  - lib/yard/lint/validators/semantic/abstract_methods.rb
93
108
  - lib/yard/lint/validators/semantic/abstract_methods/config.rb
94
109
  - lib/yard/lint/validators/semantic/abstract_methods/messages_builder.rb
@@ -107,6 +122,12 @@ files:
107
122
  - lib/yard/lint/validators/tags/collection_type/parser.rb
108
123
  - lib/yard/lint/validators/tags/collection_type/result.rb
109
124
  - lib/yard/lint/validators/tags/collection_type/validator.rb
125
+ - lib/yard/lint/validators/tags/example_syntax.rb
126
+ - lib/yard/lint/validators/tags/example_syntax/config.rb
127
+ - lib/yard/lint/validators/tags/example_syntax/messages_builder.rb
128
+ - lib/yard/lint/validators/tags/example_syntax/parser.rb
129
+ - lib/yard/lint/validators/tags/example_syntax/result.rb
130
+ - lib/yard/lint/validators/tags/example_syntax/validator.rb
110
131
  - lib/yard/lint/validators/tags/invalid_types.rb
111
132
  - lib/yard/lint/validators/tags/invalid_types/config.rb
112
133
  - lib/yard/lint/validators/tags/invalid_types/messages_builder.rb
@@ -131,6 +152,12 @@ files:
131
152
  - lib/yard/lint/validators/tags/order/parser.rb
132
153
  - lib/yard/lint/validators/tags/order/result.rb
133
154
  - lib/yard/lint/validators/tags/order/validator.rb
155
+ - lib/yard/lint/validators/tags/redundant_param_description.rb
156
+ - lib/yard/lint/validators/tags/redundant_param_description/config.rb
157
+ - lib/yard/lint/validators/tags/redundant_param_description/messages_builder.rb
158
+ - lib/yard/lint/validators/tags/redundant_param_description/parser.rb
159
+ - lib/yard/lint/validators/tags/redundant_param_description/result.rb
160
+ - lib/yard/lint/validators/tags/redundant_param_description/validator.rb
134
161
  - lib/yard/lint/validators/tags/tag_type_position.rb
135
162
  - lib/yard/lint/validators/tags/tag_type_position/config.rb
136
163
  - lib/yard/lint/validators/tags/tag_type_position/messages_builder.rb