-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add gherkin_lint task #1144
base: v2.x
Are you sure you want to change the base?
Add gherkin_lint task #1144
Conversation
56ac251
to
ad8695c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a minor typo and have 1 question.
Besides that it works great! Thanks
composer.json
Outdated
@@ -52,6 +52,7 @@ | |||
"brianium/paratest": "Lets GrumPHP run PHPUnit in parallel.", | |||
"codeception/codeception": "Lets GrumPHP run your project's full stack tests", | |||
"consolidation/robo": "Lets GrumPHP run your automated PHP tasks.", | |||
"dantleech/ngherkin-lint-php": "Lets GrumPHP lint your Gherkin files.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo? dantleech/ngherkin-lint-php
{ | ||
$resolver = new OptionsResolver(); | ||
$resolver->setDefaults([ | ||
'directory' => 'features', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that if the specified directory doesn't exist, it fails with:
In FeatureFinder.php line 25:
Provided path "/var/www/html/features" does not exist
lint <path>
Failed to run grumphp run --tasks=gherkin_lint: exit status 1
Is this expected ? or should we skip in such cases?
How are other tasks handling these cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's expected. For example src/Task/Gherkin.php has the same configuration, and returns the same error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good in general. I've added a couple of small pointers.
|
||
$resolver->addAllowedTypes('directory', ['string']); | ||
$resolver->addAllowedTypes('config', ['null', 'string']); | ||
$resolver->addAllowedValues('config', [null, 'text']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't config be any string? Now you are limiting it to the literal text
here ?
On second notice: there doesn't seem a way to specify the configuration file. It assumes a hardcoded path instead:
- https://github.com/dantleech/gherkin-lint-php?tab=readme-ov-file#configuration
- https://github.com/dantleech/gherkin-lint-php/blob/f3277c4945261d26a3098b5e003b51d815eaed4b/bin/gherkinlint#L20-L27
- https://github.com/dantleech/gherkin-lint-php/blob/f3277c4945261d26a3098b5e003b51d815eaed4b/src/Command/LintCommand.php#L27-L32
So I'dd say its better to remove the config option alltogether.
|
||
public function provideExternalTaskRuns(): iterable | ||
{ | ||
yield 'defaults' => [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this provider should contain a test for every configurable option to make sure it behaves the correct way.
gherkin-lint-php
might be easier to set up and configure, especially if you only need basic Gherkin linting.New Task Checklist:
run()
method readable?run()
method using the configuration correctly?