3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms of version
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
14 # Copyright 2018 Gordon Ross <gordon.w.ross@gmail.com>
18 # Check file for whitespace issues
19 # (space tab, trailing space)
25 stMsg
= 'space tab sequences'
26 twsMsg
= 'has trailing spaces'
28 def err(stream
, fname
, lineno
, msg
):
29 stream
.write("%s:%d: %s\n" % (fname
, lineno
, msg
))
31 def wscheck(fh
, output
=sys
.stderr
):
38 if re
.search(r
' \t', line
):
39 err(output
, fname
, lineno
, stMsg
);
41 if re
.search(r
'[ \t]$', line
):
42 err(output
, fname
, lineno
, twsMsg
);