Skip to content

Commit 47674c6

Browse files
committed
Replace yardstick and yard-junk with yard-lint for docs
Removed yardstick and yard-junk dependencies, configuration, and tasks in favor of using yard-lint for documentation linting and coverage enforcement. Updated documentation, Rakefile, CI workflow, and Gemfile accordingly. This simplifies documentation quality checks and unifies the workflow around yard-lint.
1 parent 86e0b88 commit 47674c6

9 files changed

Lines changed: 23 additions & 174 deletions

File tree

.claude/commands/document.md

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,46 +14,11 @@ Format YARD comments:
1414
bundle exec rake yard:format
1515
```
1616

17-
Verify 100% documentation coverage:
18-
```bash
19-
bundle exec rake verify_measurements
20-
```
21-
2217
Check for documentation quality issues:
2318
```bash
24-
bundle exec rake yard:junk
25-
```
26-
27-
Generate coverage report:
28-
```bash
29-
bundle exec rake yardstick_measure
19+
bundle exec yard-lint lib/
3020
```
3121

32-
## Configuration
33-
34-
Requires `.yardstick.yml` in project root with 100% threshold:
35-
```yaml
36-
threshold: 100
37-
rules:
38-
ApiTag::Presence: { enabled: true }
39-
ApiTag::Inclusion: { enabled: true }
40-
ApiTag::ProtectedMethod: { enabled: true }
41-
ApiTag::PrivateMethod: { enabled: true }
42-
ExampleTag: { enabled: true }
43-
ReturnTag: { enabled: true }
44-
Summary::Presence: { enabled: true }
45-
Summary::Delimiter: { enabled: true }
46-
```
47-
48-
## Coverage Report
49-
50-
After running measurement, check detailed line-by-line issues:
51-
```bash
52-
cat measurements/report.txt
53-
```
54-
55-
Report shows specific file, line number, method, and documentation issues that need fixing.
56-
5722
## Documentation Standards
5823

5924
### Required Tags
@@ -87,7 +52,7 @@ Report shows specific file, line number, method, and documentation issues that n
8752
# result # => expected_output
8853
#
8954
# @param name [Type] Description
90-
# @param other [Type] Other description
55+
# @param other [Type] Other description
9156
#
9257
# @return [Type] Description
9358
#
@@ -102,4 +67,4 @@ end
10267
Documentation verification is included in the quality assurance pipeline:
10368
```bash
10469
bundle exec rake qa
105-
```
70+
```

.claude/docs/yard.md

Lines changed: 10 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,7 @@ Every piece of public and private code must be documented. Documentation serves
2929

3030
## YARD Configuration
3131

32-
Create a `.yardstick.yml` file in your project root with 100% coverage requirements:
33-
34-
```yaml
35-
threshold: 100
36-
rules:
37-
ApiTag::Presence:
38-
enabled: true
39-
ApiTag::Inclusion:
40-
enabled: true
41-
ApiTag::ProtectedMethod:
42-
enabled: true
43-
ApiTag::PrivateMethod:
44-
enabled: true
45-
ExampleTag:
46-
enabled: true
47-
ReturnTag:
48-
enabled: true
49-
Summary::Presence:
50-
enabled: true
51-
Summary::Length:
52-
enabled: false
53-
Summary::Delimiter:
54-
enabled: true
55-
Summary::SingleLine:
56-
enabled: false
57-
```
32+
The configuration file is located at `.yard-lint.yml` in the root of the project.
5833

5934
## Basic Documentation Structure
6035

@@ -460,64 +435,26 @@ end
460435

461436
## Quality Enforcement
462437

463-
Our project enforces 100% documentation coverage using the `yardstick` gem and maintains documentation quality with the `yard:junk` task. This ensures that all code is thoroughly documented, maintainable, and easy for developers to use.
438+
This project uses `yard-lint` to enforce documentation standards and coverage.
464439

465440
### How it Works
466441

