-
-
Notifications
You must be signed in to change notification settings - Fork 241
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
Does MegaLinter support flake8-cognitive-complexity? #2017
Comments
I've applied a bit of a workaround for now using the following code, but a more sustainable solution would be ideal. .mega-linter.yml
---
...
PYTHON_FLAKE8_PRE_COMMANDS:
- command: |-
echo $PWD
cd /venvs/flake8 \
&& source bin/activate \
&& PYTHONDONTWRITEBYTECODE=1 pip3 install --no-cache-dir flake8-cognitive-complexity \
&& deactivate |
If we add it by default with flake8 installation, will it enforce new rules by default for all repos ? |
Can you elaborate on what is unsustainable about this approach? If you hadn't provided it, using |
@nvuillam, there are some exceptions, but yes, most flake8 plugins will run by default if both they and flake8 are installed. |
My sustainability concerns arise in cases where MegaLinter could decide to change the I did try running I wouldn't want other users to be forced to use the checks provided by the pip extensions, be it mccabe, cognitive-complexity, or others. Ideally there would be a switch/variable that could be used to enable them if the user so chooses. |
It depends if we want plugins rules to be considered as standard in megalinter:) |
(basically, if it triggers 657 errors within MegaLinter own code, I'll prefer to let it as an option and just add in the doc about how to add such plugin instead of adding/activating it by default ^^ |
I am unable to reproduce this. Installing flake8 plugins into the virtualenv might be better practice, but at least I do observe that flake8-bugbear runs when installed via a simple pip install. If you want to use the virtualenv, it may at least be possible to remove the |
@kcfedun-fincad @Kurt-von-Laven I simplified the way to add pip plugins in venvs :) PRE_COMMANDS:
- command: pip install flake8-cognitive-complexity
venv: flake8 # Will be run within flake8 python virtualenv. There is one virtualenv per python-based linter, with the same name https://github.com/oxsecurity/megalinter/actions/runs/3370888552/jobs/5592370481 Already available in beta, and soon in next minor release :) |
That is quite a nice solution 👍. |
Hello there,
Does MegaLinter support flake8-cognitive-complexity? If not, can it be extended to do so? perhaps a new
PYTHON_FLAKE8_
variable could be used to enable/disable these checks?https://github.com/Melevir/flake8-cognitive-complexity
Many thanks.
The text was updated successfully, but these errors were encountered: