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

« back to all changes in this revision

Viewing changes to cmake/codecheck/rules/line_starting_with_space_followed_by_control_structure

  • 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
Lines with control structures affect how editors indent the controlled lines
 
6
following them. So an existing line of that kind that is badly indented can
 
7
cause newly added code to become badly indented. Therefore it is especially
 
8
important that the control structures are correctly indented. 
 
9
 
 
10
This does not yet include for loops, because there are still too many of them
 
11
that need fixing and they should eventually be replaced with iteration macros
 
12
anyway. 
 
13
 
 
14
I disagree with the macros. I do not think they add to the clarity of the code.
 
15
  -- SirVer
 
16
"""
 
17
 
 
18
error_msg = "Bad indentation."
 
19
 
 
20
strip_comments_and_strings = True
 
21
strip_macros = True
 
22
regexp=r"""^    * +(\{|case|else|try|(catch|if|switch|while) *\()"""
 
23
 
 
24
forbidden = [
 
25
    '   {',
 
26
    '   else',
 
27
    '   if (a)',
 
28
    '   switch (a)',
 
29
    '   while (a)',
 
30
]
 
31
 
 
32
allowed = [
 
33
    '   {',
 
34
    '   }',
 
35
    '   else',
 
36
    '   if (a)',
 
37
    '   switch (a)',
 
38
    '   while (a)',
 
39
"""#define iterate_players_existing(p, nr_players, egbase, player)               \\
 
40
   iterate_player_numbers(p, nr_players)                                      \\
 
41
      if (Widelands::Player * const player = (egbase).get_player(p))          \\""",
 
42
 
 
43
]