pythonlinterruff

How to ignore environment directory when using python ruff linter in console


I was trying ruff linter. I have a file structure like below

project_folder
├── env # Python enviroment [python -m venv env]
│   ├── Include
│   ├── Lib
│   ├── Scripts
│   ├── ...
├── __init__.py
└── numbers.py

I am trying to use this code

I activated the environment inside the project_folder and ran the script below

ruff check .

but ruff also checked the env file. 🔗Image.png

how to ignore env file like below linux script

tree -I env

Solution

  • You can use the exclude option,

    ruff check --exclude=env .