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

login
register
mail settings
Submitter Jun Wu
Date March 24, 2017, 4:24 a.m.
Message ID <0a73985fe80237a67ca5.1490329488@localhost.localdomain>
Download mbox | patch
Permalink /patch/19621/
State Accepted
Headers show

Comments

Jun Wu - March 24, 2017, 4:24 a.m.
# HG changeset patch
# User Jun Wu <quark@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.
Augie Fackler - March 24, 2017, 1:24 p.m.
On Thu, Mar 23, 2017 at 09:24:48PM -0700, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark@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

Queued, thanks.

>
> 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),
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

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),