467-
1. **Configuration**: A `.yardstick.yml` file in the project root sets the documentation coverage threshold to 100% and defines specific documentation rules.
468-
469-
2. **Measurement**: The `yardstick_measure` Rake task measures the current documentation coverage against the configured rules. Run it using:
442+
1. **Configuration**: A `.yard-lint.yml` file in the project root defines the rules, severity, and coverage requirements.
443+
2. **Linting**: Run `yard-lint` to check for documentation issues.
470444

471445
```bash
472-
bundle exec rake yardstick_measure
446+
bundle exec yard-lint lib/
473447
```
474448

475-
This task generates a detailed report in `measurements/report.txt` that lists all documentation issues that need to be addressed.
449+
This command will output any documentation issues found.
476450

477-
3. **Verification**: The `verify_measurements` Rake task checks if the coverage meets the 100% threshold. Run it using:
451+
3. **Rake Integration**: A Rake task is provided for convenience.
478452

479453
```bash
480-
bundle exec rake verify_measurements
454+
bundle exec rake yard:lint
481455
```
482456

483-
This task will fail if coverage is below 100%, displaying the current coverage percentage and indicating that documentation improvements are needed.
484-
485-
4. **Review Report**: Always check the contents of `measurements/report.txt` after running measurement tasks. This file contains specific details about:
486-
- Missing method documentation
487-
- Incomplete parameter descriptions
488-
- Missing return value documentation
489-
- Missing examples
490-
- Incorrect API tags
491-
492-
Each line in the report shows the file, line number, method, and specific issue that needs to be addressed to achieve 100% documentation compliance.
493-
494-
### Rake Integration
495-
496-
The `Rakefile` integrates `yardstick` into our development workflow. The `qa` task, which runs a full suite of tests and checks, includes the documentation verification step.
497-
498-
```ruby
499-
# Rakefile
500-
require 'yardstick/rake/measurement'
501-
require 'yardstick/rake/verify'
502-
503-
yardstick_options = YAML.load_file('.yardstick.yml')
504-
505-
Yardstick::Rake::Measurement.new(:yardstick_measure, yardstick_options)
506-
Yardstick::Rake::Verify.new
507-
508-
desc 'Test, lint and perform security and documentation audits'
509-
task qa: %w[spec rubocop yard:junk verify_measurements bundle:audit]
510-
```
511-
512-
### CI Integration
513-
514-
Continuous Integration (CI) automatically enforces our documentation standard on every commit by running:
515-
516-
```bash
517-
bundle exec rake verify_measurements
518-
```
519-
520-
This prevents any code with incomplete documentation from being merged.
457+
4. **CI Integration**: The CI pipeline runs `yard-lint` on every commit to ensure that all code is well-documented.
521458

522459
## Best Practices
523460

