chef / cookstyle

A linting tool that helps you to write better Chef Infra cookbooks and InSpec profiles by detecting and automatically correcting style, syntax, and logic mistakes in your code.
Apache License 2.0
107 stars 54 forks source link

Refactor Chef/Deprecations/Delivery to address caching issues #951

Closed karmix closed 2 years ago

karmix commented 2 years ago

Signed-off-by: Doug Knight doug.knight@karmix.org

Description

RuboCop inspects files not directories. In order to report an offense for the existence of a .delivery directory, the Delivery cop performs the checks and makes its report when asked to inspect the metadata.rb file. On subsequent runs, RuboCop will see that the content of metadata.rb has not changed, and report the cached offense form the Delivery cop, even after the .delivery directory is removed.

This patch refactors the Delivery cop to report offenses for the existence of the files .delivery/config.json (Chef Delivery config) and .delivery/project.toml (Chef Delivery Local config), instead of trying to check for the existence of a directory.

Related Issue

Fixes #942

Types of changes

Checklist:

tas50 commented 2 years ago

@karmix Way cool. Thanks for digging into this