Patchwork [4,of,6] check-code: explain what to do when a check-code rule mismatches

login
register
mail settings
Submitter Simon Heimberg
Date Jan. 7, 2014, 9:31 p.m.
Message ID <6aa029ecd4c902e348a3.1389130280@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/3273/
State Superseded
Commit 8071b4eddefa9154646fa6673f078ae4ee97056e
Headers show

Comments

Simon Heimberg - Jan. 7, 2014, 9:31 p.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1389130184 -3600
#      Tue Jan 07 22:29:44 2014 +0100
# Node ID 6aa029ecd4c902e348a32ab576a7ce9dfbaea449
# Parent  c9c1f06e53c0af7aeb5c646b44dbbe42bca14fe1
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.

Patch

diff -r c9c1f06e53c0 -r 6aa029ecd4c9 contrib/check-code.py
--- a/contrib/check-code.py	Tue Jan 07 22:29:39 2014 +0100
+++ b/contrib/check-code.py	Tue Jan 07 22:29:44 2014 +0100
@@ -7,6 +7,18 @@ 
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
+"""style and portability checker for Mercurial
+
+when a rule triggers wrong, do one of the following (prefer one from top):
+ * do the work-around the rule suggests
+ * doublecheck that it is a false match
+ * improve the rule pattern
+ * add an ignore pattern to the rule (3rd arg) which matches your good line
+   (you can append a short comment and match this, like: #re-raises, # no-py24)
+ * change the pattern to a warning and list the exception in test-check-code-hg
+ * ONLY use no--check-code for skipping entire files from external sources
+"""
+
 import re, glob, os, sys
 import keyword
 import optparse