iutest_incg_test   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 2

1 Function

Rating   Name   Duplication   Size   Complexity  
A main() 0 9 2
1
#!/usr/bin/env python
2
# -*- coding: utf-8 -*-
3
#
4
# iutest_incg_test.py
5
#
6
# Copyright (C) 2016, Takazumi Shirayanagi
7
# This software is released under the new BSD License,
8
# see LICENSE
9
#
10
11
import os
12
import sys
13
import re
14
import codecs
15
16
17
def main():
18
    filepath = sys.argv[1]
19
    incg = os.path.basename(filepath).upper().replace('.', '_')
20
    f = codecs.open(filepath, 'r', 'utf-8-sig')
21
    text = f.read()
22
    f.close()
23
    r = '\s*#\s*ifndef[/\s]*INCG_IRIS_{0}\S*\s*'.format(incg)
24
    if not re.search(r, text):
25
        exit(1)
26
27
28
if __name__ == '__main__':
29
    main()
30