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
109 stars 54 forks source link

declare_action_class.class_eval not detected when using libraries #895

Closed damacus closed 3 years ago

damacus commented 3 years ago

Version:

7.15.4

Environment:

GitHub Actions/macOS

Scenario:

Cookstyle fails to detect declare_action_class.class_eval

See this old Docker file for an example:

https://github.com/sous-chefs/docker/blob/91d5b1b25c9b004d803aa3cb6cf108fcecd82654/libraries/docker_base.rb#L130-L135

Steps to Reproduce:

Create a resource under libraries, using the old format

module DockerCookbook
  class DockerBase < Chef::Resource
    ...
    declare_action_class.class_eval do
    end
  end
end

Expected Result:

Autocorrection to. action_class

Actual Result:

Cookstyle doesn't find or correct the old format.

tas50 commented 3 years ago

First part is here: https://github.com/chef/cookstyle/pull/897

tas50 commented 3 years ago

Fully resolved now with https://github.com/chef/cookstyle/pull/915