From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org, Collin Funk <collin.funk1@gmail.com>
Cc: Dima Pasechnik <dimpase@cs.ox.ac.uk>
Subject: Re: pycodestyle configuration
Date: Tue, 27 Feb 2024 03:38:41 +0100 [thread overview]
Message-ID: <7487675.MHq7AAxBmi@nimes> (raw)
In-Reply-To: <d7852e10-3a11-4167-932a-dcd576a41d33@gmail.com>
Hi Collin,
> > You can now submit the two configuration files in the pygnulib/ directory.
> > That's the proper place, not the root directory of gnulib.
>
> Done.
Thanks; I applied both patches.
But now we have the desired configurations of pycodestyle and pylint
in two places: in comments and in the config files. With the promise that
they will get out of sync in the future. To avoid this, let me
update the comments...
> I've confirmed that pylint recognizes .pylintrc so I've used
> that file name instead. One thing to note is that you must run pylint
> from the pygnulib/ subdirectory. Pycodestyle doesn't have this
> restriction. For example:
>
> # Works
> [collin@debian pygnulib]$ pylint main.py
> # Doesn't work, doesn't pick up configuration file.
> [collin@debian pygnulib]$ cd ../
> [collin@debian gnulib]$ pylint pygnulib/main.py
Interesting. Also worth documenting. Done through the patch below.
> That file should probably be
> cleaned up at a later date. For some reason all of the fields in the
> object returned by argparse are used before being assigned to local
> variables and then used again.
I don't see a problem here, or anything to "clean up". It is on purpose
that these fields are stored in different objects:
- in the cmdargs, to satisfy the requirements of the argparser,
- in a GLConfig object, for the tool's logic.
For example, the way argparser works, 'mode_list', 'mode_find' etc.
need to be different booleans in cmdargs; however in GLConfig, we don't
want to obey a dictate from argparser; instead it should be a single
field 'mode', with several possible values.
Bruno
2024-02-26 Bruno Haible <bruno@clisp.org>
gnulib-tool.py: Add more comments.
* pygnulib/main.py: Add comments regarding code style. Mention the
pycodestyle and pylint configurations.
diff --git a/pygnulib/main.py b/pygnulib/main.py
index cfa59c6562..443300c439 100644
--- a/pygnulib/main.py
+++ b/pygnulib/main.py
@@ -24,11 +24,28 @@
# - Place line breaks to help reading the code:
# Avoid line breaks inside expressions, if they can be avoided.
# Do use line breaks to separate the parts of [ ... for ... ] iterations.
+# - String literals: Use 'single-quotes'.
+# Rationale: <https://lists.gnu.org/archive/html/bug-gnulib/2024-02/msg00226.html>
+# - Comparison operators:
+# Use == and != for variables which can contain only strings, numbers, lists,
+# and None.
+# Use 'is' and 'is not' for variables which can contain only class instances
+# (e.g. GLModule instances) and None.
+# Rationale: <https://lists.gnu.org/archive/html/bug-gnulib/2024-02/msg00225.html>
+
# You can use this command to check the style:
-# $ pycodestyle --max-line-length=136 --ignore=E265,W503,E241,E711,E712,E201,E202,E221 pygnulib/*.py
+# $ pycodestyle *.py
+# The pycodestyle configuration is found in the file setup.cfg.
+# Documentation:
+# <https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes>
# You can use this command to check for mistakes:
-# $ pylint --disable=C0103,C0114,C0121,C0209,C0301,C0302,R0902,R0912,R0913,R0914,R0915,R1705,R1702,R1720 pygnulib/*.py
+# $ pylint *.py
+# The pylint configuration is found in the file .pylintrc.
+# Note: This configuration is only effective when you invoke pylint from this
+# directory.
+# Documentation:
+# <https://pylint.readthedocs.io/en/latest/user_guide/messages/messages_overview.html>
#===============================================================================
next prev parent reply other threads:[~2024-02-27 2:39 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-23 5:23 [PATCH] gnulib-tool.py: Follow gnulib-tool changes, part 27 Collin Funk
2024-02-23 13:08 ` Bruno Haible
2024-02-23 22:20 ` Collin Funk
2024-02-23 23:51 ` Bruno Haible
2024-02-24 2:36 ` Collin Funk
2024-02-24 5:49 ` gnulib-tool.py: Follow gnulib-tool changes, part 28 Collin Funk
2024-02-24 23:25 ` gnulib-tool.py: Follow gnulib-tool changes, part 27 Bruno Haible
2024-02-25 0:03 ` Dima Pasechnik
2024-02-25 11:57 ` Python != None Bruno Haible
2024-02-25 19:29 ` Collin Funk
2024-02-25 20:07 ` Collin Funk
2024-02-26 20:38 ` pycodestyle configuration Bruno Haible
2024-02-26 21:31 ` Collin Funk
2024-02-26 22:54 ` Bruno Haible
2024-02-27 0:51 ` Collin Funk
2024-02-27 2:38 ` Bruno Haible [this message]
2024-02-27 4:22 ` Collin Funk
2024-02-25 20:55 ` Python != None Dima Pasechnik
2024-02-25 12:02 ` Python 'strings' Bruno Haible
2024-02-25 19:05 ` Collin Funk
2024-02-24 23:42 ` gnulib-tool.py: Follow gnulib-tool changes, part 28 Bruno Haible
2024-02-25 0:47 ` Collin Funk
2024-02-25 1:18 ` Collin Funk
2024-02-25 1:25 ` Bruno Haible
2024-02-25 3:32 ` Collin Funk
2024-02-26 20:51 ` Bruno Haible
2024-02-28 11:51 ` Collin Funk
2024-02-28 12:14 ` Bruno Haible
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
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7487675.MHq7AAxBmi@nimes \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
--cc=collin.funk1@gmail.com \
--cc=dimpase@cs.ox.ac.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).