Skip to content

Commit

Permalink
Add docs to rules
Browse files Browse the repository at this point in the history
  • Loading branch information
vsiakka committed Jul 13, 2020
1 parent 113cd37 commit 165755d
Show file tree
Hide file tree
Showing 80 changed files with 1,426 additions and 104 deletions.
Empty file added docs/config-parser.md
Empty file.
Empty file added docs/config-verifier.md
Empty file.
Empty file added docs/feature-finder.md
Empty file.
Empty file added docs/formatters/json.md
Empty file.
Empty file added docs/formatters/stylish.md
Empty file.
Empty file added docs/linter.md
Empty file.
Empty file added docs/logger.md
Empty file.
Empty file added docs/main.md
Empty file.
Empty file added docs/rules.md
Empty file.
41 changes: 41 additions & 0 deletions docs/rules/allowed-tags.md
@@ -0,0 +1,41 @@
<a name="module_rules/allowed-tags"></a>

## rules/allowed-tags

* [rules/allowed-tags](#module_rules/allowed-tags)
* [.name](#module_rules/allowed-tags.name) : <code>string</code>
* [.availableConfigs](#module_rules/allowed-tags.availableConfigs) : <code>Object</code>
* [.run(feature, unused, configuration)](#module_rules/allowed-tags.run) ⇒ <code>Array</code>

<a name="module_rules/allowed-tags.name"></a>

### rules/allowed-tags.name : <code>string</code>
The name of the rule

**Kind**: static constant of [<code>rules/allowed-tags</code>](#module_rules/allowed-tags)
<a name="module_rules/allowed-tags.availableConfigs"></a>

### rules/allowed-tags.availableConfigs : <code>Object</code>
The allowed-tags rule should be configured with a list of the allowed tags, in order to have an effect.

**Kind**: static constant of [<code>rules/allowed-tags</code>](#module_rules/allowed-tags)
**Example** *(The rule configuration should look like this)*
```js
{
"allowed-tags": ["on", {"tags": ["@watch", "@wip", "@todo"]}]
}
```
<a name="module_rules/allowed-tags.run"></a>

### rules/allowed-tags.run(feature, unused, configuration) ⇒ <code>Array</code>
Runs the rule's logic against the provide feature file/object

**Kind**: static method of [<code>rules/allowed-tags</code>](#module_rules/allowed-tags)
**Returns**: <code>Array</code> - - The detected errors

| Param | Type | Description |
| --- | --- | --- |
| feature | <code>Gerkin.Feature</code> | A Gerkin.Feature object |
| unused | | Unused parameter, exists to conform to the rule run method signature |
| configuration | <code>Object</code> | The rule configuration whose format should match `availableConfigs` |

67 changes: 67 additions & 0 deletions docs/rules/indentation.md
@@ -0,0 +1,67 @@
<a name="module_rules/indentation"></a>

## rules/indentation

* [rules/indentation](#module_rules/indentation)
* [~name](#module_rules/indentation..name) : <code>string</code>
* [~availableConfigs](#module_rules/indentation..availableConfigs) : <code>Object</code>
* [~run(feature, unused, configuration)](#module_rules/indentation..run) ⇒ <code>Array</code>

<a name="module_rules/indentation..name"></a>

### rules/indentation~name : <code>string</code>
The name of the rule

**Kind**: inner property of [<code>rules/indentation</code>](#module_rules/indentation)
<a name="module_rules/indentation..availableConfigs"></a>

### rules/indentation~availableConfigs : <code>Object</code>
The indentation rule can be configured for each gherkin kewyword and uses following values by default:
<br>- Expected indentation for Feature, Background, Scenario, Examples heading: 0 spaces
<br>- Expected indentation for Steps and each example: 2 spaces
<br>The user provided configuration will be merged with the defaults. That means that you only need to specify only the
keywords for which you want to override the default indentantion config.
<br>Additionally:
<br>- `Step` will be used as a fallback if the keyword of the step, eg. 'given', is not specified.
<br>- If `feature tag` is not set then `Feature` is used as a fallback
<br>- If `scenario tag` is not set then `Scenario` is used as a fallback.

<br>This rule works in all locales.

**Kind**: inner property of [<code>rules/indentation</code>](#module_rules/indentation)
**Example** *(The rule configuration should look like this (only specify the keywords for which you want to override the defaults))*
```js
{
"indentation" : [
"on", {
"Feature": 0,
"Background": 0,
"Scenario": 0,
"Step": 2,
"Examples": 0,
"example": 2,
"given": 2,
"when": 2,
"then": 2,
"and": 2,
"but": 2,
"feature tag": 0,
"scenario tag": 0
}
]
}
```
<a name="module_rules/indentation..run"></a>

### rules/indentation~run(feature, unused, configuration) ⇒ <code>Array</code>
Runs the rule's logic against the provide feature file/object

**Kind**: inner method of [<code>rules/indentation</code>](#module_rules/indentation)
**Returns**: <code>Array</code> - - The detected errors

| Param | Type | Description |
| --- | --- | --- |
| feature | <code>Gerkin.Feature</code> | A Gerkin.Feature object |
| unused | | Unused parameter, exists to conform to the rule run method signature |
| configuration | <code>Object</code> | The rule configuration whose format should match `availableConfigs` |

44 changes: 44 additions & 0 deletions docs/rules/max-scenarios-per-file.md
@@ -0,0 +1,44 @@
<a name="module_rules/max-scenarios-per-file"></a>

## rules/max-scenarios-per-file

* [rules/max-scenarios-per-file](#module_rules/max-scenarios-per-file)
* [~name](#module_rules/max-scenarios-per-file..name) : <code>string</code>
* [~availableConfigs](#module_rules/max-scenarios-per-file..availableConfigs) : <code>Object</code>
* [~run(feature, unused, configuration)](#module_rules/max-scenarios-per-file..run) ⇒ <code>Array</code>

<a name="module_rules/max-scenarios-per-file..name"></a>

### rules/max-scenarios-per-file~name : <code>string</code>
The name of the rule

**Kind**: inner property of [<code>rules/max-scenarios-per-file</code>](#module_rules/max-scenarios-per-file)
<a name="module_rules/max-scenarios-per-file..availableConfigs"></a>

### rules/max-scenarios-per-file~availableConfigs : <code>Object</code>
The max-scenarios-per-file rule supports the following configuration options:
<br>- maxScenarios {int} - the maximum scenarios per file after which the rule fails. Defaults to `10`.
<br>- countOutlineExamples {boolean} - whether to count every example row for a Scenario Outline,
as opposed to just 1 for the whole block. Defaults to `true`.

**Kind**: inner property of [<code>rules/max-scenarios-per-file</code>](#module_rules/max-scenarios-per-file)
**Example** *(The rule configuration should look like this)*
```js
{
"max-scenarios-per-file": ["on", {"maxScenarios": 10, "countOutlineExamples": true}]
}
```
<a name="module_rules/max-scenarios-per-file..run"></a>

### rules/max-scenarios-per-file~run(feature, unused, configuration) ⇒ <code>Array</code>
Runs the rule's logic against the provide feature file/object

**Kind**: inner method of [<code>rules/max-scenarios-per-file</code>](#module_rules/max-scenarios-per-file)
**Returns**: <code>Array</code> - - The detected errors

| Param | Type | Description |
| --- | --- | --- |
| feature | <code>Gerkin.Feature</code> | A Gerkin.Feature object |
| unused | | Unused parameter, exists to conform to the rule run method signature |
| configuration | <code>Object</code> | The rule configuration whose format should match `availableConfigs` |

45 changes: 45 additions & 0 deletions docs/rules/name-length.md
@@ -0,0 +1,45 @@
<a name="module_rules/name-length"></a>

## rules/name-length

* [rules/name-length](#module_rules/name-length)
* [~name](#module_rules/name-length..name) : <code>string</code>
* [~availableConfigs](#module_rules/name-length..availableConfigs) : <code>Object</code>
* [~run(feature, unused, configuration)](#module_rules/name-length..run) ⇒ <code>Array</code>

<a name="module_rules/name-length..name"></a>

### rules/name-length~name : <code>string</code>
The name of the rule

**Kind**: inner property of [<code>rules/name-length</code>](#module_rules/name-length)
<a name="module_rules/name-length..availableConfigs"></a>

### rules/name-length~availableConfigs : <code>Object</code>
The name-lentgth rule allows you to configure the maximum length for:
<br> - Feature name
<br> - Scenario name
<br> - Step text
By default the maximum length is set to 70 characters.

**Kind**: inner property of [<code>rules/name-length</code>](#module_rules/name-length)
**Example** *(The rule configuration should look like this (only specify the keywords for which you want to override the defaults))*
```js
{
"name-length" : ["on", { "Feature": 70, "Scenario": 70, "Step": 70 }]
}
```
<a name="module_rules/name-length..run"></a>

### rules/name-length~run(feature, unused, configuration) ⇒ <code>Array</code>
Runs the rule's logic against the provide feature file/object

**Kind**: inner method of [<code>rules/name-length</code>](#module_rules/name-length)
**Returns**: <code>Array</code> - - The detected errors

| Param | Type | Description |
| --- | --- | --- |
| feature | <code>Gerkin.Feature</code> | A Gerkin.Feature object |
| unused | | Unused parameter, exists to conform to the rule run method signature |
| configuration | <code>Object</code> | The rule configuration whose format should match `availableConfigs` |

47 changes: 47 additions & 0 deletions docs/rules/new-line-at-eof.md
@@ -0,0 +1,47 @@
<a name="module_rules/new-line-at-eof"></a>

## rules/new-line-at-eof

* [rules/new-line-at-eof](#module_rules/new-line-at-eof)
* [~name](#module_rules/new-line-at-eof..name) : <code>string</code>
* [~availableConfigs](#module_rules/new-line-at-eof..availableConfigs) : <code>Array</code>
* [~run(unused, file, configuration)](#module_rules/new-line-at-eof..run) ⇒ <code>Array</code>

<a name="module_rules/new-line-at-eof..name"></a>

### rules/new-line-at-eof~name : <code>string</code>
The name of the rule

**Kind**: inner property of [<code>rules/new-line-at-eof</code>](#module_rules/new-line-at-eof)
<a name="module_rules/new-line-at-eof..availableConfigs"></a>

### rules/new-line-at-eof~availableConfigs : <code>Array</code>
The new-line-at-eof rule can be configured to enforce or disallow new lines at EOF.

**Kind**: inner property of [<code>rules/new-line-at-eof</code>](#module_rules/new-line-at-eof)
**Example** *(Enforce new lines at EOF)*
```js
{
"new-line-at-eof": ["on", "yes"]
}
```
**Example** *(Disallow new lines at EOF)*
```js
{
"new-line-at-eof": ["on", "no"]
}
```
<a name="module_rules/new-line-at-eof..run"></a>

### rules/new-line-at-eof~run(unused, file, configuration) ⇒ <code>Array</code>
Runs the rule's logic against the provide feature file/object

**Kind**: inner method of [<code>rules/new-line-at-eof</code>](#module_rules/new-line-at-eof)
**Returns**: <code>Array</code> - - The detected errors

| Param | Type | Description |
| --- | --- | --- |
| unused | | Unused parameter, exists to conform to the rule run method signature |
| file | <code>Object</code> | An Object containing the lines and relative path of the feature file |
| configuration | <code>Object</code> | The rule configuration whose format should match `availableConfigs` |

26 changes: 26 additions & 0 deletions docs/rules/no-background-only-scenario.md
@@ -0,0 +1,26 @@
<a name="module_rules/no-background-only-scenario"></a>

## rules/no-background-only-scenario

* [rules/no-background-only-scenario](#module_rules/no-background-only-scenario)
* [~name](#module_rules/no-background-only-scenario..name) : <code>string</code>
* [~run(feature)](#module_rules/no-background-only-scenario..run) ⇒ <code>Array</code>

<a name="module_rules/no-background-only-scenario..name"></a>

### rules/no-background-only-scenario~name : <code>string</code>
The name of the rule

**Kind**: inner property of [<code>rules/no-background-only-scenario</code>](#module_rules/no-background-only-scenario)
<a name="module_rules/no-background-only-scenario..run"></a>

### rules/no-background-only-scenario~run(feature) ⇒ <code>Array</code>
Runs the rule's logic against the provide feature file/object

**Kind**: inner method of [<code>rules/no-background-only-scenario</code>](#module_rules/no-background-only-scenario)
**Returns**: <code>Array</code> - - The detected errors

| Param | Type | Description |
| --- | --- | --- |
| feature | <code>Gerkin.Feature</code> | A Gerkin.Feature object |

27 changes: 27 additions & 0 deletions docs/rules/no-dupe-feature-names.md
@@ -0,0 +1,27 @@
<a name="module_rules/no-dupe-feature-names"></a>

## rules/no-dupe-feature-names

* [rules/no-dupe-feature-names](#module_rules/no-dupe-feature-names)
* [~name](#module_rules/no-dupe-feature-names..name) : <code>string</code>
* [~run(feature, file)](#module_rules/no-dupe-feature-names..run) ⇒ <code>Array</code>

<a name="module_rules/no-dupe-feature-names..name"></a>

### rules/no-dupe-feature-names~name : <code>string</code>
The name of the rule

**Kind**: inner property of [<code>rules/no-dupe-feature-names</code>](#module_rules/no-dupe-feature-names)
<a name="module_rules/no-dupe-feature-names..run"></a>

### rules/no-dupe-feature-names~run(feature, file) ⇒ <code>Array</code>
Runs the rule's logic against the provide feature file/object

**Kind**: inner method of [<code>rules/no-dupe-feature-names</code>](#module_rules/no-dupe-feature-names)
**Returns**: <code>Array</code> - - The detected errors

| Param | Type | Description |
| --- | --- | --- |
| feature | <code>Gerkin.Feature</code> | A Gerkin.Feature object |
| file | <code>Object</code> | An Object containing the lines and relative path of the feature file |

54 changes: 54 additions & 0 deletions docs/rules/no-dupe-scenario-names.md
@@ -0,0 +1,54 @@
<a name="module_rules/no-dupe-scenario-names"></a>

## rules/no-dupe-scenario-names

* [rules/no-dupe-scenario-names](#module_rules/no-dupe-scenario-names)
* [~name](#module_rules/no-dupe-scenario-names..name) : <code>string</code>
* [~availableConfigs](#module_rules/no-dupe-scenario-names..availableConfigs) : <code>Array</code>
* [~run(feature, file, [configuration])](#module_rules/no-dupe-scenario-names..run) ⇒ <code>Array</code>

<a name="module_rules/no-dupe-scenario-names..name"></a>

### rules/no-dupe-scenario-names~name : <code>string</code>
The name of the rule

**Kind**: inner property of [<code>rules/no-dupe-scenario-names</code>](#module_rules/no-dupe-scenario-names)
<a name="module_rules/no-dupe-scenario-names..availableConfigs"></a>

### rules/no-dupe-scenario-names~availableConfigs : <code>Array</code>
The no-dupe-scenario-names rule can can be configured to search for duplicates in each individual feature or amongst all feature files.
By default the rule will search for duplicates in all features.

**Kind**: inner property of [<code>rules/no-dupe-scenario-names</code>](#module_rules/no-dupe-scenario-names)
**Example** *(Search for duplicates in all features (using the default configuration))*
```js
{
"no-dupe-scenario-names": "on"
}
```
**Example** *(Search for duplicates in all features (using explicit configuration))*
```js
{
"no-dupe-scenario-names": ["on", "anywhere"]
}
```
**Example** *(Search for duplicates in each individual feature (same scenario name in different features won&#x27;t raise an error))*
```js
{
"no-dupe-scenario-names": ["on", "in-feature"]
}
```
<a name="module_rules/no-dupe-scenario-names..run"></a>

### rules/no-dupe-scenario-names~run(feature, file, [configuration]) ⇒ <code>Array</code>
Runs the rule's logic against the provide feature file/object

**Kind**: inner method of [<code>rules/no-dupe-scenario-names</code>](#module_rules/no-dupe-scenario-names)
**Returns**: <code>Array</code> - - The detected errors

| Param | Type | Description |
| --- | --- | --- |
| feature | <code>Gerkin.Feature</code> | A Gerkin.Feature object |
| file | <code>Object</code> | An Object containing the lines and relative path of the feature file |
| [configuration] | <code>String</code> | The rule configuration which can be empty or it needs to match one of the availableConfigs |

26 changes: 26 additions & 0 deletions docs/rules/no-duplicate-tags.md
@@ -0,0 +1,26 @@
<a name="module_rules/no-duplicate-tags"></a>

## rules/no-duplicate-tags

* [rules/no-duplicate-tags](#module_rules/no-duplicate-tags)
* [~name](#module_rules/no-duplicate-tags..name) : <code>string</code>
* [~run(feature)](#module_rules/no-duplicate-tags..run) ⇒ <code>Array</code>

<a name="module_rules/no-duplicate-tags..name"></a>

### rules/no-duplicate-tags~name : <code>string</code>
The name of the rule

**Kind**: inner property of [<code>rules/no-duplicate-tags</code>](#module_rules/no-duplicate-tags)
<a name="module_rules/no-duplicate-tags..run"></a>

### rules/no-duplicate-tags~run(feature) ⇒ <code>Array</code>
Runs the rule's logic against the provide feature file/object

**Kind**: inner method of [<code>rules/no-duplicate-tags</code>](#module_rules/no-duplicate-tags)
**Returns**: <code>Array</code> - - The detected errors

| Param | Type | Description |
| --- | --- | --- |
| feature | <code>Gerkin.Feature</code> | A Gerkin.Feature object |

0 comments on commit 165755d

Please sign in to comment.