Perlcritic not recognising code that has been tidied - perl

I'm using perlcritic with perltidy and while the other rules are applied, I'm, getting the following error message:
Code is not tidy at line 1, near 'package MyPackage;'.
I've run perltidy to tidy the code but I am still getting the problem. In the .perlcriticrc file I've added the following rule with the path to .perltidyrc file.
[CodeLayout::RequireTidyCode]
perltidyrc = /path/to/.perltidyrc
I'm running perlcritic like this:
perlcritic --profile .perlcriticrc file.pm
I'm sure that perlcritic is using the rc file as I'm able to turn rules on and off by ammending the file content. I'm also sure that perltidy is using the correct rc file in the same way.
How can I prevent this error without disabling the RequireTidyCode rule?
Thanks,

Related

How do I get perl-support.vim to recognize Perl files?

I installed perl-support.vim into ~/.vim (unzipped). When I create a new .pl file it shows me the default template, which means my installation is successful (I guess). I have already added filetype plugin on in ~/.vimrc & /etc/vimrc.
How do I enter a perl-support command?
The write up recommends typing \isu in normal mode for creating a new sub, but the moment I hit i vim changes into insert mode and nothing intended happens.
What am I doing wrong?
Make sure you've enabled ftplugins with the filetype plugin on command in .vimrc, and of course make sure that the file you're editing is recognized as a Perl file (usually, by having a known extension, but you can force the matter by issuing the command set filetype=perl. If filetype plugins aren't enabled, or if the filetype isn't recognized, then the rest of perl-support won't get loaded at all.
As recommended by hobbs, set filetype=perl works.
However, I wanted to do this everytime I open a .t test file — which my vim does not recognize as perl files because the interpreter statement is also custom.
I checked out :help syntax in vim and saw this:
mkdir ~/.vim/ftdetect
cd ~/.vim/ftdetect
vim t.vim
which contains
au BufRead,BufNewFile *.t set filetype=perl
which means: if the file extension is .t then do set filetype=perl.
This can be useful for any other custom extension.
I found I had to install Perl::Tags before most things (esp. \ commands). Installing Perl::Tags made an error message thrown by filetype plugin on go away.
cpan> install Perl::Tags # make sure you say yes to any offer to install dependancies

Unrecognized character \x90 ERROR in perlcode.exe

Unrecognized character \x90 at line..
I am getting above error while executing perlcode.exe, But when it is executed as Perl (i.e perlcode.pl) it works like a charm. And, I am surprised I haven't seen any such error in Google. Any help appreciated.
The input file is a LaTeX file which may or may not have Unicode.
Why is .pl working, but .exe is not working?
What is meant by the ERROR: Unrecognized character \x90 at line..?
Note that use utf8; is used in the Perl script.
I had this problem when I wasn't thinking straight. I had compiled the .pl file with perl2exe but was running the command
perl c:\tmp\myexe.exe
Obviously you don't need to have perl at the start - just run the exe
To change the perl code to an .exe file, you'll need to compile it. If you are saying that the pl code works allright, but the exe not, maybe that it's the issue.
One of the options is to use pp to do it. You can find it here.
its a typo mistake which has been made in a batch file while calling exe.

How to force error on SwiftLint instead of warnings?

my question is very simple, how do I make all warnings become errors on SwiftLint? (without manually configuring each rule separately)
To integrate SwiftLint to your project, you normally need to add a Run Script Phase, as described by the doc.
If you used the CocoaPods installation, this script would look like:
"${PODS_ROOT}/SwiftLint/swiftlint"
That is where you can customize the command line options. In your case, you may want to use:
"${PODS_ROOT}/SwiftLint/swiftlint" lint --strict
The warnings will still be displayed as warnings, but an extra error will be given, preventing running or archiving:
Command /bin/sh failed with exit code 3
That is the desired error.

Strange Error with Devel::DProf

I want to profile my Perl code by using Devel::DProf.
when I am running the profiler like
perl5.8 -d:DProf abc.pl # default version of Perl in my PC (Solaris) is 5.003
then it produces the tmon.out file in the current directory, but when I run
dprofpp
then it is not undertanding the command and giving error like command not found.
I know Devel::DProf - a DEPRECATED Perl code profiler, and should use Devel::NYTProf but just want to know why it is giving such an error, may be I am missing something.
How can I solve this?
Find out where you installed dprofpp and ensure that the directory is in your PATH, or call it with the full path.

Gvim syntax highlighting

I was trying to make Gvim highlight syntax of a certain type of file(as Perl) using following command
au BufNewFile,BufRead *.bias setf perl
But as the first line of this file doesn't start with a #!/usr/bin/perl. Gvim is not performing syntax highlighting of Perl. Any solution for this ?
Try this in your .vimrc (I think Gvim still uses that)
autocmd BufRead *.bias set filetype=perl
If you just want to do it for a single file then try:
:set filetype=perl
Just put the line you already have in ~/.vim/ftdetect/bias.vim and it should work. I have several custom files I've set up syntax highlighting for in this way and have had no problems.
(Note: if you're on windows, the path would be ~/vimfiles/ftdetect/bias.vim )

Resources