1
0
Fork 0

Added chk-linelen tool

The maximum line length for source files in this project is 80 characters
perfodd
Mike Gerwitz 2012-05-03 20:58:51 -04:00
parent 28bf9e6421
commit 4159e7c26f
No known key found for this signature in database
GPG Key ID: F22BB8158EE30EAB
2 changed files with 48 additions and 0 deletions

42
tools/linechk 100755
View File

@ -0,0 +1,42 @@
#!/bin/sh
#
# Code quality tool; check line length of each file in certain directories
#
# For a list of ignored patterns, see chk-linelen-ignores
#
# Copyright (C) 2012 Mike Gerwitz
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
##
root="${1:-.}"
hideignores()
{
grep -v "$(
sed '/^#/d;
s/\n/|/g;
s/|$//;
' "$root/tools/linechk-ignores"
)"
}
# output all file with lines > 80 characters and exit successfully if grep has a
# non-zero status code, indicating that no matches were found
cd "$root" && \
find lib/ tools/ test/ doc/ README* LICENSE Makefile *.js \
-type f -exec wc -L {} \; \
| hideignores \
| grep -v '^\([0-7][0-9]\?\|80\?\) ' \
|| exit 0

View File

@ -0,0 +1,6 @@
# any file matching any pattern in this file is ignored by the line check tool
# (uses POSIX regular expressions, as is default in grep)
doc/highlight.pack.js$
.png$
.dia$
.jar$