comparison contrib/check-code.py @ 20241:8071b4eddefa

check-code: explain what to do when a check-code rule mismatches In the past several approaches were used when a check-code rule triggered without a good reason. Not all of them looked nice, some were even wrong. Suggest some good practices which should be used instead.
author Simon Heimberg <simohe@besonet.ch>
date Tue, 07 Jan 2014 22:29:44 +0100
parents 16b5f498f49c
children 2dad90bdf29d
comparison
equal deleted inserted replaced
20240:60c4d76b79b5 20241:8071b4eddefa
4 # 4 #
5 # Copyright 2010 Matt Mackall <mpm@selenic.com> 5 # Copyright 2010 Matt Mackall <mpm@selenic.com>
6 # 6 #
7 # This software may be used and distributed according to the terms of the 7 # This software may be used and distributed according to the terms of the
8 # GNU General Public License version 2 or any later version. 8 # GNU General Public License version 2 or any later version.
9
10 """style and portability checker for Mercurial
11
12 when a rule triggers wrong, do one of the following (prefer one from top):
13 * do the work-around the rule suggests
14 * doublecheck that it is a false match
15 * improve the rule pattern
16 * add an ignore pattern to the rule (3rd arg) which matches your good line
17 (you can append a short comment and match this, like: #re-raises, # no-py24)
18 * change the pattern to a warning and list the exception in test-check-code-hg
19 * ONLY use no--check-code for skipping entire files from external sources
20 """
9 21
10 import re, glob, os, sys 22 import re, glob, os, sys
11 import keyword 23 import keyword
12 import optparse 24 import optparse
13 try: 25 try: