From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 453A4C43387 for ; Tue, 8 Jan 2019 13:11:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1357220850 for ; Tue, 8 Jan 2019 13:11:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727484AbfAHNLT (ORCPT ); Tue, 8 Jan 2019 08:11:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39612 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbfAHNLT (ORCPT ); Tue, 8 Jan 2019 08:11:19 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 18C339B32A; Tue, 8 Jan 2019 13:11:19 +0000 (UTC) Received: from workstation (unknown [10.43.12.130]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5F8D31057073; Tue, 8 Jan 2019 13:11:18 +0000 (UTC) From: Petr Lautrbach To: selinux@vger.kernel.org Cc: Nicolas Iooss Subject: Re: [PATCH 1/1] scripts/run-flake8: run on Python scripts not ending with .py References: <20190105155953.19583-1-nicolas.iooss@m4x.org> Date: Tue, 08 Jan 2019 14:11:16 +0100 In-Reply-To: <20190105155953.19583-1-nicolas.iooss@m4x.org> (Nicolas Iooss's message of "Sat, 5 Jan 2019 16:59:53 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 08 Jan 2019 13:11:19 +0000 (UTC) Sender: selinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org Nicolas Iooss writes: > When running flake8 on a directory, it does not analyze files without an > extension, like semanage_migrate_store, mlscolor-test, etc. Use grep to > find files with a Python shebang and build a list which is then given to > flake8. > > This commit is possible now that some clean-up patches have been > applied, such as commit 69c56bd2f6e9 ("python/chcat: improve the code > readability") and b7227aaec1da ("mcstrans: fix Python linter warnings on > test scripts") and 3cb974d2d2a7 ("semanage_migrate_store: fix many > Python linter warnings"). > > Signed-off-by: Nicolas Iooss Acked-by: Petr Lautrbach https://github.com/SELinuxProject/selinux/pull/128 > --- > scripts/run-flake8 | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/scripts/run-flake8 b/scripts/run-flake8 > index 6ad029fa6852..24b1202fde99 100755 > --- a/scripts/run-flake8 > +++ b/scripts/run-flake8 > @@ -4,6 +4,11 @@ > # Run on the base directory if no argument has been given > if [ $# -eq 0 ] ; then > cd "$(dirname -- "$0")/.." || exit $? > + > + # Run on both files ending with .py and Python files without extension > + # shellcheck disable=SC2046 > + set -- $( (find . -name '*.py' ; grep --exclude-dir=.git -l -e '^#!\s*/usr/bin/python' -e '^#!/usr/bin/env python' -r .) | sort -u ) > + echo "Analyzing $# Python scripts" > fi > > # Assign each ignore warning on a line, in order to ease testing enabling the warning again