aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/aristanetworks/goarista/check_line_len.awk
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/aristanetworks/goarista/check_line_len.awk')
-rwxr-xr-xvendor/github.com/aristanetworks/goarista/check_line_len.awk25
1 files changed, 25 insertions, 0 deletions
diff --git a/vendor/github.com/aristanetworks/goarista/check_line_len.awk b/vendor/github.com/aristanetworks/goarista/check_line_len.awk
new file mode 100755
index 000000000..a9db53550
--- /dev/null
+++ b/vendor/github.com/aristanetworks/goarista/check_line_len.awk
@@ -0,0 +1,25 @@
+#!/usr/bin/awk -f
+# Copyright (C) 2015 Arista Networks, Inc.
+# Use of this source code is governed by the Apache License 2.0
+# that can be found in the COPYING file.
+
+BEGIN {
+ max = 100;
+}
+
+# Expand tabs to 4 spaces.
+{
+ gsub(/\t/, " ");
+}
+
+length() > max {
+ errors++;
+ print FILENAME ":" FNR ": Line too long (" length() "/" max ")";
+}
+
+END {
+ if (errors >= 125) {
+ errors = 125;
+ }
+ exit errors;
+}