D2010: check-commit: allow foo_bar naming in functions

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Tue Oct 8 04:53:57 UTC 2019


indygreg edited the summary of this revision.
indygreg updated this revision to Diff 16959.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2010?vs=5162&id=16959

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D2010/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D2010

AFFECTED FILES
  contrib/check-code.py
  contrib/check-commit
  tests/test-contrib-check-commit.t

CHANGE DETAILS

diff --git a/tests/test-contrib-check-commit.t b/tests/test-contrib-check-commit.t
--- a/tests/test-contrib-check-commit.t
+++ b/tests/test-contrib-check-commit.t
@@ -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]
diff --git a/contrib/check-commit b/contrib/check-commit
--- a/contrib/check-commit
+++ b/contrib/check-commit
@@ -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')
diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -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",



To: indygreg, #hg-reviewers, pulkit, durin42, martinvonz, marmoute
Cc: martinvonz, av6, yuja, durin42, pulkit, mercurial-devel


More information about the Mercurial-devel mailing list