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

2

7

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
Pathless answered 27/4, 2023 at 16:18 Comment(1)
(in 2024) you can skip the . and just run ruff check to recursively check from the current dir.Fugitive
L
7

You can use the exclude option,

ruff check --exclude=env .
Lapstrake answered 6/6, 2023 at 8:2 Comment(1)
(in 2024) you can skip the . and just run ruff check to recursively check from the current dir.Fugitive
I
1

You can add it to your ruff configuration in your project root:

#.ruff.toml

exclude= ["env"]

See: https://docs.astral.sh/ruff/configuration/

Imena answered 27/3 at 9:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.