puppetlabs / puppet-lint

Check that your Puppet manifests conform to the style guide

Home Page:https://puppetlabs.github.io/puppet-lint/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Puppet lint doesn't check if the class params are validated within another class of the module

techsk8 opened this issue · comments

Describe the Bug

Puppet lint from the VSCode extension doesn't check thoroughly if the parameters used in a class are actually validated within the module in another class, therefore throws an error about missing datatype for those params:

# @summary puppet::server::compile::apache
#
# @api private
#
class puppet::server::compile::apache (
  $servername    = $puppet::servername,
  $puppetca_host = $puppet::server_puppetca_host,
) {
  assert_private()

  class { 'lib::ssl_certificate_check':
    blacklist_certificates => [
      $puppet::server::compile::ssl_cert,
    ],
  }
.
.
.

and the linter error looks like this:

[{
	"resource": "/Users/control-repo/site/puppet/manifests/server/compile/apache.pp",
	"owner": "_generated_diagnostic_collection_name_#0",
	"code": "parameter_types",
	"severity": 4,
	"message": "missing datatype for parameter puppet::server::compile::apache::servername",
	"source": "Puppet",
	"startLineNumber": 6,
	"startColumn": 3,
	"endLineNumber": 6,
	"endColumn": 3
},{
	"resource": "/Users/control-repo/site/puppet/manifests/server/compile/apache.pp",
	"owner": "_generated_diagnostic_collection_name_#0",
	"code": "parameter_types",
	"severity": 4,
	"message": "missing datatype for parameter puppet::server::compile::apache::puppetca_host",
	"source": "Puppet",
	"startLineNumber": 7,
	"startColumn": 3,
	"endLineNumber": 7,
	"endColumn": 3
}]

In VSCode looks like this:
linter error

Although I have validated the params I have used in the class, inside init.pp in the puppet class:

# @param enable_clean_node
#
class puppet (
String                                                      $servername                                  = $puppet::params::servername,
Stdlib::Fqdn                                                $server_puppetca_host                        = $puppet::params::server_puppetca_host,
.
.
.
) inherits puppet::params {
.
.
.

Expected Behavior

For puppet lint to check if the params used in the class are actually validated somewhere else and not throw a misleading false-positive error.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Open VSCode with the puppet extension enabled
  2. Open a puppet file that contains a class which uses params that are actually validated in another class
  3. Puppet lint will still complains about the params not being validated, although it shouldn't.

Environment

  • Version: 7.27
  • Platform: MacOS 14 Apple Silicon

Additional Context

Nothing to add