~widelands-dev/widelands/wares_queues_taverns_trainingsites

« back to all changes in this revision

Viewing changes to cmake/codecheck/rules/long_line

Merged trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python -tt
2
 
 
3
 
class EvalMatches( object ):
4
 
    def __call__(self, lines, fn):
5
 
        errors = []
6
 
        curline = 1
7
 
        for l in lines:
8
 
            l = l.rstrip('\r').rstrip('\n')
9
 
            l = l.expandtabs(3)
10
 
            if len(l) > 110:
11
 
                errors.append( (fn, curline, "Line is too long! Keep it < 110 chars (with tab width of 3)"))
12
 
            curline += 1
13
 
        return errors
14
 
 
15
 
 
16
 
evaluate_matches = EvalMatches()
17
 
 
18
 
forbidden = [
19
 
    " "*110+"a",
20
 
    '\t\t' + 105*"a"
21
 
]
22
 
 
23
 
allowed = [
24
 
    "\t\tResonable sized line",
25
 
    " "*110,
26
 
    '\t\t' + 104*"a",
27
 
    # When tabs are correctly expanded, the next line is only 79 chars long
28
 
    # when tabs are replaced, it is 81
29
 
    """\t\t\t \t \t (Coords(s.get_safe_int("pointy_x"), s.get_safe_int("point_y")))"""
30
 
]