Page MenuHomePhabricator

wmf-style lint detects variable expansion in variables as parameter declaration
Open, MediumPublic

Description

Context is https://gerrit.wikimedia.org/r/c/operations/puppet/+/620726 where this code:

class profile::alertmanager::web (
    String $vhost  = lookup('profile::alertmanager::web::vhost', {'default_value' => "alerts.${facts['domain']}"}),
    Boolean $enable_sso  = lookup('profile::alertmanager::web::enable_sso', {'default_value' => true}),
    Boolean $readonly  = lookup('profile::alertmanager::web::readonly', {'default_value' => true}),
    Array[Stdlib::Host] $prometheus_nodes = lookup('prometheus_nodes'),
) {

Tricked wmf-style lint into thinking that ${facts['domain']} is a parameter:

18:22:01 wmf-style: total violations delta 1
18:22:01 NEW violations:
18:22:01 modules/profile/manifests/alertmanager/web.pp:8 wmf-style: Parameter 'facts['domain']' of class 'profile::alertmanager::web' has no call to lookup