summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2018-10-02 06:24:25 +0200
committerGitHub <noreply@github.com>2018-10-02 06:24:25 +0200
commitabe9b579f25120898b714d4b73343918169d48ac (patch)
treead5c1129e37a58e5f14c1e56d0376092f827268b /scripts
parent3f104aa43d746c602b179564c96fce0d4d682886 (diff)
downloadbugzilla-abe9b579f25120898b714d4b73343918169d48ac.tar.gz
bugzilla-abe9b579f25120898b714d4b73343918169d48ac.tar.xz
no bug - adopt mojolicious code formatting guidelines (#784)
@kyoshino likes 2-char indent for all the frontend. Mojolicious seems to use 2-space too. Let's just adopt their perltidyrc. Included in this is a script (in scripts/) that will modify files according to these rules.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/perl-fmt24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/perl-fmt b/scripts/perl-fmt
new file mode 100644
index 000000000..4b5ea3565
--- /dev/null
+++ b/scripts/perl-fmt
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+use 5.10.1;
+use strict;
+use warnings;
+
+use File::Basename qw(dirname);
+use Cwd qw(realpath);
+use File::Spec::Functions qw(catfile catdir);
+use Env qw(@PATH @PERL5LIB);
+
+my $bugzilla_dir = realpath(catdir( dirname(__FILE__), '..' ));
+unshift @PERL5LIB, catdir($bugzilla_dir, 'local', 'lib', 'perl5');
+unshift @PATH, catdir($bugzilla_dir, 'local', 'bin');
+
+my $profile = catfile($bugzilla_dir, ".perltidyrc" );
+warn "formatting @ARGV\n";
+exec( perltidy => "--profile=$profile", '-nst', '-b', '-bext=/', '-conv', @ARGV );