Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid linting venv dependencies by default #141

Closed
xatier opened this issue Sep 27, 2020 · 1 comment
Closed

Avoid linting venv dependencies by default #141

xatier opened this issue Sep 27, 2020 · 1 comment

Comments

@xatier
Copy link

xatier commented Sep 27, 2020

In README.md and the getting started doc, the doc suggested to execute python -m fixit.cli.run_rules to trigger the linter. However, this would trigger unwanted behavior if fixit is installed inside venv.

To reproduce:

mkdir foo
cd foo
python -m venv venv
. venv/bin/activate 
pip install fixit
python -m fixit.cli.run_rules

fixit would scan all python (dependency) source codes inside venv directory, which may not be the intended behavior for the users.

Scanning 856 files                                                                                                                                                                                                  
Testing 21 rules                                                                                          
                                                                                                                                                                                                                    
Encountered exception <class 'Exception'> for the following paths:                                        
./app.py                                                                                                                                                                                                            
./venv/lib/python3.8/site-packages/mccabe.py                                                                                                                                                                        
./venv/lib/python3.8/site-packages/pycodestyle.py                                                                                                                                                                   
./venv/lib/python3.8/site-packages/typing_inspect.py                                                      
./venv/lib/python3.8/site-packages/typing_extensions.py                                                                                                                                                             
...

Following the docs, it suggested to generate the init config if one would like to specify the repo root. However, the default init config would also yield an exception since the default value of formatter is an empty string.

python -m fixit.cli.init_config
python -m fixit.cli.run_rules

...
  File "/tmp/foo/venv/lib/python3.8/site-packages/fixit/common/config.py", line 137, in get_lint_config
    exe = distutils.spawn.find_executable(formatter_args[0]) or formatter_args[0]
IndexError: list index out of range
cat .fixit.config.yaml 
block_list_patterns:
- '@generated'
- '@nolint'
block_list_rules: []
fixture_dir: ./fixtures
formatter: []                    <----------------- formatter_args[0] doesn't exist
packages:
- fixit.rules
repo_root: .
rule_config: {}
@amyreese
Copy link
Member

Hey folks, we just released Fixit 2.0, which includes major changes to the core frameworks, linting engine, API, and CLI. In light of this new release, this issue is likely to be resolved or no longer relevant. Please take a look at the new user guide or the upgrade guide for more information on how to migrate your projects to the new version.

If you believe this issue is still relevant or still occurring in the latest version, please feel free to open a new issue, or reply here with more details.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants