dspy icon indicating copy to clipboard operation
dspy copied to clipboard

Dev issue - Ruff check succeeds but commit fails with ruff check message

Open drawal1 opened this issue 2 months ago • 2 comments

It seems like if you touch the file, commit requires you to fix all the ruff issues in that file, regardless of whether your changes are related to those lines with the issues. But the ruff check command does not highlight those issues. You can only see them in the debug console output from the git commit

drawal1 avatar Apr 24 '24 13:04 drawal1

Can you attach screenshots of running ruff check . --fix-only and the output you are talking about?

isaacbmiller avatar Apr 24 '24 13:04 isaacbmiller

I've run into this as well. Below is the output you requested. The pre-commit is running ruff check --force-exclude, which is why there is a difference. If you run ruff check . --force-exclude you get a couple thousand errors.

❯ ruff check . --fix-only                                                                                                                                                                                                                                                         12:43:28
warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `pyproject.toml`:
  - 'extend-unsafe-fixes' -> 'lint.extend-unsafe-fixes'
warning: Docstring at dspy/teleprompt/mipro_optimizer.py:109:9 contains implicit string concatenation; ignoring...
warning: Docstring at dspy/teleprompt/mipro_optimizer.py:120:9 contains implicit string concatenation; ignoring...
No errors fixed (568 fixes available with `--unsafe-fixes`).
❯ git commit -m "..."                                                                                                                                                                                                                              13:18:07
ruff.....................................................................Failed
- hook id: ruff
- exit code: 1

dspy/__init__.py:4:1: F403 `from .predict import *` used; unable to detect undefined names
dspy/__init__.py:5:1: F403 `from .primitives import *` used; unable to detect undefined names
dspy/__init__.py:6:1: F403 `from .retrieve import *` used; unable to detect undefined names
dspy/__init__.py:7:1: F403 `from .signatures import *` used; unable to detect undefined names
dspy/__init__.py:11:1: F403 `from .functional import *` used; unable to detect undefined names
dspy/__init__.py:31:1: PLW0127 Self-assignment of variable `HFClientVLLM`
Found 6 errors.

ruff-format..............................................................Passed
isort....................................................................Passed
check yaml...........................................(no files to check)Skipped
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
check docstring is first.................................................Passed
check toml...........................................(no files to check)Skipped
check for added large files..............................................Passed
fix requirements.txt.................................(no files to check)Skipped
check for merge conflicts................................................Passed
debug statements (python)................................................Passed
pretty format json...................................(no files to check)Skipped
prettier.................................................................Passed

qhoxie avatar May 01 '24 20:05 qhoxie