Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

perlcriticrc packaged with project

by geraint (Novice)
on Apr 15, 2019 at 15:15 UTC ( #1232583=perlquestion: print w/replies, xml ) Need Help??

geraint has asked for the wisdom of the Perl Monks concerning the following question:

Hi everyone,

I'm writing perl using VSCode and have installed the Perl Toolbox extension which provides linting with perlcritic. I can't find a way to use my project's .perlcriticrc file though, and the default rules it's applying are excessively strict. In the settings there's an option to use the file at ~/.perlcriticrc but I can't find an option to use a file in the project directory. I could just copy the projects .perlcriticrc file to my home directory but I would have to do this each time I switch between different projects which is not ideal and I don't want to make project config global.

Is there a way to use the rc file from the current project or just go up the directory tree until it finds a config file, similar to how eslintrc file works?



Replies are listed 'Best First'.
Re: perlcriticrc packaged with project
by Fletch (Chancellor) on Apr 15, 2019 at 15:52 UTC

    Not sure how to do it with VSCode but if it supports a per-project environment setting you might could set PERLCRITIC to point to the .perlcritic file (presumably in the root directory of the project) that you want used.

    Alternately if it allows you to pass extra options when it runs perlcritic add something like --profile path/to/.perlcritic options. See the section CONFIGURATION in Perl::Critic.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      Thanks, yes it seems that creating a new settings.json file in the .vscode directory at the root of the project allows me to setup project specific settings. From there I could set the path to the perlcritic binary passing in the profile as you suggested.

      { "perl-toolbox.lint.exec": "/usr/local/bin/perlcritic -profile '/Us +ers/geraint/Projects/thisproject/.perlcriticrc'" }

      Thanks for your help!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1232583]
Approved by marto
Front-paged by haukex
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2020-12-05 05:57 GMT
Find Nodes?
    Voting Booth?
    How often do you use taint mode?

    Results (63 votes). Check out past polls.