Skip to content

Commit 3440c44

Browse files
committed
Add precious config and tooling
1 parent fba9ae9 commit 3440c44

5 files changed

Lines changed: 123 additions & 31 deletions

File tree

dev-bin/install-xt-tools.sh

Lines changed: 19 additions & 0 deletions
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

Lines changed: 15 additions & 0 deletions
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

Lines changed: 27 additions & 0 deletions
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+
}

precious.toml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
exclude = [
2+
".build/**/*",
3+
"FileLibMagic-*/**/*",
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+
expect_stderr = true
21+
22+
[commands.omegasort-stopwords]
23+
type = "both"
24+
include = ".stopwords"
25+
cmd = [ "omegasort", "--sort=text", "--case-insensitive" ]
26+
lint_flags = "--check"
27+
tidy_flags = "--in-place"
28+
ok_exit_codes = 0
29+
lint_failure_exit_codes = 1
30+
expect_stderr = true
31+
32+
[commands.perlcritic]
33+
type = "lint"
34+
include = [ "**/*.{pl,pm,t,psgi}" ]
35+
cmd = [ "perlcritic", "--profile=$PRECIOUS_ROOT/perlcriticrc" ]
36+
ok_exit_codes = 0
37+
lint_failure_exit_codes = 2
38+
39+
[commands.perltidy]
40+
type = "both"
41+
include = [ "**/*.{pl,pm,t,psgi}" ]
42+
cmd = [ "perltidy", "--profile=$PRECIOUS_ROOT/perltidyrc" ]
43+
lint_flags = [ "--assert-tidy", "--no-standard-output", "--outfile=/dev/null" ]
44+
tidy_flags = [ "--backup-and-modify-in-place", "--backup-file-extension=/" ]
45+
ok_exit_codes = 0
46+
lint_failure_exit_codes = 2
47+
expect_stderr = true
48+
49+
[commands.podchecker]
50+
type = "lint"
51+
include = [ "**/*.{pl,pm,pod}" ]
52+
cmd = [ "podchecker", "--warnings", "--warnings" ]
53+
ok_exit_codes = [ 0, 2 ]
54+
lint_failure_exit_codes = 1
55+
expect_stderr = true
56+
57+
[commands.podtidy]
58+
type = "tidy"
59+
include = [ "**/*.{pl,pm,pod}" ]
60+
cmd = [ "podtidy", "--columns", "80", "--inplace", "--nobackup" ]
61+
ok_exit_codes = 0
62+
lint_failure_exit_codes = 1

tidyall.ini

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)