new question: can somebody point me to ... (1) a l...
# puppet
j
new question: can somebody point me to ... (1) a list showing which
puppet-lint
option corresponds to each error message? http://puppet-lint.com/checks/ is not complete ... (2) a concrete example of how to enable or disable items in the
.puppet-lint.rc
file, using the PDK
.sync.yml
file? ... i found https://github.com/puppetlabs/pdk/issues/538 which seems to say this functionality exists but doesn't have any details, and https://github.com/puppetlabs/pdk-templates/blob/main/README.md which mentions it as something that has to be done by customizing
Rakefile
, but again, no usable details.
specifically, i'm looking to disable checks having to do with differences in indentation (i.e. whoever decided `puppet-lint`'s defaults has different ideas than i do) ... such as
pdk (WARNING): puppet-lint: indentation of => is not properly aligned (expected in column 11, but found it in column 12)
and
pdk (WARNING): puppet-lint: indent should be 2 chars and is 6
k
that's a bug which has been fixed recently
j
also
pdk (WARNING): puppet-lint: optional parameter listed before required parameter
... seriously, what's the reason for this check, other than to satisfy some stranger's preferences?
k
hm the
=>
indentation might not be the bug in strict_indent I was thinking of
j
my questions are ... (1) given one of those error messages, how do i identify the option that needs to be added to
.puppet-lint.rc
in order to disable or modify that check? ... and (2), what do i need to put into
.sync.yml
so that PDK will create
.puppet-lint.rc
with those options?
k
the lint plugin is usually in the error message, the
=>
indentation sounds like a core check though
j
it's not there. the only thing i didn't copy/paste above was the
(filename:line:col)
at the end
k
sounds like best to just fix the indentation. what does the code look like?
j
it looks like the same visual style that i've been using for 20+ years, for about a dozen different languages. i seem to believe in having things be aligned with the editor's "tab stop" locations, which means that sometimes there are going to be more than exactly one space between the end of the longest parameter name and the vertical column of
=>
... i also believe in leaving blank lines between objects, to make it easier to see where one object ends and the next one begins
again, the things i'm asking about are differences in peoples' personal preferences, things which are ignored by the compiler.
also ... rather than having an "80chars check" and a "140chars check", wouldn't it make sense to let people specify the soft/hard limits on line lengths?
b
Both like length checks are disabled by default in latest PDK and I think also in the vox pupuli tooling
Yes vox pupuli also disables them
j
i'm not using vox (at work), and this is not for code which will ever be uploaded to the forge. and i'm using PDK 3.4.0.1, which is the latest available version (from homebrew).
so there's a question ... HOW does vox disable them? what did you put in the
.sync.yml
file to make them disabled?
b
Vox doesn't use PDK. We think it is a bad approach to sync so many files into modules
j
thanks, but that doesn't really help me in this case ... i'm starting to think that
puppet-lint
just plain doesn't have a way to disable the indentation checks ... it should be safe to assume that an option which disables an indentation check would have the word
indent
in it, and
puppet-lint --help | grep -i indent
doesn't print anything at all
b
You can disable the strict_indent check. If you usually run puppet-lint via pdk, running just "puppet-lint" will use different configs
You can disable it in the .puppet-lint.rc. But as I pointed it out in the main channel, I highly recommend to not do it
k
let the editor autoformat
j
okay, so HOW do i "disable the strict_indent check" ? again,
puppet-lint --help
doesn't list any option for that, and http://puppet-lint.com/checks/ only has the word "indent" in a section header
"let the editor autoformat" is assuming that i'm using some specific editor
k
lots of editors can do that
b
As said in the main channel, many liters come from plugins, like the strict_indent one, so you need to check the puppet-lint version on your system that ships those plugins. Which probably isn't the global one but rather via pdk
j
i don't use "lots of editors" ... i have no idea what editors other people are going to use when they work on this stuff, i can't even guarantee that they'll use an editor which supports https://editorconfig.org/ ... and the truth is, it shouldn't matter what editor people use. i want to disable some of the checks that
puppet-lint
does.
b
The puppet autoformat options usually run puppet lint with autofix and don't have their own implementation
j
safe to assume these are bugs too? after disabling the
strict_indent
plugin and fixing a few legitimate typos, these are now the only errors/warnings i'm getting:
Copy code
pdk (ERROR): puppet-lint: there should be either a bracket, punctuation mark, closing quote or a newline after a closing brace, or whitespace and none of the aforementioned (manifests/init.pp:75:52)
pdk (ERROR): puppet-lint: there should be either a bracket, punctuation mark, closing quote or a newline after a closing bracket, or whitespace and none of the aforementioned (manifests/init.pp:74:52)
for reference:
Copy code
73  class base (
74    Array[String[1]]                    $profile = [] ,
75    Hash[String[1],Hash[String[1],Any]] $files   = {} ,
76
77    ########################################
78    # Throw error on Hiera typo
79
80    Undef $profiles             = undef ,
k
I guess it's the space before the comma
j
why not on line 80 then?
k
no brace or bracket
b
It's also possible that a lint check can only find one violation and you will need to fix it before it's able to find the next one
dead yes 1
I recommend to run the autofix option and then check the diff
dead yes 1
j
ugh ... so it's not differentiating
}
at the end of a code block, and when it's part of
{}
as a value
i've had bad results with "autofix" in the past
b
I am not aware of any bugs with it in the past years. But then you are also on very outdated tools
j
i'm using what's included in the CURRENT PDK
k
3.4 is not current
3.5.1.1 is current
j
uhhhh... what is the current version, and how old is 3.4.0? ... how badly am i being perforced this time?
b
Well first you don't use current pdk
k
you need to use your PE credentials to download it
b
Then current pdk doesn't ship current puppet lint nor current plugins
But pdk 3.5 is recent enough
j
i installed PDK via homebrew (macOS package manager) ... do you happen to know, does perforce maintain that?
k
they stopped maintaining that
In
C:\Program Files\Puppet Labs\DevelopmentKit\share\cache\ruby\3.2.0\gems
I see that they still bundle strict_indent 3.0.0 which was released in 2023, so still some outdated components
j
oh i see ... they're apparently still maintaining it, but you have to download it from their super-secret repo that only paying customers get access to ... yessir, i got well and truly perforced.
and according to https://help.puppet.com/pdk/current/topics/pdk_install.htm it doesn't even support macOS 15 or 26 ... i'll be in a meeting with our account manager on monday, i shall be sure to bring this up
y
PDK 3.4 still performs well for my cases (using it via VS Code plugin for auto-formatting the code). I’d say, having own style is respectable, but in the end you’ll fight against the tooling for your style. I’m not sure it worth the effort.
dead yes 1