puppet-vscode icon indicating copy to clipboard operation
puppet-vscode copied to clipboard

.puppet-lint.rc is ignored in module directories

Open bastelfreak opened this issue 3 years ago • 3 comments

What Versions are you running?

OS Version: Windows 10 VSCode Version: 1.63.2 Puppet Extension Version:1.4.0 PDK Version: 2.3.0

What You Are Seeing?

I've my control repo cloned + all modules into that and the control repository is my workspace in vscode. Most modules have their own .puppet-lint.rc in their root directory with individual checks. VS Code with the Puppet extension seems to ignore them. I think it only reads the .puppet-lint.rc from the first directory in my workspace. But I currently have a hard time reproducing it.

What is Expected?

I would expect that the individual .puppet-lint.rc files are honored. This was mentioned in https://github.com/puppetlabs/puppet-vscode/pull/111 but I don't understand the fix. Is it possible that I need to configure anything on my side or is this expected to work out of the box?

How Did You Get This To Happen? (Steps to Reproduce)

  • checkout a few modules with .puppet-lint.rc files
  • add them to the vscode workspace
  • see warnings from the plugins if code is wrong

Output Log

It's an airgapped environment where I saw this. I will try to reproduce this in the next days and provide logs if possible.

bastelfreak avatar Jan 26 '22 16:01 bastelfreak

I think I might be experiencing this same issue. I have a workspace open with multiple folders, one of which is puppet, and I'm finding that settings from .puppet-lint.rc are not being respected unless I open the puppet folder in it's own workspace.

When the puppet language server is started with the proper local-workspace when opened separately, everything works as expected...

jlindquist       79636  12.0  0.2 34848916  75476   ??  S    10:08PM   0:02.96 /opt/puppetlabs/pdk/private/ruby/2.7.3/bin/ruby /Users/jlindquist/.vscode/extensions/puppet.puppet-vscode-1.4.0/vendor/languageserver/puppet-languageserver --stdio --timeout=10 --local-workspace=/Users/jlindquist/dev/puppet-repo

When the puppet language server starts with what is the path to the first folder in the workspace when multiple paths are opened, it does not work (and starts the puppet language server with an invalid path, ignoring the .puppet-lint.rc file...

jlindquist       77573   0.0  0.2 34972768  79208   ??  S    10:07PM   0:03.05 /opt/puppetlabs/pdk/private/ruby/2.7.3/bin/ruby /Users/jlindquist/.vscode/extensions/puppet.puppet-vscode-1.4.0/vendor/languageserver/puppet-languageserver --stdio --timeout=10 --local-workspace=/Users/jlindquist/dev/ansible

Any thoughts on how to make this work so I can get everything open in a single workspace?

EDIT: If I edit the workspace file, and reorder the folders so the puppet repo is first in the list, the puppet server starts up with the expected workspace path. This allows me to work around it for now, but it still doesn't load other module directories / folders

jplindquist avatar Aug 22 '22 05:08 jplindquist

I'm having the same issue. Is there a fix so far? It's just easier for me to open a parent directory and have many projects in a single workspace, than open another vscode window specifically for my puppet subdirectory, just to have puppet-lint working properly.

techsk8 avatar Nov 24 '23 07:11 techsk8

Just found the fix. If anyone is using vscode to open lots of repos in one workspace and if one the repos has puppet stuff inside, then puppet-lint doesn't honor your .puppet-lint.rc file from inside the puppet repo. to fix this, just create a symlink of the .puppet-lint.rc file to your $HOME.

something like this:

cd $HOME
ln -s my-workspace/puppet_repo_01/.puppet-lint.rc

Then restart vscode and everything will work. Worked for me on MacOS, but I presume is no different on Linux or Windows (maybe).

techsk8 avatar Dec 05 '23 08:12 techsk8