[PATCH 4 of 4] checkcode: enforce lowercase for extension docstring title

Jun Wu quark at fb.com
Fri Mar 24 00:24:48 EDT 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1490329401 25200
#      Thu Mar 23 21:23:21 2017 -0700
# Node ID 0a73985fe80237a67ca50d7642ba6e02ed45e8e3
# Parent  f2026595cb39cce3934995d6a3f8aa3d97b30501
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 0a73985fe802
checkcode: enforce lowercase for extension docstring title

This will ensure new extensions are consistent and `hg help -e` has a
consistent output.

I have to add a new group since the normal "pypats" will be filtered by
"pyfilters", which will remove comments and docstrings.

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -372,4 +372,11 @@ pyfilters = [
 ]
 
+# extension non-filter patterns
+pyextnfpats = [
+    [(r'^"""\n?[A-Z]', "don't capitalize docstring title")],
+    # warnings
+    [],
+]
+
 txtfilters = []
 
@@ -481,4 +488,5 @@ py3pats = [
 checks = [
     ('python', r'.*\.(py|cgi)$', r'^#!.*python', pyfilters, pypats),
+    ('python', r'.*hgext.*\.py$', '', [], pyextnfpats),
     ('python 3', r'.*(hgext|mercurial).*(?<!pycompat)\.py', '',
             pyfilters, py3pats),


More information about the Mercurial-devel mailing list