File: no_using_namespace_in_header_files.py

package info (click to toggle)
widelands 2%3A1.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 600,516 kB
  • sloc: cpp: 166,473; ansic: 18,683; python: 7,697; sh: 1,363; xml: 467; makefile: 45
file content (33 lines) | stat: -rw-r--r-- 609 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/python -tt


def does_include_using_namespace(lines, fn):
    if 'system_headers.h' in fn:
        return []
    if not fn.endswith('.h'):
        return []
    for lineno, line in enumerate(lines, 1):
        if 'using namespace' in line:
            return [(fn, lineno,
                     "Do not use \"using namespace\" in header files.")]
    return []


evaluate_matches = does_include_using_namespace

#################
# ALLOWED TESTS #
#################
allowed = [
    """
""",
]

###################
# FORBIDDEN TESTS #
###################
forbidden = [
    """
using namespace
""",
]