File size: 1,051 Bytes
c6efd2c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#! /usr/bin/env python3
# Original code (2015) by Filip Ginter and Sampo Pyysalo.
# DZ 2018-11-04: Porting the validator to Python 3.
# DZ: Many subsequent changes. See the git history.
import sys
# Import the Validator class from the package subfolder regardless whether it
# is installed as a package.
from udtools.src.udtools.validator import Validator
from udtools.src.udtools.argparser import parse_args_validator



#==============================================================================
# The main function.
#==============================================================================



def main():
    args = parse_args_validator()
    validator = Validator(lang=args.lang, level=args.level, max_store=10, args=args)
    state = validator.validate_files(args.input)
    # Summarize the warnings and errors.
    summary = str(state)
    if not args.quiet:
        print(summary, file=sys.stderr)
    if state.passed():
        return 0
    else:
        return 1

if __name__=="__main__":
    errcode = main()
    sys.exit(errcode)