diff mbox series

[2/5] python: add excluded dirs to flake8 config

Message ID 20201027223815.159802-3-jsnow@redhat.com
State New
Headers show
Series python: add linters to gitlab CI | expand

Commit Message

John Snow Oct. 27, 2020, 10:38 p.m. UTC
Following patches make obvious that we ought to ignore certain
directories to avoid wildly erroneous flake8 output.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 python/setup.cfg | 2 ++
 1 file changed, 2 insertions(+)

Comments

Philippe Mathieu-Daudé Oct. 28, 2020, 8:50 a.m. UTC | #1
On 10/27/20 11:38 PM, John Snow wrote:
> Following patches make obvious that we ought to ignore certain
> directories to avoid wildly erroneous flake8 output.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  python/setup.cfg | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/python/setup.cfg b/python/setup.cfg
> index cb696291ba38..d0ad683b5148 100644
> --- a/python/setup.cfg
> +++ b/python/setup.cfg
> @@ -30,6 +30,8 @@ devel =
>  
>  [flake8]
>  extend-ignore = E722  # Prefer pylint's bare-except checks to flake8's
> +exclude = __pycache__,
> +          .venv,

Can we make flake8 aware the files are in a git repository instead?

Anyway,
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

>  
>  [mypy]
>  strict = True
>
John Snow Oct. 28, 2020, 1:42 p.m. UTC | #2
On 10/28/20 4:50 AM, Philippe Mathieu-Daudé wrote:
> On 10/27/20 11:38 PM, John Snow wrote:
>> Following patches make obvious that we ought to ignore certain
>> directories to avoid wildly erroneous flake8 output.
>>
>> Signed-off-by: John Snow <jsnow@redhat.com>
>> ---
>>   python/setup.cfg | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/python/setup.cfg b/python/setup.cfg
>> index cb696291ba38..d0ad683b5148 100644
>> --- a/python/setup.cfg
>> +++ b/python/setup.cfg
>> @@ -30,6 +30,8 @@ devel =
>>   
>>   [flake8]
>>   extend-ignore = E722  # Prefer pylint's bare-except checks to flake8's
>> +exclude = __pycache__,
>> +          .venv,
> 
> Can we make flake8 aware the files are in a git repository instead?
> 

Long story short, no.

Python tooling copies source out of git for many reasons -- during 
installation, packaging, etc -- and it loses git metadata.

This is why I have a VERSION file in this directory, too. I have no 
access to the git tags from within the python packaging ecosystem.

--js

> Anyway,
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
>>   
>>   [mypy]
>>   strict = True
>>
>
diff mbox series

Patch

diff --git a/python/setup.cfg b/python/setup.cfg
index cb696291ba38..d0ad683b5148 100644
--- a/python/setup.cfg
+++ b/python/setup.cfg
@@ -30,6 +30,8 @@  devel =
 
 [flake8]
 extend-ignore = E722  # Prefer pylint's bare-except checks to flake8's
+exclude = __pycache__,
+          .venv,
 
 [mypy]
 strict = True