GIF89a; EcchiShell v1.0
//usr/lib64/lib64/lib64/lib64/python2.7/ ', openers # Balance opening and closing braces for open, close in braces.findall(line): if open == '{': bracestack.append(lineno) if close == '}': try: bracestack.pop() except IndexError: print r'Warning, unmatched } on line %s.' % (lineno,) # Optionally, skip LaTeX specific checks if '-d' in opts: continue # Warn whenever forward slashes encountered with a LaTeX command for cmd in falsetexcmd.findall(line): if '822' in line or '.html' in line: continue # Ignore false positives for urls and for /rfc822 if '\\' + cmd in validcmds: print 'Warning, forward slash used on line %d with cmd: /%s' % (lineno, cmd) # Check for markup requiring {} for correct spacing for cmd in spacingmarkup.findall(line): print r'Warning, \%s should be written as \%s{} on line %d' % (cmd, cmd, lineno) # Validate commands nc = line.find(r'\newcommand') if nc != -1: start = line.find('{', nc) end = line.find('}', start) validcmds.add(line[start+1:end]) for cmd in texcmd.findall(line): if cmd not in validcmds: print r'Warning, unknown tex cmd on line %d: \%s' % (lineno, cmd) # Check table levels (make sure lineii only inside tableii) m = tablestart.search(line) if m: tablelevel = m.group(1) tablestartline = lineno m = tableline.search(line) if m and m.group(1) != tablelevel: print r'Warning, \line%s on line %d does not match \table%s on line %d' % (m.group(1), lineno, tablelevel, tablestartline) if tableend.search(line): tablelevel = '' # Style guide warnings if 'e.g.' in line or 'i.e.' in line: print r'Style warning, avoid use of i.e or e.g. on line %d' % (lineno,) for dw in doubledwords.findall(line): print r'Doubled word warning. "%s" on line %d' % (dw, lineno) lastline = lineno for lineno, symbol in openers: print "Unmatched open delimiter '%s' on line %d" % (symbol, lineno) for lineno in bracestack: print "Unmatched { on line %d" % (lineno,) print 'Done checking %d lines.' % (lastline,) return 0 def main(args=None): if args is None: args = sys.argv[1:] optitems, arglist = getopt.getopt(args, "k:mdhs:v") opts = dict(optitems) if '-h' in opts or args==[]: print __doc__ return 0 if len(arglist) < 1: print 'Please specify a file to be checked' return 1 for i, filespec in enumerate(arglist): if '*' in filespec or '?' in filespec: arglist[i:i+1] = glob.glob(filespec) morecmds = [v for k,v in optitems if k=='-k'] err = [] for filename in arglist: print '=' * 30 print "Checking", filename try: f = open(filename) except IOError: print 'Cannot open file %s.' % arglist[0] return 2 try: err.append(checkit(f, opts, morecmds)) finally: f.close() return max(err) if __name__ == '__main__': sys.exit(main())