danleech/gherkin-lint

Gherkin 检查器

0.2.3 2024-06-08 10:11 UTC

This package is auto-updated.

Last update: 2024-09-08 10:40:41 UTC


README

本包提供了一个受 vsiakka/gherkin-lint 启发并在 PHP Gherkin 解析器的基础上实现的 Gherkin 检查器。

内容

使用方法

注意: Gherkin Lint 需要 PHP 8.1

使用 Composer 安装

$ composer require --dev dantleech/gherkin-lint

检查您的功能文件

$ ./vendor/bin/gherkinlint lint features/

image

要查看可用的和启用的规则,请运行

$ ./vendor/bin/gherkinlint rules

image

配置

默认情况下,所有规则都启用。要自定义或禁用它们,请创建一个配置文件 gherkinlint.json

{
    "rules": {
        "allowed-tags": {
            "allow": ["@my-special-tag", "@my-other-tag"]
        },
        "filename": {
            "enabled": false
        }
    }
}

使用 rules 命令查看哪些规则已启用。

禁用规则

规则可以通过在功能声明之前添加注释来禁用。

# @gherkinlint-disable-rule keyword-order
Feature: My feature with strange keyword orders

使用逗号分隔禁用多个规则

# @gherkinlint-disable-rule keyword-order, someother-rule
Feature: My feature with strange keyword orders

贡献

提交一个 pull request!