Open dmweis opened 3 weeks ago
This tracks with my understanding of how changed-files works in this repo. It seems like we'd have to parse the pyproject.toml
here or change the way ruff works upstream to have it respect excludes when given files.
This tracks with my understanding of how changed-files works in this repo. It seems like we'd have to parse the
pyproject.toml
here or change the way ruff works upstream to have it respect excludes when given files.
Thanks for the fast reply!
Makes sense. Would you be open to accepting a PR that adds another config param that allows this action to ignore some directories? It doesn't feel like an ideal solution as it would mean having different file exclude handling for when changed-files
is turned on. But it would be a simple workaround for some issues.
I'm not a maintainer here, just familiar with the setting. I'd be willing to help though!
Depending on what you're envisioning, this might already be possible. My reading of the CLI arguments says this might work:
- uses: astral-sh/ruff-action@v1
with:
args: 'check --exclude "foo,bar,foobar/*" --force-exclude'
changed-files: 'true'
or
- uses: astral-sh/ruff-action@v1
with:
args: 'format --check --exclude "foo,bar,foobar/*" --force-exclude'
changed-files: 'true'
This isn't quite as good as parsing the pyproject section, but might be similar to the workaround proposed. I think @charliermarsh is envisioning some kind of overhaul for this action. An additional param could definitely make this cleaner and supply the flag in the correct position if we wanted.
It seems that when using changed-files
in combination with src
only changed-files
is respected https://github.com/astral-sh/ruff-action/blob/d0a0e814ec17e92d33be7d24dd922b479f1bcd38/action/main.py#L27
Also, when using changed-files
and args: check --exclude dir
, changed files in dir
are still checked. I think that changed-files: "true"
will overwrite everything
Hi,
It seems that when using
changed-files: "true"
the file excludes configured in apyproject.toml
at the root of the repository are not respected.I believe this is because when using
changed-files
the action provides a direct list of files to theruff
command which overrides any files excludes in the config file.The repository I have this issue is in private but I'd be happy to create a public one and replicate it if needed.
Thank you!