Skip to content

[v0.6.9] I001 error on pre-commit, but not on CLI check #101

@pweglik

Description

@pweglik

I have those imports like this in my file:

import asyncio
from enum import StrEnum
from typing import Any

from langchain.chains.llm import LLMChain
from langchain.docstore.document import Document

from app.generators.utils import (
    convert_str_to_json,
    get_llm,
)
# more local imports from app module...

a = 5

I don't have project.toml file.
I'm using pre-commit hooks with settings:

repos:
  - repo: https://github.com/astral-sh/ruff-pre-commit
    # Ruff version.
    rev: v0.6.9
    hooks:
      # Run the linter.
      - id: ruff
        args: [--select, I]
      # Run the formatter.
      - id: ruff-format

When I check the code in CLI I receive no errors:

ruff check --select I filename.py 
All checks passed!

But when I try to commit changes in this file I receive error I001:

19 | | from app.generators.utils import (
20 | |     convert_str_to_json,
21 | |     get_llm,
22 | | )
27 | | 
28 | | a = 5
   | |_^ I001
   |
   = help: Organize imports

Python version 3.11. MacOS.
This is really weird as I receive no similar error in any other file in my project...
Thanks for help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions