changeset 43112:24a07347aa60

check-commit: allow foo_bar naming in functions nameswithallthewordssmashedtogetherarehardtoread. especiallyifenglishisnotyourprimarylanguage. Let's align with the rest of the programming universe and allow_the_use_of_underscores_in_names. We took a hand poll at the 5.2 sprint regarding this change and all but 1 person supported it. The person who didn't expressed concerns around excessive API breakage if we mass renamed things. But we're not planning to mass rename things for the sake of renaming, so all should be well. Differential Revision: https://phab.mercurial-scm.org/D2010
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 02 Feb 2018 10:13:42 -0800
parents e5d535621ee1
children 37af48031d6f
files contrib/check-code.py contrib/check-commit tests/test-contrib-check-commit.t
diffstat 3 files changed, 0 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/check-code.py	Tue Oct 08 13:38:02 2019 -0400
+++ b/contrib/check-code.py	Fri Feb 02 10:13:42 2018 -0800
@@ -340,8 +340,6 @@
         ),
         (r'[^\n]\Z', "no trailing newline"),
         (r'(\S[ \t]+|^[ \t]+)\n', "trailing whitespace"),
-        #    (r'^\s+[^_ \n][^_. \n]+_[^_\n]+\s*=',
-        #     "don't use underbars in identifiers"),
         (
             r'^\s+(self\.)?[A-Za-z][a-z0-9]+[A-Z]\w* = ',
             "don't use camelcase in identifiers",
--- a/contrib/check-commit	Tue Oct 08 13:38:02 2019 -0400
+++ b/contrib/check-commit	Fri Feb 02 10:13:42 2018 -0800
@@ -39,12 +39,6 @@
      "summary keyword should be most user-relevant one-word command or topic"),
     (afterheader + r".*\.\s*\n", "don't add trailing period on summary line"),
     (afterheader + r".{79,}", "summary line too long (limit is 78)"),
-    # Forbid "_" in function name.
-    #
-    # We skip the check for cffi related functions. They use names mapping the
-    # name of the C function. C function names may contain "_".
-    (r"\n\+[ \t]+def (?!cffi)[a-z]+_[a-z]",
-     "adds a function with foo_bar naming"),
 ]
 
 word = re.compile(r'\S')
--- a/tests/test-contrib-check-commit.t	Tue Oct 08 13:38:02 2019 -0400
+++ b/tests/test-contrib-check-commit.t	Fri Feb 02 10:13:42 2018 -0800
@@ -130,6 +130,4 @@
    This has no topic and ends with a period.
   7: don't add trailing period on summary line
    This has no topic and ends with a period.
-  20: adds a function with foo_bar naming
-   + def blah_blah(x):
   [1]