Skip to content

Commit bf1e50a

Browse files
committed
Switch from tidyall to precious
1 parent 3c905ff commit bf1e50a

File tree

6 files changed

+112
-25
lines changed

6 files changed

+112
-25
lines changed

dev-bin/install-xt-tools.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
TARGET="$HOME/bin"
6+
if [ $(id -u) -eq 0 ]; then
7+
TARGET="/usr/local/bin"
8+
fi
9+
echo "Installing dev tools to $TARGET"
10+
11+
mkdir -p $TARGET
12+
curl --silent --location \
13+
https://raw.githubusercontent.com/houseabsolute/ubi/master/bootstrap/bootstrap-ubi.sh |
14+
sh
15+
16+
"$TARGET/ubi" --project houseabsolute/precious --in "$TARGET"
17+
"$TARGET/ubi" --project houseabsolute/omegasort --in "$TARGET"
18+
19+
echo "Add $TARGET to your PATH in order to use precious for linting and tidying"

git/hooks/pre-commit.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
status=0
4+
5+
PRECIOUS=$(which precious)
6+
if [[ -z $PRECIOUS ]]; then
7+
PRECIOUS=./bin/precious
8+
fi
9+
10+
"$PRECIOUS" lint -s
11+
if (( $? != 0 )); then
12+
status+=1
13+
fi
14+
15+
exit $status

git/setup.pl

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env perl
2+
3+
use strict;
4+
use warnings;
5+
6+
use Cwd qw( abs_path );
7+
8+
symlink_hook('pre-commit');
9+
10+
sub symlink_hook {
11+
my $hook = shift;
12+
13+
my $dot = ".git/hooks/$hook";
14+
my $file = "git/hooks/$hook.sh";
15+
my $link = "../../$file";
16+
17+
if ( -e $dot ) {
18+
if ( -l $dot ) {
19+
return if readlink $dot eq $link;
20+
}
21+
warn "You already have a hook at $dot!\n";
22+
return;
23+
}
24+
25+
symlink $link, $dot
26+
or die "Could not link $dot => $link: $!";
27+
}

perltidyrc

-5
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,3 @@
2020
--no-outdent-long-comments
2121
--iterations=2
2222
-wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="
23-
# This appears to be needed with recent Perl::Tidy versions and
24-
# Code::TidyAll. Otherwise it somehow turns UTF-8 POD text into
25-
# ISO-8859-1. Setting this to utf8 doesn't work. This is almost certainly
26-
# because of https://github.com/houseabsolute/perl-code-tidyall/issues/84
27-
--character-encoding=none

precious.toml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
exclude = [
2+
".build/**/*",
3+
"Dist-Zilla-Plugin-Conflicts-*/**/*",
4+
"blib/**/*",
5+
"t/00-*",
6+
"t/author-*",
7+
"t/release-*",
8+
"t/zzz-*",
9+
"xt/**/*",
10+
]
11+
12+
[commands.omegasort-gitignore]
13+
type = "both"
14+
include = "**/.gitignore"
15+
cmd = [ "omegasort", "--sort=path" ]
16+
lint_flags = "--check"
17+
tidy_flags = "--in-place"
18+
ok_exit_codes = 0
19+
lint_failure_exit_codes = 1
20+
21+
[commands.perlcritic]
22+
type = "lint"
23+
include = [ "**/*.{pl,pm,t,psgi}" ]
24+
cmd = [ "perlcritic", "--profile=$PRECIOUS_ROOT/perlcriticrc" ]
25+
ok_exit_codes = 0
26+
lint_failure_exit_codes = 2
27+
28+
[commands.perltidy]
29+
type = "both"
30+
include = [ "**/*.{pl,pm,t,psgi}" ]
31+
cmd = [ "perltidy", "--profile=$PRECIOUS_ROOT/perltidyrc" ]
32+
lint_flags = [ "--assert-tidy", "--no-standard-output", "--outfile=/dev/null" ]
33+
tidy_flags = [ "--backup-and-modify-in-place", "--backup-file-extension=/" ]
34+
ok_exit_codes = 0
35+
lint_failure_exit_codes = 2
36+
ignore_stderr = "Begin Error Output Stream"
37+
38+
[commands.podchecker]
39+
type = "lint"
40+
include = [ "**/*.{pl,pm,pod}" ]
41+
cmd = [ "podchecker", "--warnings", "--warnings" ]
42+
ok_exit_codes = [ 0, 2 ]
43+
lint_failure_exit_codes = 1
44+
ignore_stderr = [ ".+ pod syntax OK", ".+ does not contain any pod commands" ]
45+
46+
[commands.podtidy]
47+
type = "tidy"
48+
include = [ "**/*.{pl,pm,pod}" ]
49+
cmd = [ "podtidy", "--columns", "80", "--inplace", "--nobackup" ]
50+
ok_exit_codes = 0
51+
lint_failure_exit_codes = 1

tidyall.ini

-20
This file was deleted.

0 commit comments

Comments
 (0)