~widelands-dev/widelands/bug-1808169-disable-focus

« back to all changes in this revision

Viewing changes to cmake/codecheck/rules/missing_space_after_control_structure_keyword

  • Committer: qcs
  • Date: 2010-02-05 01:13:20 UTC
  • Revision ID: git-v1:136d6c48811c97ec1f98301726134b0de66f868c
Manual merge of cmake-migration branch to trunk

git-svn-id: https://widelands.svn.sourceforge.net/svnroot/widelands/trunk@5030 37b2a8de-5219-0410-9f54-a31bc463ab9c

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
 
 
3
 
 
4
"""
 
5
This catches code like "for(", which should be "for (". It includes all
 
6
keywords that denote control structures. But it should not catch declarations,
 
7
definitions or calls of functions whose name happens to end with a control
 
8
structure keyword, for example "meanwhile(parameter)".
 
9
"""
 
10
 
 
11
error_msg ="A space is mandatory after catch/for/if/switch/throw/while."
 
12
 
 
13
regexp=r"""[^_a-zA-Z0-9](catch|for|if|switch|throw|while)\("""
 
14
 
 
15
forbidden = [
 
16
    '   for(;;)',
 
17
    '   catch(...) {',
 
18
    '   while(true)',
 
19
    "   throw('\n')",
 
20
]
 
21
 
 
22
allowed = [
 
23
    '   meanwhile(true)',
 
24
    '   while (true)',
 
25
    '   for (;;)',
 
26
    '   catch (...) {',
 
27
]