diff mbox

[ovs-dev] checkpatch: Be more careful about checking function names.

Message ID 20170526183222.25368-1-blp@ovn.org
State Accepted
Headers show

Commit Message

Ben Pfaff May 26, 2017, 6:32 p.m. UTC
This code would complain about the use of ovs_strerror because it
matches [^x]strerror, and the same was true in many other similar cases.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 utilities/checkpatch.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Joe Stringer May 26, 2017, 8:40 p.m. UTC | #1
On 26 May 2017 at 11:32, Ben Pfaff <blp@ovn.org> wrote:
> This code would complain about the use of ovs_strerror because it
> matches [^x]strerror, and the same was true in many other similar cases.
>
> Signed-off-by: Ben Pfaff <blp@ovn.org>

Ah, good catch. I think this will match on mentions within comments too though?
Ben Pfaff May 26, 2017, 10:17 p.m. UTC | #2
On Fri, May 26, 2017 at 01:40:13PM -0700, Joe Stringer wrote:
> On 26 May 2017 at 11:32, Ben Pfaff <blp@ovn.org> wrote:
> > This code would complain about the use of ovs_strerror because it
> > matches [^x]strerror, and the same was true in many other similar cases.
> >
> > Signed-off-by: Ben Pfaff <blp@ovn.org>
> 
> Ah, good catch. I think this will match on mentions within comments too though?

Does this change make a difference in that?  I think that most of the
checks will trigger on comments.
Joe Stringer May 30, 2017, 4:40 p.m. UTC | #3
On 26 May 2017 at 15:17, Ben Pfaff <blp@ovn.org> wrote:
> On Fri, May 26, 2017 at 01:40:13PM -0700, Joe Stringer wrote:
>> On 26 May 2017 at 11:32, Ben Pfaff <blp@ovn.org> wrote:
>> > This code would complain about the use of ovs_strerror because it
>> > matches [^x]strerror, and the same was true in many other similar cases.
>> >
>> > Signed-off-by: Ben Pfaff <blp@ovn.org>
>>
>> Ah, good catch. I think this will match on mentions within comments too though?
>
> Does this change make a difference in that?  I think that most of the
> checks will trigger on comments.

Ah, no. At some point I was considering narrowing the expression but
it isn't there at the moment.

Acked-by: Joe Stringer <joe@ovn.org>
Ben Pfaff May 30, 2017, 5:33 p.m. UTC | #4
On Tue, May 30, 2017 at 09:40:58AM -0700, Joe Stringer wrote:
> On 26 May 2017 at 15:17, Ben Pfaff <blp@ovn.org> wrote:
> > On Fri, May 26, 2017 at 01:40:13PM -0700, Joe Stringer wrote:
> >> On 26 May 2017 at 11:32, Ben Pfaff <blp@ovn.org> wrote:
> >> > This code would complain about the use of ovs_strerror because it
> >> > matches [^x]strerror, and the same was true in many other similar cases.
> >> >
> >> > Signed-off-by: Ben Pfaff <blp@ovn.org>
> >>
> >> Ah, good catch. I think this will match on mentions within comments too though?
> >
> > Does this change make a difference in that?  I think that most of the
> > checks will trigger on comments.
> 
> Ah, no. At some point I was considering narrowing the expression but
> it isn't there at the moment.
> 
> Acked-by: Joe Stringer <joe@ovn.org>

Thanks.  I applied this to master.
diff mbox

Patch

diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py
index ec4b79e599df..945209da769c 100755
--- a/utilities/checkpatch.py
+++ b/utilities/checkpatch.py
@@ -219,7 +219,7 @@  checks = [
 
 
 def regex_function_factory(func_name):
-    regex = re.compile('[^x]%s\([^)]*\)' % func_name)
+    regex = re.compile(r'\b%s\([^)]*\)' % func_name)
     return lambda x: regex.search(x) is not None