summaryrefslogtreecommitdiff
path: root/ACE/bin/PythonACE/fuzz/newline.py
blob: 39847e05c65da8a1604bf6ed7b3d69dc3ffca38c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
""" Checks that the file has a newline at the end. """

type_list = ["cpp", "h", "inl", "html", "idl", "pl"]

import re
from sys import stderr

regex = re.compile ("\n\Z")

def handler (file_name, file_content):
    if regex.search (file_content) == None:
        stderr.write (file_name + ":0: error: " + file_name + " lacks a newline at the end of the file.\n")
        return 1
    else:
        return 0