Skip to content
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

Open
wants to merge 4 commits into
base: v2.x
Choose a base branch
from
Open

Conversation

saidatom
Copy link

@saidatom saidatom commented Jun 28, 2024

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Documented? yes

gherkin-lint-php might be easier to set up and configure, especially if you only need basic Gherkin linting.

New Task Checklist:

  • Are the dependencies added to the composer.json suggestions?
  • Is the doc/tasks.md file updated?
  • Are the task parameters documented?
  • Is the task registered in the tasks.yml file?
  • Does the task contains phpunit tests?
  • Is the configuration having logical allowed types?
  • Does the task run in the correct context?
  • Is the run() method readable?
  • Is the run() method using the configuration correctly?
  • Are all CI services returning green?

Copy link
Contributor

@vever001 vever001 left a 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.",
Copy link
Contributor

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',
Copy link
Contributor

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?

Copy link
Author

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.

Copy link
Contributor

@veewee veewee left a 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']);
Copy link
Contributor

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:

So I'dd say its better to remove the config option alltogether.


public function provideExternalTaskRuns(): iterable
{
yield 'defaults' => [
Copy link
Contributor

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.

@veewee veewee added this to the 2.7.0 milestone Jul 11, 2024
@veewee veewee removed this from the 2.7.0 milestone Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants