Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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?

Thanks,

Ger

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2019-04-20 10:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I am most likely to install a new module from CPAN if:
















    Results (108 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!