-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add profile, other options to the perlcritic linter #675
Conversation
This should bring the `perlcritic` linter in line with the `perl` linter, allowing for custom (and per-buffer) perlcritic options and executable. We also supply a "standard" perltidy profile setting..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good ideas. See my comments.
ale_linters/perl/perlcritic.vim
Outdated
\ get(g:, 'ale_perl_perlcritic_executable', 'perlcritic') | ||
|
||
let g:ale_perl_perlcritic_profile = | ||
\ get(g:, 'ale_perl_perlcritic_profile', '.../.perlcriticrc') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use the ale#path#FindNearestFile
function below to find .percriticrc
instead. See the JSHint implementation for an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for that -- I'd mistaken the ...
as something perlcritic
does, rather than a shell construct.
ale_linters/perl/perlcritic.vim
Outdated
let l:critic_verbosity = '%l:%c %m [%p]\n' | ||
endif | ||
|
||
return "perlcritic --verbose '". l:critic_verbosity . "' --nocolor" | ||
return ale_linters#perl#perlcritic#GetExecutable(a:buffer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should apply ale#Escape
to the executable here if it's configurable, as the executable path could contain spaces, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I've also applied it to the profile file.
test/test_perlcritic_linter.vader
Outdated
|
||
Before: | ||
runtime ale_linters/perl/perlcritic.vim | ||
silent noautocmd new testfile.pl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend using ale#test#SetFilename
instead. new
produces weird output when you run the Vader tests inside of Vim while editing the tests.
I think there might be a commit you haven't pushed yet. |
There is :) I'm having trouble with your last comment, concerning the use of I think I'm just going to bypass that and use a |
Update how we search for profile, setting up a scratch buffer for the Vader tests, etc.
Cheers! 🍻 |
Thanks! :) |
This should bring the
perlcritic
linter in line with theperl
linter, allowing for custom (and per-buffer) perlcritic options and
executable.
We also supply a "standard" perltidy profile setting.