@@ -600,3 +537,4 @@ For complex examples, use proper formatting:
600537
```
601538

602539
This documentation standard ensures that your Ruby projects maintain professional-quality documentation that supports both development and maintenance activities while providing excellent IDE integration and user experience.
540+

.github/workflows/main.yml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Run RuboCop
3636
run: bundle exec rake rubocop
3737

38-
yard_junk:
38+
yard_lint:
3939
runs-on: ubuntu-latest
4040
name: Validate YARD documentation
4141
steps:
@@ -44,20 +44,8 @@ jobs:
4444
uses: ruby/setup-ruby@v1
4545
with:
4646
bundler-cache: true
47-
- name: Run yard:junk
48-
run: bundle exec rake yard:junk
49-
50-
yardstick:
51-
runs-on: ubuntu-latest
52-
name: Measure YARD documentation
53-
steps:
54-
- uses: actions/checkout@v4
55-
- name: Set up Ruby
56-
uses: ruby/setup-ruby@v1
57-
with:
58-
bundler-cache: true
59-
- name: Run verify_measurements
60-
run: bundle exec rake verify_measurements
47+
- name: Run yard-lint
48+
run: bundle exec yard-lint lib/
6149

6250
bundle_audit:
6351
runs-on: ubuntu-latest

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
# secret environment variables
1414
.env
1515

16-
# yardstick report
17-
measurements/report.txt
18-
1916
# log files
2017
*.log
2118

.yardstick.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

Gemfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,5 @@ group :development do
3434
gem 'steep', '~> 1.10'
3535
gem 'typeprof', '~> 0.30'
3636
gem 'yard', '~> 0.9'
37-
gem 'yard-junk', '~> 0.0'
3837
gem 'yard-lint', '~> 1.3'
39-
gem 'yardstick', '~> 0.9'
4038
end

Gemfile.lock

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ GEM
2626
ansi (1.5.0)
2727
ast (2.4.3)
2828
awesome_print (1.9.2)
29-
backports (3.25.1)
3029
base64 (0.3.0)
3130
benchmark (0.4.1)
3231
bigdecimal (3.2.3)
@@ -278,16 +277,9 @@ GEM
278277
unicode-emoji (4.1.0)
279278
uri (1.0.3)
280279
yard (0.9.37)
281-
yard-junk (0.0.10)
282-
backports (>= 3.18)
283-
ostruct
284-
rainbow
285-
yard
286280
yard-lint (1.3.0)
287281
yard (~> 0.9)
288282
zeitwerk (~> 2.6)
289-
yardstick (0.9.9)
290-
yard (~> 0.8, >= 0.8.7.2)
291283
zeitwerk (2.7.3)
292284

293285
PLATFORMS
@@ -333,9 +325,7 @@ DEPENDENCIES
333325
steep (~> 1.10)
334326
typeprof (~> 0.30)
335327
yard (~> 0.9)
336-
yard-junk (~> 0.0)
337328
yard-lint (~> 1.3)
338-
yardstick (~> 0.9)
339329

340330
BUNDLED WITH
341331
2.7.0

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,9 @@ rake rubocop # Run RuboCop
185185
rake rubocop:autocorrect # Autocorrect RuboCop offenses (only when it's safe)
186186
rake rubocop:autocorrect_all # Autocorrect RuboCop offenses (safe and unsafe)
187187
rake spec # Run RSpec code examples
188-
rake verify_measurements # Verify that yardstick coverage is at least 100%
189188
rake yard # Generate YARD Documentation
190189
rake yard:format # Format YARD documentation
191-
rake yard:junk # Check the junk in your YARD Documentation
192-
rake yardstick_measure # Measure docs in lib/**/*.rb with yardstick
190+
rake yard:lint # Lint YARD documentation
193191
```
194192

195193
### 🧪 Type checking

Rakefile

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,11 @@ require 'rspec/core/rake_task'
77
require 'rubocop/rake_task'
88
require 'yaml'
99
require 'yard/rake/yardoc_task'
10-
require 'yard-junk/rake'
11-
require 'yardstick/rake/measurement'
12-
require 'yardstick/rake/verify'
13-
14-
yardstick_options = YAML.load_file('.yardstick.yml')
1510

1611
Bundler::Audit::Task.new
1712
RSpec::Core::RakeTask.new(:spec)
1813
RuboCop::RakeTask.new
1914
YARD::Rake::YardocTask.new
20-
YardJunk::Rake.define_task
21-
Yardstick::Rake::Measurement.new(:yardstick_measure, yardstick_options)
22-
Yardstick::Rake::Verify.new(:verify_measurements, yardstick_options)
2315

2416
task default: %i[spec rubocop]
2517

@@ -37,7 +29,7 @@ task :coverage do
3729
end
3830

3931
desc 'Test, lint and perform security and documentation audits'
40-
task qa: %w[spec rubocop yard:junk verify_measurements bundle:audit]
32+
task qa: %w[spec rubocop yard:lint bundle:audit]
4133

4234
namespace :yard do
4335
desc 'Format YARD documentation'
@@ -95,6 +87,11 @@ namespace :yard do
9587
puts
9688
puts 'Done!'
9789
end
90+
91+
desc 'Lint YARD documentation'
92+
task :lint do
93+
system 'bundle exec yard-lint lib/'
94+
end
9895
end
9996

10097
namespace :examples do

0 commit comments

Comments
 (0)