> -----Original Message----- > From: ovs-dev-boun...@openvswitch.org [mailto:ovs-dev- > boun...@openvswitch.org] On Behalf Of Justin Pettit > Sent: Wednesday, January 24, 2018 2:31 AM > To: d...@openvswitch.org > Subject: [ovs-dev] [PATCH] checkpatch.py: Add check for "xxx" in comments. > > "xxx" is often used to indicate items that the developer wanted to look at > again before committing. Flag those as a warning. >
Hi Justin, Does this mean that code that contains 'xxx' should not be accepted? I guess ideally we'd want a clean run from the checkpatch script when submitting/reviewing patches. I'm just thinking of cases where there is workaround in place in the code marked with a 'xxx' but with the intention that it will be replaced in the future (sometimes we see this with DPDK where and upcoming DPDK release will provide a better solution). Should a user flag future re-work with a separate tag in the comments? I know in the coding style docs we suggest using XXX or FIXME comments to mark code that needs work. Thanks Ian > Signed-off-by: Justin Pettit <jpet...@ovn.org> > --- > utilities/checkpatch.py | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index > 33feb6bddca1..42777e6fcb15 100755 > --- a/utilities/checkpatch.py > +++ b/utilities/checkpatch.py > @@ -1,5 +1,6 @@ > #!/usr/bin/env python > # Copyright (c) 2016, 2017 Red Hat, Inc. > +# Copyright (c) 2018 Nicira, Inc. > # > # Licensed under the Apache License, Version 2.0 (the "License"); # you > may not use this file except in compliance with the License. > @@ -95,9 +96,11 @@ __regex_ends_with_bracket = \ > re.compile(r'[^\s]\) {(\s+/\*[\s\Sa-zA-Z0-9\.,\?\*/+-]*)?$') > __regex_ptr_declaration_missing_whitespace = re.compile(r'[a-zA-Z0- > 9]\*[^*]') __regex_is_comment_line = re.compile(r'^\s*(/\*|\*\s)') > +__regex_has_comment = re.compile(r'.*(/\*|\*\s)') > __regex_trailing_operator = re.compile(r'^[^ ]* [^ ]*[?:]$') > __regex_conditional_else_bracing = re.compile(r'^\s*else\s*{?$') > __regex_conditional_else_bracing2 = re.compile(r'^\s*}\selse\s*$') > +__regex_has_xxx_mark = re.compile(r'.*xxx.*', re.IGNORECASE) > > skip_leading_whitespace_check = False > skip_trailing_whitespace_check = False > @@ -213,11 +216,19 @@ def is_comment_line(line): > """Returns TRUE if the current line is part of a block comment.""" > return __regex_is_comment_line.match(line) is not None > > +def has_comment(line): > + """Returns TRUE if the current line contains a comment or is part of > + a block comment.""" > + return __regex_has_comment.match(line) is not None > > def trailing_operator(line): > """Returns TRUE if the current line ends with an operatorsuch as ? or > :""" > return __regex_trailing_operator.match(line) is not None > > +def has_xxx_mark(line): > + """Returns TRUE if the current line contains 'xxx'.""" > + return __regex_has_xxx_mark.match(line) is not None > + > > checks = [ > {'regex': None, > @@ -257,6 +268,11 @@ checks = [ > 'check': lambda x: trailing_operator(x), > 'print': > lambda: print_error("Line has '?' or ':' operator at end of line")}, > + > + {'regex': '(\.c|\.h)(\.in)?$', 'match_name': None, > + 'prereq': lambda x: has_comment(x), > + 'check': lambda x: has_xxx_mark(x), > + 'print': lambda: print_warning("Comment with 'xxx' marker")}, > ] > > > -- > 2.7.4 > > _______________________________________________ > dev mailing list > d...@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev