puppetlabs / puppet-lint

Check that your Puppet manifests conform to the style guide
https://puppetlabs.github.io/puppet-lint/
MIT License
20 stars 13 forks source link

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

Open techsk8 opened 8 months ago

techsk8 commented 8 months ago

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

Additional Context

Nothing to add