From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id DCF1A1382C5 for ; Fri, 30 Mar 2018 05:21:28 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0BC80E09BA; Fri, 30 Mar 2018 05:20:53 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C36F0E09BA for ; Fri, 30 Mar 2018 05:20:52 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 18A8F335D39 for ; Fri, 30 Mar 2018 05:20:51 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4CBC6279 for ; Fri, 30 Mar 2018 05:20:47 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1522381879.717f46dff518503282f9440f1ed39fbe7698dcee.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/whitespace/ X-VCS-Repository: proj/portage X-VCS-Files: repoman/pym/repoman/modules/linechecks/whitespace/__init__.py repoman/pym/repoman/modules/linechecks/whitespace/blank.py repoman/pym/repoman/modules/linechecks/whitespace/whitespace.py X-VCS-Directories: repoman/pym/repoman/modules/linechecks/whitespace/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 717f46dff518503282f9440f1ed39fbe7698dcee X-VCS-Branch: repoman Date: Fri, 30 Mar 2018 05:20:47 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 6292e434-e41d-4646-ab68-30bb5814fc9e X-Archives-Hash: e572dd7310ead6a6dc6cfead4fd36953 commit: 717f46dff518503282f9440f1ed39fbe7698dcee Author: Brian Dolbec gentoo org> AuthorDate: Sat Jul 15 01:07:13 2017 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri Mar 30 03:51:19 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=717f46df repoman: New linechecks module, whitespace .../modules/linechecks/whitespace/__init__.py | 27 ++++++++++++++++++++++ .../repoman/modules/linechecks/whitespace/blank.py | 25 ++++++++++++++++++++ .../modules/linechecks/whitespace/whitespace.py | 21 +++++++++++++++++ 3 files changed, 73 insertions(+) diff --git a/repoman/pym/repoman/modules/linechecks/whitespace/__init__.py b/repoman/pym/repoman/modules/linechecks/whitespace/__init__.py new file mode 100644 index 000000000..ded690ed7 --- /dev/null +++ b/repoman/pym/repoman/modules/linechecks/whitespace/__init__.py @@ -0,0 +1,27 @@ +# Copyright 2015-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +doc = """Whitespace plug-in module for repoman LineChecks. +Performs checks for useless whitespace in ebuilds.""" +__doc__ = doc[:] + + +module_spec = { + 'name': 'do', + 'description': doc, + 'provides':{ + 'whitespace-check': { + 'name': "whitespace", + 'sourcefile': "whitespace", + 'class': "EbuildWhitespace", + 'description': doc, + }, + 'blankline-check': { + 'name': "blankline", + 'sourcefile': "blank", + 'class': "EbuildBlankLine", + 'description': doc, + }, + } +} + diff --git a/repoman/pym/repoman/modules/linechecks/whitespace/blank.py b/repoman/pym/repoman/modules/linechecks/whitespace/blank.py new file mode 100644 index 000000000..2ab4097a3 --- /dev/null +++ b/repoman/pym/repoman/modules/linechecks/whitespace/blank.py @@ -0,0 +1,25 @@ + +import re + +from repoman.modules.linechecks.base import LineCheck + + +class EbuildBlankLine(LineCheck): + repoman_check_name = 'ebuild.minorsyn' + ignore_comment = False + blank_line = re.compile(r'^$') + + def new(self, pkg): + self.line_is_blank = False + + def check(self, num, line): + if self.line_is_blank and self.blank_line.match(line): + return 'Useless blank line on line: %d' + if self.blank_line.match(line): + self.line_is_blank = True + else: + self.line_is_blank = False + + def end(self): + if self.line_is_blank: + yield 'Useless blank line on last line' diff --git a/repoman/pym/repoman/modules/linechecks/whitespace/whitespace.py b/repoman/pym/repoman/modules/linechecks/whitespace/whitespace.py new file mode 100644 index 000000000..556b2ab81 --- /dev/null +++ b/repoman/pym/repoman/modules/linechecks/whitespace/whitespace.py @@ -0,0 +1,21 @@ + +import re + +from repoman.modules.linechecks.base import LineCheck + + +class EbuildWhitespace(LineCheck): + """Ensure ebuilds have proper whitespacing""" + + repoman_check_name = 'ebuild.minorsyn' + + ignore_line = re.compile(r'(^$)|(^(\t)*#)') + ignore_comment = False + leading_spaces = re.compile(r'^[\S\t]') + trailing_whitespace = re.compile(r'.*([\S]$)') + + def check(self, num, line): + if self.leading_spaces.match(line) is None: + return self.errors['LEADING_SPACES_ERROR'] + if self.trailing_whitespace.match(line) is None: + return self.errors['TRAILING_WHITESPACE_ERROR'] From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D1AA71382C5 for ; Fri, 30 Mar 2018 04:23:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 17C8CE0959; Fri, 30 Mar 2018 04:23:45 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D0F97E0959 for ; Fri, 30 Mar 2018 04:23:44 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7615F335D37 for ; Fri, 30 Mar 2018 04:23:43 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6C1EA277 for ; Fri, 30 Mar 2018 04:23:40 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1522381879.717f46dff518503282f9440f1ed39fbe7698dcee.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: repoman/pym/repoman/modules/linechecks/whitespace/ X-VCS-Repository: proj/portage X-VCS-Files: repoman/pym/repoman/modules/linechecks/whitespace/__init__.py repoman/pym/repoman/modules/linechecks/whitespace/blank.py repoman/pym/repoman/modules/linechecks/whitespace/whitespace.py X-VCS-Directories: repoman/pym/repoman/modules/linechecks/whitespace/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 717f46dff518503282f9440f1ed39fbe7698dcee X-VCS-Branch: master Date: Fri, 30 Mar 2018 04:23:40 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: b40646ce-e1f1-4d69-9e58-0f8771d64d5a X-Archives-Hash: e560795ba464db0572cd6cf33a56b6fc Message-ID: <20180330042340.1XMtQII554_fGT90EURRpuHi5jC6jdoG9oMeqKg5vZw@z> commit: 717f46dff518503282f9440f1ed39fbe7698dcee Author: Brian Dolbec gentoo org> AuthorDate: Sat Jul 15 01:07:13 2017 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri Mar 30 03:51:19 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=717f46df repoman: New linechecks module, whitespace .../modules/linechecks/whitespace/__init__.py | 27 ++++++++++++++++++++++ .../repoman/modules/linechecks/whitespace/blank.py | 25 ++++++++++++++++++++ .../modules/linechecks/whitespace/whitespace.py | 21 +++++++++++++++++ 3 files changed, 73 insertions(+) diff --git a/repoman/pym/repoman/modules/linechecks/whitespace/__init__.py b/repoman/pym/repoman/modules/linechecks/whitespace/__init__.py new file mode 100644 index 000000000..ded690ed7 --- /dev/null +++ b/repoman/pym/repoman/modules/linechecks/whitespace/__init__.py @@ -0,0 +1,27 @@ +# Copyright 2015-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +doc = """Whitespace plug-in module for repoman LineChecks. +Performs checks for useless whitespace in ebuilds.""" +__doc__ = doc[:] + + +module_spec = { + 'name': 'do', + 'description': doc, + 'provides':{ + 'whitespace-check': { + 'name': "whitespace", + 'sourcefile': "whitespace", + 'class': "EbuildWhitespace", + 'description': doc, + }, + 'blankline-check': { + 'name': "blankline", + 'sourcefile': "blank", + 'class': "EbuildBlankLine", + 'description': doc, + }, + } +} + diff --git a/repoman/pym/repoman/modules/linechecks/whitespace/blank.py b/repoman/pym/repoman/modules/linechecks/whitespace/blank.py new file mode 100644 index 000000000..2ab4097a3 --- /dev/null +++ b/repoman/pym/repoman/modules/linechecks/whitespace/blank.py @@ -0,0 +1,25 @@ + +import re + +from repoman.modules.linechecks.base import LineCheck + + +class EbuildBlankLine(LineCheck): + repoman_check_name = 'ebuild.minorsyn' + ignore_comment = False + blank_line = re.compile(r'^$') + + def new(self, pkg): + self.line_is_blank = False + + def check(self, num, line): + if self.line_is_blank and self.blank_line.match(line): + return 'Useless blank line on line: %d' + if self.blank_line.match(line): + self.line_is_blank = True + else: + self.line_is_blank = False + + def end(self): + if self.line_is_blank: + yield 'Useless blank line on last line' diff --git a/repoman/pym/repoman/modules/linechecks/whitespace/whitespace.py b/repoman/pym/repoman/modules/linechecks/whitespace/whitespace.py new file mode 100644 index 000000000..556b2ab81 --- /dev/null +++ b/repoman/pym/repoman/modules/linechecks/whitespace/whitespace.py @@ -0,0 +1,21 @@ + +import re + +from repoman.modules.linechecks.base import LineCheck + + +class EbuildWhitespace(LineCheck): + """Ensure ebuilds have proper whitespacing""" + + repoman_check_name = 'ebuild.minorsyn' + + ignore_line = re.compile(r'(^$)|(^(\t)*#)') + ignore_comment = False + leading_spaces = re.compile(r'^[\S\t]') + trailing_whitespace = re.compile(r'.*([\S]$)') + + def check(self, num, line): + if self.leading_spaces.match(line) is None: + return self.errors['LEADING_SPACES_ERROR'] + if self.trailing_whitespace.match(line) is None: + return self.errors['TRAILING_WHITESPACE_ERROR']