dantleech / gherkin-lint-php

PHP Gherkin Linter
MIT License
45 stars 6 forks source link

Patterns / rules to name features / scenarios #33

Open dkarlovi opened 7 months ago

dkarlovi commented 7 months ago

It would be nice to be able to establish patterns when naming scenarios and features, promoting consistent vocabulary and wordings.

Some ideas:

dantleech commented 7 months ago

happy to receive PRs, I guess the above two are one in the same?

{
   "rules": {
        "name-pattern": {
            "type": "scenario",
            "path": "feature/sales/*",
            "match": "Foobar.*$",
            "tags": ["order"],
         }
   }
}

or whatever

dkarlovi commented 7 months ago

I think so, yes, your example looks good, we can treat the selector like AND.

Maybe more explicit?

{
   "rules": {
        "name-pattern": {
            "selector": {
                "type": "scenario",
                "path": "feature/sales/*",
                "tags": ["order"]
             },
             "match": "Foobar.*$",
         }
   }
}
dkarlovi commented 7 months ago

Ah, it needs to be an array since you'll have more of them, of course.

dantleech commented 7 months ago

could maybe replace Invoke:: with Valinor too to be able to actually support more advanced configuration schemas if necessary.

dkarlovi commented 7 months ago

Not sure what you mean exactly?

dantleech commented 7 months ago

You would if you tried to add this rule I think, it's the way the config is mapped to the Rule's config DTO. I think my "deserializer" (invoke) is pretty basic.

dkarlovi commented 7 months ago

Ah, got it. We can add the more advanced mapper first and then do the names thing.