Skip to content

Commit

Permalink
ci(config): Add readme-lint script to validate README files
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
ityaozm@gmail.com committed Nov 1, 2024
1 parent 179cbb1 commit 815485c
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 7 deletions.
19 changes: 12 additions & 7 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,26 @@ options:
commits:
filters:
Type:
- build
# - chore
- ci
- docs
- feat
- fix
- perf
- refactor
- docs
- test
- ci
- revert
- style
- test
commit_groups:
title_maps:
chore: Chores
ci: CI
# feat: Features
# fix: Bug Fixes
# perf: Performance Improvements
# refactor: Code Refactoring
feat: Features
fix: Bug Fixes
perf: Performance Improvements
refactor: Code Refactoring
test: Tests
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
Expand Down
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
->append(glob(__DIR__.'/{*.php,.*.php}', GLOB_BRACE))
->append([
__DIR__.'/composer-updater',
__DIR__.'/readme-lint',
])
->notPath([
'bootstrap/*',
Expand Down
1 change: 1 addition & 0 deletions README-ja.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# ai-commit

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

Expand Down
1 change: 1 addition & 0 deletions README-zh_CN.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# ai-commit

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

Expand Down
1 change: 1 addition & 0 deletions README-zh_TW.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# ai-commit

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

Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
"@composer-validate",
"@composer-unused",
"@md-lint",
"@readme-lint",
"@lint",
"@style-lint",
"@test",
Expand Down Expand Up @@ -211,6 +212,7 @@
],
"psalm": "@php ./vendor/bin/psalm",
"psalm-baseline": "@psalm --update-baseline",
"readme-lint": "@php ./readme-lint --ansi -v",
"rector": "@php ./vendor/bin/rector --ansi -v",
"rector-dry-run": "@rector --dry-run",
"release": "@php ./vendor/bin/monorepo-builder release --ansi -vvv",
Expand Down
22 changes: 22 additions & 0 deletions readme-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env php
<?php

declare(strict_types=1);

/**
* This file is part of the guanguans/ai-commit.
*
* (c) guanguans <ityaozm@gmail.com>
*
* This source file is subject to the MIT license that is bundled.
*/
require __DIR__.'/vendor/autoload.php';

collect(glob('README-*.md'))->each(static function (string $file): void {
if (count(file($file)) !== count(file('README.md'))) {
echo "The file [$file] has a different number of lines than [README.md]\n";
exit(1);
}
});

exit(0);
1 change: 1 addition & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
__DIR__.'/tests',
__DIR__.'/.*.php',
__DIR__.'/*.php',
__DIR__.'/readme-lint',
]);

$rectorConfig->skip([
Expand Down

0 comments on commit 815485c

Please sign in to comment.