From: Peter Seiderer <ps.report@gmx.net>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] core: make it possible to check flake8 like we check package
Date: Mon, 20 May 2019 19:34:16 +0200 [thread overview]
Message-ID: <20190520193416.0e9f8217@gmx.net> (raw)
In-Reply-To: <20190519164417.20124-1-yann.morin.1998@free.fr>
Hello Yann,
On Sun, 19 May 2019 18:44:17 +0200, "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
> Move the code to run check-flake8 into the Makefile, like we
> have for check-package, so that it is easy to run locally (and
> not wait for someone to report a failure from their Gitlab
> pipelines).
>
> Since there is no "post-rule" in Makefiles, we resort to using
> a little trick to remove the temporary file. Also, there is a
> slight change in behaviour: the list of files is not reported,
> and the number of processed files is not reported either (there
> is little value in that; all that is important are the errors,
> if any).
>
> Regenerate .gitlab-ci.yml.
>
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> Cc: Ricardo Martincoski <ricardo.martincoski@gmail.com>
> Cc: Arnout Vandecappelle <arnout@mind.be>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
> .gitlab-ci.yml | 9 +--------
> .gitlab-ci.yml.in | 9 +--------
> Makefile | 9 ++++++++-
> 3 files changed, 10 insertions(+), 17 deletions(-)
>
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index 836944faf5..002ee07afb 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -21,15 +21,8 @@ check-DEVELOPERS:
>
> check-flake8:
> extends: .check_base
> - before_script:
> - # Help flake8 to find the Python files without .py extension.
> - - find * -type f -name '*.py' > files.txt
> - - find * -type f -print0 | xargs -0 file | grep 'Python script' | cut -d':' -f1 >> files.txt
> - - sort -u files.txt | tee files.processed
> script:
> - - python -m flake8 --statistics --count --max-line-length=132 $(cat files.processed)
> - after_script:
> - - wc -l files.processed
> + - make check-flake8
>
> check-gitlab-ci.yml:
> extends: .check_base
> diff --git a/.gitlab-ci.yml.in b/.gitlab-ci.yml.in
> index 33cb665d98..afa0d93500 100644
> --- a/.gitlab-ci.yml.in
> +++ b/.gitlab-ci.yml.in
> @@ -21,15 +21,8 @@ check-DEVELOPERS:
>
> check-flake8:
> extends: .check_base
> - before_script:
> - # Help flake8 to find the Python files without .py extension.
> - - find * -type f -name '*.py' > files.txt
> - - find * -type f -print0 | xargs -0 file | grep 'Python script' | cut -d':' -f1 >> files.txt
> - - sort -u files.txt | tee files.processed
> script:
> - - python -m flake8 --statistics --count --max-line-length=132 $(cat files.processed)
> - after_script:
> - - wc -l files.processed
> + - make check-flake8
>
> check-gitlab-ci.yml:
> extends: .check_base
> diff --git a/Makefile b/Makefile
> index 7246376cf9..f78e5aad4d 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -119,7 +119,7 @@ export BR2_VERSION_FULL := $(BR2_VERSION)$(shell $(TOPDIR)/support/scripts/setlo
> noconfig_targets := menuconfig nconfig gconfig xconfig config oldconfig randconfig \
> defconfig %_defconfig allyesconfig allnoconfig alldefconfig syncconfig release \
> randpackageconfig allyespackageconfig allnopackageconfig \
> - print-version olddefconfig distclean manual manual-% check-package
> + print-version olddefconfig distclean manual manual-% check-package check-flake8
>
> # Some global targets do not trigger a build, but are used to collect
> # metadata, or do various checks. When such targets are triggered,
> @@ -1197,6 +1197,13 @@ release:
> print-version:
> @echo $(BR2_VERSION_FULL)
>
> +check-flake8:
> + { find * -type f -name '*.py'; \
> + find * -type f -print0 | xargs -0 file | grep 'Python script' | cut -d':' -f1; \
> + } >files.txt
> + $(Q)python -m flake8 --statistics --count --max-line-length=132 \
> + $$(sort -u files.txt; rm -f files.txt)
> +
> check-package:
> find $(TOPDIR) -type f \( -name '*.mk' -o -name '*.hash' -o -name 'Config.*' \) \
> -exec ./utils/check-package {} +
Did a local run with 'make check-flake8', produced 7636 warnings ;-) , you can add my
Tested-by: Peter Seiderer <ps.report@gmx.net>
Regards,
Peter
next prev parent reply other threads:[~2019-05-20 17:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-19 16:44 [Buildroot] [PATCH] core: make it possible to check flake8 like we check package Yann E. MORIN
2019-05-20 17:34 ` Peter Seiderer [this message]
2019-05-20 18:03 ` Peter Seiderer
2019-05-20 19:07 ` Yann E. MORIN
2019-05-24 8:04 ` Peter Korsgaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190520193416.0e9f8217@gmx.net \
--to=ps.report@gmx.net \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.