Patchwork check-commit: allow underbars in cffi_-prefix function names

login
register
mail settings
Submitter Augie Fackler
Date Aug. 5, 2016, 9:28 p.m.
Message ID <91bc284fa60d068f88b9.1470432500@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/16132/
State Accepted
Headers show

Comments

Augie Fackler - Aug. 5, 2016, 9:28 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1470432471 14400
#      Fri Aug 05 17:27:51 2016 -0400
# Node ID 91bc284fa60d068f88b988b149a05c0d14aee0b5
# Parent  834b8ac4a7587562dccb527b28606ecf5532e883
check-commit: allow underbars in cffi_-prefix function names

It seems reasonable to give cffi functions slightly more verbose names
in some circumstances, given the way they interface with C.
Pierre-Yves David - Aug. 5, 2016, 11:40 p.m.
On 08/05/2016 11:28 PM, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1470432471 14400
> #      Fri Aug 05 17:27:51 2016 -0400
> # Node ID 91bc284fa60d068f88b988b149a05c0d14aee0b5
> # Parent  834b8ac4a7587562dccb527b28606ecf5532e883
> check-commit: allow underbars in cffi_-prefix function names
>
> It seems reasonable to give cffi functions slightly more verbose names
> in some circumstances, given the way they interface with C.

That seems reasonable because, cffi maps C function with "_" in their name

>
> diff --git a/contrib/check-commit b/contrib/check-commit
> --- a/contrib/check-commit
> +++ b/contrib/check-commit
> @@ -41,7 +41,8 @@ errors = [
>      (afterheader + r".{79,}", "summary line too long (limit is 78)"),
>      (r"\n\+\n( |\+)\n", "adds double empty line"),
>      (r"\n \n\+\n", "adds double empty line"),
> -    (r"\n\+[ \t]+def [a-z]+_[a-z]", "adds a function with foo_bar naming"),
> +    (r"\n\+[ \t]+def (?!cffi)[a-z]+_[a-z]",
> +     "adds a function with foo_bar naming"),
>  ]

Can we have an inline comment about this cffi thing, this code is 
already quite scary to new comer.

Cheers,
Augie Fackler - Aug. 5, 2016, 11:58 p.m.
> On Aug 5, 2016, at 7:40 PM, Pierre-Yves David <pierre-yves.david@ens-lyon.org> wrote:
> 
> 
> 
> On 08/05/2016 11:28 PM, Augie Fackler wrote:
>> # HG changeset patch
>> # User Augie Fackler <augie@google.com>
>> # Date 1470432471 14400
>> #      Fri Aug 05 17:27:51 2016 -0400
>> # Node ID 91bc284fa60d068f88b988b149a05c0d14aee0b5
>> # Parent  834b8ac4a7587562dccb527b28606ecf5532e883
>> check-commit: allow underbars in cffi_-prefix function names
>> 
>> It seems reasonable to give cffi functions slightly more verbose names
>> in some circumstances, given the way they interface with C.
> 
> That seems reasonable because, cffi maps C function with "_" in their name
> 
>> 
>> diff --git a/contrib/check-commit b/contrib/check-commit
>> --- a/contrib/check-commit
>> +++ b/contrib/check-commit
>> @@ -41,7 +41,8 @@ errors = [
>>     (afterheader + r".{79,}", "summary line too long (limit is 78)"),
>>     (r"\n\+\n( |\+)\n", "adds double empty line"),
>>     (r"\n \n\+\n", "adds double empty line"),
>> -    (r"\n\+[ \t]+def [a-z]+_[a-z]", "adds a function with foo_bar naming"),
>> +    (r"\n\+[ \t]+def (?!cffi)[a-z]+_[a-z]",
>> +     "adds a function with foo_bar naming"),
>> ]
> 
> Can we have an inline comment about this cffi thing, this code is already quite scary to new comer.

Can you just add that in flight?

> 
> Cheers,
> 
> --
> Pierre-Yves David

Patch

diff --git a/contrib/check-commit b/contrib/check-commit
--- a/contrib/check-commit
+++ b/contrib/check-commit
@@ -41,7 +41,8 @@  errors = [
     (afterheader + r".{79,}", "summary line too long (limit is 78)"),
     (r"\n\+\n( |\+)\n", "adds double empty line"),
     (r"\n \n\+\n", "adds double empty line"),
-    (r"\n\+[ \t]+def [a-z]+_[a-z]", "adds a function with foo_bar naming"),
+    (r"\n\+[ \t]+def (?!cffi)[a-z]+_[a-z]",
+     "adds a function with foo_bar naming"),
 ]
 
 word = re.compile('\S')