Skip to content

Commit 815485c

Browse files
ci(config): Add readme-lint script to validate README files
- Introduce a new script `readme-lint` to ensure all README-* files have the same number of lines as README.md - Update `.php-cs-fixer.php` and `composer.json` to include the new linting script in the configuration - Enable checking for inconsistencies in README files as part of the development workflow
1 parent 179cbb1 commit 815485c

8 files changed

+41
-7
lines changed

.chglog/config.yml

+12-7
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,26 @@ options:
77
commits:
88
filters:
99
Type:
10+
- build
11+
# - chore
12+
- ci
13+
- docs
1014
- feat
1115
- fix
1216
- perf
1317
- refactor
14-
- docs
15-
- test
16-
- ci
1718
- revert
19+
- style
20+
- test
1821
commit_groups:
1922
title_maps:
23+
chore: Chores
2024
ci: CI
21-
# feat: Features
22-
# fix: Bug Fixes
23-
# perf: Performance Improvements
24-
# refactor: Code Refactoring
25+
feat: Features
26+
fix: Bug Fixes
27+
perf: Performance Improvements
28+
refactor: Code Refactoring
29+
test: Tests
2530
header:
2631
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
2732
pattern_maps:

.php-cs-fixer.php

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
->append(glob(__DIR__.'/{*.php,.*.php}', GLOB_BRACE))
4040
->append([
4141
__DIR__.'/composer-updater',
42+
__DIR__.'/readme-lint',
4243
])
4344
->notPath([
4445
'bootstrap/*',

README-ja.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# ai-commit
22

3+
[//]: # (https://looka.com)
34
[//]: # (<p align="center"><img src="resources/docs/logo.png" alt="logo" style="width: 62%; height: 62%;"></p>)
45
<p align="center"><img src="resources/docs/ai-commit-vhs.gif" alt="ai-commit-vhs"></p>
56

README-zh_CN.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# ai-commit
22

3+
[//]: # (https://looka.com)
34
[//]: # (<p align="center"><img src="resources/docs/logo.png" alt="logo" style="width: 62%; height: 62%;"></p>)
45
<p align="center"><img src="resources/docs/ai-commit-vhs.gif" alt="ai-commit-vhs"></p>
56

README-zh_TW.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# ai-commit
22

3+
[//]: # (https://looka.com)
34
[//]: # (<p align="center"><img src="resources/docs/logo.png" alt="logo" style="width: 62%; height: 62%;"></p>)
45
<p align="center"><img src="resources/docs/ai-commit-vhs.gif" alt="ai-commit-vhs"></p>
56

composer.json

+2
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
"@composer-validate",
163163
"@composer-unused",
164164
"@md-lint",
165+
"@readme-lint",
165166
"@lint",
166167
"@style-lint",
167168
"@test",
@@ -211,6 +212,7 @@
211212
],
212213
"psalm": "@php ./vendor/bin/psalm",
213214
"psalm-baseline": "@psalm --update-baseline",
215+
"readme-lint": "@php ./readme-lint --ansi -v",
214216
"rector": "@php ./vendor/bin/rector --ansi -v",
215217
"rector-dry-run": "@rector --dry-run",
216218
"release": "@php ./vendor/bin/monorepo-builder release --ansi -vvv",

readme-lint

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
declare(strict_types=1);
5+
6+
/**
7+
* This file is part of the guanguans/ai-commit.
8+
*
9+
* (c) guanguans <[email protected]>
10+
*
11+
* This source file is subject to the MIT license that is bundled.
12+
*/
13+
require __DIR__.'/vendor/autoload.php';
14+
15+
collect(glob('README-*.md'))->each(static function (string $file): void {
16+
if (count(file($file)) !== count(file('README.md'))) {
17+
echo "The file [$file] has a different number of lines than [README.md]\n";
18+
exit(1);
19+
}
20+
});
21+
22+
exit(0);

rector.php

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
__DIR__.'/tests',
7171
__DIR__.'/.*.php',
7272
__DIR__.'/*.php',
73+
__DIR__.'/readme-lint',
7374
]);
7475

7576
$rectorConfig->skip([

0 commit comments

Comments
 (0)