From patchwork Wed Apr 6 19:46:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Stringer X-Patchwork-Id: 607151 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3qgGSz1CYQz9t4T for ; Thu, 7 Apr 2016 05:46:59 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 38A2510224; Wed, 6 Apr 2016 12:46:58 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id A1A771020D for ; Wed, 6 Apr 2016 12:46:56 -0700 (PDT) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 300F416251C for ; Wed, 6 Apr 2016 13:46:56 -0600 (MDT) X-ASG-Debug-ID: 1459972015-0b3237353781ae20001-byXFYA Received: from mx3-pf3.cudamail.com ([192.168.14.3]) by bar6.cudamail.com with ESMTP id ylO4lRkzyvhQWpk1 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 06 Apr 2016 13:46:55 -0600 (MDT) X-Barracuda-Envelope-From: joe@ovn.org X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.3 Received: from unknown (HELO relay3-d.mail.gandi.net) (217.70.183.195) by mx3-pf3.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 6 Apr 2016 19:46:54 -0000 Received-SPF: pass (mx3-pf3.cudamail.com: SPF record at ovn.org designates 217.70.183.195 as permitted sender) X-Barracuda-Apparent-Source-IP: 217.70.183.195 X-Barracuda-RBL-IP: 217.70.183.195 Received: from mfilter19-d.gandi.net (mfilter19-d.gandi.net [217.70.178.147]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id 77764A80CF; Wed, 6 Apr 2016 21:46:52 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter19-d.gandi.net Received: from relay3-d.mail.gandi.net ([IPv6:::ffff:217.70.183.195]) by mfilter19-d.gandi.net (mfilter19-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id iuAmiVj5t7ov; Wed, 6 Apr 2016 21:46:51 +0200 (CEST) X-Originating-IP: 208.91.1.34 Received: from localhost.localdomain (unknown [208.91.1.34]) (Authenticated sender: joe@ovn.org) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id C148BA809B; Wed, 6 Apr 2016 21:46:49 +0200 (CEST) X-CudaMail-Envelope-Sender: joe@ovn.org From: Joe Stringer To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V3-405048001 X-CudaMail-DTE: 040616 X-CudaMail-Originating-IP: 217.70.183.195 Date: Wed, 6 Apr 2016 12:46:40 -0700 X-ASG-Orig-Subj: [##CM-V3-405048001##][PATCHv2] checkpatch: Don't enforce char limit on tests. Message-Id: <1459972000-2654-1-git-send-email-joe@ovn.org> X-Mailer: git-send-email 2.1.4 X-Barracuda-Connect: UNKNOWN[192.168.14.3] X-Barracuda-Start-Time: 1459972015 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCHv2] checkpatch: Don't enforce char limit on tests. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" Although tests ideally also stick to shorter line lengths, it is very common for fixed text blocks like flows or large packets to be specified within tests. Checkpatch shouldn't complain about cases like these. Signed-off-by: Joe Stringer Acked-by: Russell Bryant --- v2: Broaden the set of blacklisted files to not check. --- utilities/checkpatch.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/utilities/checkpatch.py b/utilities/checkpatch.py index d9011f370816..83d14e89269e 100755 --- a/utilities/checkpatch.py +++ b/utilities/checkpatch.py @@ -56,6 +56,12 @@ skip_trailing_whitespace_check = False skip_block_whitespace_check = False skip_signoff_check = False +# Don't enforce character limit on files that include these characters in their +# name, as they may have legitimate reasons to have longer lines. +# +# Python isn't checked as flake8 performs these checks during build. +line_length_blacklist = ['.am', '.at', 'etc', '.in', '.mk', '.patch', '.py'] + def is_added_line(line): """Returns TRUE if the line in question is an added line. @@ -99,14 +105,23 @@ def ovs_checkpatch_parse(text): co_authors = [] parse = 0 current_file = '' + previous_file = '' scissors = re.compile(r'^[\w]*---[\w]*') hunks = re.compile('^(---|\+\+\+) (\S+)') is_signature = re.compile(r'((\s*Signed-off-by: )(.*))$', re.I | re.M | re.S) is_co_author = re.compile(r'(\s*(Co-authored-by: )(.*))$', re.I | re.M | re.S) + skip_line_length_check = False for line in text.split('\n'): + if current_file is not previous_file: + previous_file = current_file + for filetype in line_length_blacklist: + if filetype in current_file: + skip_line_length_check = True + break + lineno = lineno + 1 if len(line) <= 0: continue @@ -154,7 +169,7 @@ def ovs_checkpatch_parse(text): if trailing_whitespace_or_crlf(line[1:]): print_line = True print_warning("Line has trailing whitespace", lineno) - if len(line[1:]) > 79: + if len(line[1:]) > 79 and not skip_line_length_check: print_line = True print_warning("Line is greater than 79-characters long", lineno)