Skip to content

Comments

Ensure we use an up-to-date Perl::Tidy#3

Open
chizmeeple wants to merge 3 commits intohenryykt:masterfrom
chizmeeple:master
Open

Ensure we use an up-to-date Perl::Tidy#3
chizmeeple wants to merge 3 commits intohenryykt:masterfrom
chizmeeple:master

Conversation

@chizmeeple
Copy link

Discovered today that I was sharing a project where I was running
20190601 and another dev was running 20121207 .. and we were getting
different results from the pre-commit checks

Discovered today that I was sharing a project where I was running
`20190601` and another dev was running `20121207` .. and we were getting
different results from the pre-commit checks
@henryykt
Copy link
Owner

@chiselwright thanks for the PR. However, hardcoding a minimum version seems too restrictive. Instead, I think it's better to pass in the minimum version as args (for example "--min-version 20190601") so it can be overridden by the YAML config file if necessary.

@chizmeeple
Copy link
Author

In my test project:

[1018][cwright@dev-cwright:pre-commit-perl-test-project][master✘]➔ git commit -av
Trim Trailing Whitespace.................................................Passed
Fix End of Files.........................................................Passed
Check Yaml...........................................(no files to check)Skipped
Check for added large files..............................................Passed
perlcritic...............................................................Failed
hookid: perlcritic

perl.pl:
[TestingAndDebugging::RequireUseStrict] Code before strictures are enabled at line 3, column 1.  (Severity: 5)
[TestingAndDebugging::RequireUseWarnings] Code before warnings are enabled at line 3, column 1.  (Severity: 4)

perltidy.................................................................Failed
hookid: perltidy

Please update Perl::Tidy to at least version 20190602

After this change:

[1018][cwright@dev-cwright:pre-commit-perl-test-project][master✘]➔ git show
commit b0e9242a0bdaf89593e969bb4710d14b93593e0e (HEAD -> master)
Author: Chisel <chisel.wright@zpg.co.uk>
Date:   2019-09-04 17:04:07 +0100

    Ask for a version of perltidy that doesn't exist

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 4e2e389..48a9582 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -13,4 +13,4 @@ repos:
     hooks:
     - id: perlcritic
     - id: perltidy
-      args: [--min-version=20190601]
+      args: [--min-version=20190602]

@chizmeeple
Copy link
Author

chizmeeple commented Sep 4, 2019

Confirming that it passes with the latest version available/installed:

[1018][cwright@dev-cwright:pre-commit-perl-test-project][master✘]➔ git revert HEAD
[master 59b4507] Revert "Ask for a version of perltidy that doesn't exist"
 1 file changed, 1 insertion(+), 1 deletion(-)
[1018][cwright@dev-cwright:pre-commit-perl-test-project][master✘]➔ git commit -av
Trim Trailing Whitespace.................................................Passed
Fix End of Files.........................................................Passed
Check Yaml...........................................(no files to check)Skipped
Check for added large files..............................................Passed
perlcritic...............................................................Failed
hookid: perlcritic

perl.pl:
[TestingAndDebugging::RequireUseStrict] Code before strictures are enabled at line 3, column 1.  (Severity: 5)
[TestingAndDebugging::RequireUseWarnings] Code before warnings are enabled at line 3, column 1.  (Severity: 4)

perltidy.................................................................Passed```

@chizmeeple
Copy link
Author

Finally, without any arg at all:

[1018][cwright@dev-cwright:pre-commit-perl-test-project][master✘]➔ git show
commit 0191910b8ffe4a73f31863948a8a5c41921c1ffb (HEAD -> master)
Author: Chisel <chisel.wright@zpg.co.uk>
Date:   2019-09-04 17:09:39 +0100

    Remove perltidy arg

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 4e2e389..343ba51 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -13,4 +13,3 @@ repos:
     hooks:
     - id: perlcritic
     - id: perltidy
-      args: [--min-version=20190601]
[1018][cwright@dev-cwright:pre-commit-perl-test-project][master✘]➔ git commit -av
Trim Trailing Whitespace.................................................Passed
Fix End of Files.........................................................Passed
Check Yaml...........................................(no files to check)Skipped
Check for added large files..............................................Passed
perlcritic...............................................................Failed
hookid: perlcritic

perl.pl:
[TestingAndDebugging::RequireUseStrict] Code before strictures are enabled at line 3, column 1.  (Severity: 5)
[TestingAndDebugging::RequireUseWarnings] Code before warnings are enabled at line 3, column 1.  (Severity: 4)

perltidy.................................................................Passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants