-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(app/Commands): update CommitCommand.php
- Add comments with links to related resources. - Modify tryFixMessage() method to fix JSON messages. - Add missing import statement. - Update PHPDoc annotations. - Remove unused code. - Update test dataset.
- Loading branch information
1 parent
ca2c1f7
commit 1c412e0
Showing
6 changed files
with
105 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/** @noinspection AnonymousFunctionStaticInspection */ | ||
/** @noinspection JsonEncodingApiUsageInspection */ | ||
/** @noinspection NullPointerExceptionInspection */ | ||
/** @noinspection PhpUnhandledExceptionInspection */ | ||
/** @noinspection PhpUnused */ | ||
/** @noinspection PhpUnusedAliasInspection */ | ||
/** @noinspection StaticClosureCanBeUsedInspection */ | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of the guanguans/ai-commit. | ||
* | ||
* (c) guanguans <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled. | ||
*/ | ||
|
||
dataset('commit command parameters', [ | ||
[ | ||
/*'parameters' =>*/ [], | ||
], | ||
[ | ||
/*'parameters' =>*/ [ | ||
'--dry-run' => true, | ||
], | ||
], | ||
[ | ||
/*'parameters' =>*/ [ | ||
'--diff' => <<<'DIFF' | ||
tests/Pest.php | 1 + | ||
tests/Unit/ConfigManagerTest.php | 2 +- | ||
DIFF, | ||
], | ||
], | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/** @noinspection AnonymousFunctionStaticInspection */ | ||
/** @noinspection JsonEncodingApiUsageInspection */ | ||
/** @noinspection NullPointerExceptionInspection */ | ||
/** @noinspection PhpUnhandledExceptionInspection */ | ||
/** @noinspection PhpUnused */ | ||
/** @noinspection PhpUnusedAliasInspection */ | ||
/** @noinspection StaticClosureCanBeUsedInspection */ | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of the guanguans/ai-commit. | ||
* | ||
* (c) guanguans <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled. | ||
*/ | ||
|
||
dataset('invalid messages', [ | ||
[ | ||
'message' => <<<'MESSAGE' | ||
{ | ||
"subject": "fix(app/Generators): update GithubCopilotCliGenerator to include binary command", | ||
"body": "- Change the command array in the `resolve` function call to include `[\'binary\', \'copilot\', \'explain\', $prompt]` as the command\\n- Update the `mustRun` function | ||
callback to handle output formatting\\n- Add debug statements to output the generated `$output` variable and perform a `dd()` call\\n- Return the generated `$output` variable" | ||
} | ||
MESSAGE, | ||
], | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
/** @noinspection AnonymousFunctionStaticInspection */ | ||
/** @noinspection JsonEncodingApiUsageInspection */ | ||
/** @noinspection NullPointerExceptionInspection */ | ||
/** @noinspection PhpUnhandledExceptionInspection */ | ||
/** @noinspection PhpUnused */ | ||
/** @noinspection PhpUnusedAliasInspection */ | ||
/** @noinspection StaticClosureCanBeUsedInspection */ | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* This file is part of the guanguans/ai-commit. | ||
* | ||
* (c) guanguans <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled. | ||
*/ | ||
|
||
use App\Commands\CommitCommand; | ||
|
||
it('can try fix message', function (string $message): void { | ||
expect($message)->not->toBeJson() | ||
->and( | ||
(function (string $message): string { | ||
return $this->tryFixMessage($message); | ||
})->call(app(CommitCommand::class), $message) | ||
)->toBeJson(); | ||
})->group(__DIR__, __FILE__)->with('invalid messages'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters