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
RequireTidyCode doesn't work correctly on files with utf8 #925
Comments
CodeLayout::RequireTidyCode-policy for files with utf8|
I suppose #876 will fix that. |
|
Hi, Earlier versions of The associated Debian bug breaks parts of Lintian's CI (on Salsa). We do not enforce style for builds, but Perl::Critic is, well, critical for our project maintenance. It ensures that code submitted by a wide range of contributors adheres to a common standard. We implemented almost all policies we could find, and are working on more. Would it be possible to restore the behavior from Debian's 1.138-2? Thanks for your great software! Kind regards |
|
@lechner: We need to know more about what your problems are. Do you have a minimal example of a file that used to pass but no longer does? Are 1.138-1 and 1.140 the versions of Perl::Critic that you were using? What is different between 1.138-1 and stock 1.138? And from 1.140-2 and stock 1.140? I'm looking in the change log and I don't see anything that sounds related to your problem. There seem to be a lot of moving parts, and I don't know that Perl::Critic itself is what changed to cause your problem. Nor do I know that it isn't. |
|
On Wed, 15 Dec 2021 11:27:14 -0800, Andy Lester wrote:
@lechner: We need to know more about what your problems are.
Do you have a minimal example of a file that used to pass but no longer does?
I have to leave this for @lechner.
Are 1.138-1 and 1.140 the versions of Perl::Critic that you were
using? What is different between 1.138-1 and stock 1.138? And from
1.140-2 and stock 1.140?
$version-1 and $version-2 are the "Debian revision", i.e. the versions of the
package, IOW: "libperl-critic-perl 1.138-2" was the second upload of
Perl::Critic 1.138 to Debian, and 1.140-1 the first upload of the
1.140 upstream release.
You can see the package's changelog at
<https://tracker.debian.org/media/packages/libp/libperl-critic-perl/changelog-1.140-1>
or the packaging Git repo at
<https://salsa.debian.org/perl-team/modules/packages/libperl-critic-perl/-/commits/master/>
for the details.
Neither 1.138-{1,2} nor 1.140-1 contained any patches, the actual
shipped code is 1:1 the same as in the Perl::Critic release tarballs
on the CPAN.
Cheers,
gregor
|
|
Hi, I also see the issue when keeping I used the Thank you! Kind regards |
|
The latest release of Perl::Tidy has a parameter --encode-output-strings (-eos) which can be set to fix this problem. The parameter was added to fix a similar problem between Code::TidyAll and Perl::Tidy; for more information see houseabsolute/perl-code-tidyall#84. The problem is that when The reason that some users saw this problem arise at some point is that in Perl::Tidy release 20200619 the default encoding was changed from So a simple way to fix the problem would be to set To illustrate how it might be done in the code, so that individual users do not need to set this flag, I updated my version of With this update, the test case |
…ntil Perl-Critic/Perl-Critic#925 is fixed This more or less reverts 1a3f6ee (Replace "Copyright (C)" with the Unicode copyright symbol in our own code for consistency.) for now.
…ic/Perl-Critic#925 is fixed Actually all of them are copyright comment except for a single Unicode SECTION SIGN character somewhere else.
…itic#925 is fixed Lintian's own test t/scripts/01-critic/libs.t fails otherwise.
|
Updating to the most recent release of Perl::Tidy (v20220613 or later) should fix this problem. It has the above mentioned -eos flag set 'on' by default. |
|
confirmed, fixed. bash-3.2$ docker run -v $PWD:/app -w /app perl:5.36 bash -c 'cpanm Perl::Critic && perlcritic --single-policy=RequireTidyCode test.pl test8.pl'
--> Working on Perl::Critic
...
Successfully installed Perl-Tidy-20220613
...
Successfully installed Perl-Critic-1.140
43 distributions installed
test.pl source OK
test8.pl source OK
bash-3.2$ grep -n . test*.pl
test.pl:1:#!/usr/bin/perl
test.pl:2:#
test.pl:3:# test
test8.pl:1:#!/usr/bin/perl
test8.pl:2:#
test8.pl:3:# te тест st
bash-3.2$ |
sopov commentedSep 17, 2020
•
edited
We have two test files, one with a comment in ASCII and one with utf8-chars:
test.pl:
and test8.pl with same content but instert to line with comment
te >utf8 chars< stLet's check the files with the only
RequireTidyCode-policy:The text was updated successfully, but these errors were encountered: