Skip to content

Commit

Permalink
add information regarding using cookstyle comments to enable/disable …
Browse files Browse the repository at this point in the history
…cops (#3194)

* add information regarding using cookstyle comments to enable/disable cops

* Update docs-chef-io/content/workstation/cookstyle/_index.md

Co-authored-by: Ian Maddaus <[email protected]>

* Update docs-chef-io/content/workstation/cookstyle/_index.md

Co-authored-by: Ian Maddaus <[email protected]>

* Update docs-chef-io/content/workstation/cookstyle/_index.md

Co-authored-by: Ian Maddaus <[email protected]>

* Update docs-chef-io/content/workstation/cookstyle/_index.md

Co-authored-by: Ian Maddaus <[email protected]>

* Update docs-chef-io/content/workstation/cookstyle/_index.md

Co-authored-by: Ian Maddaus <[email protected]>
Signed-off-by: Carlos Aya <[email protected]>

---------

Signed-off-by: Carlos Aya <[email protected]>
Co-authored-by: Ian Maddaus <[email protected]>
  • Loading branch information
carlosaya and IanMadd authored Feb 20, 2024
1 parent 218daa0 commit faf5129
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs-chef-io/content/workstation/cookstyle/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,29 @@ standard. Include this file in the .rubocop.yml file by adding
`inherit_from: .rubocop_todo.yml` to the top of the .rubocop.yml file.

{{< /note >}}

## Disable Cookstyle cops in code

Use Cookstyle-specific comments in your cookbook code to enable or disable cops instead of the standard RuboCop comments.
If you prefer them, you can also use RuboCop comments to enable and disable cops.

Disable a cop using a RuboCop comment:

```ruby
'node.normal[:foo] # rubocop: disable ChefCorrectness/Bar'
```

Disable a cop using a Cookstyle comment:

```ruby
'node.normal[:foo] # cookstyle: disable ChefCorrectness/Bar'
```

Disable a cop in a section of a file using a Cookstyle comment:

```ruby
# cookstyle: disable ChefCorrectness/Bar'
'node.normal[:foo]
# cookstyle: enable ChefCorrectness/Bar'
```

0 comments on commit faf5129

Please sign in to comment.