Open Peilonrayz opened 5 years ago
I'm seeing a related issue: bellybutton recurses into my .tox directory, despite it being excluded by the default generated configuration (I added a print statement to determine that the problem file is .tox/pylint/lib/python3.8/site-packages/pylint/test/functional/implicit_str_concat_in_sequence_latin1.py
):
$ bellybutton lint
Traceback (most recent call last):
File "/home/daniel/.virtualenvs/cloud-init/bin/bellybutton", line 8, in <module>
sys.exit(main())
File "/home/daniel/.virtualenvs/cloud-init/lib/python3.8/site-packages/bellybutton/cli.py", line 221, in main
exit_code = args.func(**{
File "/home/daniel/.virtualenvs/cloud-init/lib/python3.8/site-packages/bellybutton/cli.py", line 196, in lint
for failure in linting_failures(filepaths, rules):
File "/home/daniel/.virtualenvs/cloud-init/lib/python3.8/site-packages/bellybutton/cli.py", line 139, in linting_failures
for filepath, file_contents in files:
File "/home/daniel/.virtualenvs/cloud-init/lib/python3.8/site-packages/bellybutton/cli.py", line 110, in open_python_files
contents = f.read()
File "/usr/lib/python3.8/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 96: invalid continuation byte
I'm having the same problem. I have a .venv
folder in my directory with symlinks to python files, but from the source code, it seems bellybutton lint
doesn't exclude anything. Instead, it gives
Traceback (most recent call last):
File "/Users/rubenhelsloot/.pyenv/versions/3.8.6/envs/crunchr/bin/bellybutton", line 33, in <module>
sys.exit(load_entry_point('bellybutton==0.3.1', 'console_scripts', 'bellybutton')())
File "/Users/rubenhelsloot/.pyenv/versions/3.8.6/envs/crunchr/lib/python3.8/site-packages/bellybutton/cli.py", line 217, in main
exit_code = args.func(**{
File "/Users/rubenhelsloot/.pyenv/versions/3.8.6/envs/crunchr/lib/python3.8/site-packages/bellybutton/cli.py", line 192, in lint
for failure in linting_failures(filepaths, rules):
File "/Users/rubenhelsloot/.pyenv/versions/3.8.6/envs/crunchr/lib/python3.8/site-packages/bellybutton/cli.py", line 135, in linting_failures
for filepath, file_contents in files:
File "/Users/rubenhelsloot/.pyenv/versions/3.8.6/envs/crunchr/lib/python3.8/site-packages/bellybutton/cli.py", line 108, in open_python_files
with open(filepath, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/rubenhelsloot/crunchr/.venv/lib/python3.8/_bootlocale.py'
It works fine for me, following the example .bellybutton.yml in this repo. I was able to exclude the venv
directory just fine:
settings:
all_files: !settings &all_files
included:
- ~+/*
excluded:
- ~+/.tox/*
- ~+/venv/*
allow_ignore: yes
This doesn't work for me. (sss is my project name)
settings:
all_files: &all_files !settings
included:
- ~+/sss/*
excluded:
- ~+/.tox/*
- ~+/.venv/*
- ~+/venv/*
allow_ignore: yes
tests_only: &tests_only !settings
included:
- ~+/tests/*
excluded:
- ~+/.tox/*
- ~+/.venv/*
- ~+/venv/*
allow_ignore: yes
excluding_tests: &excluding_tests !settings
included:
- ~+/sss/*
excluded:
- ~+/tests/*
- ~+/.tox/*
- ~+/venv/*
allow_ignore: yes
default_settings: *excluding_tests
rules:
ExampleRule:
description: "Empty module."
expr: /Module/body[not(./*)]
example: ""
instead: |
"""This module has a docstring."""
I have a project where I put lots of virtual environments under
.mam
. I've generated a config usingbellybutton init
and then excluded that directory with the following settings file:I get the error in #22 from these files. I know this because I changed cli#109 to use a try except and raise the file name as a new error. The problem file is:
I'm guessing I'm doing something wrong. But it's not excluding the file.