Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: GitHub action and Pre-commit need better configuration/args examples #2266

Open
elliot-100 opened this issue May 21, 2024 · 1 comment

Comments

@elliot-100
Copy link

elliot-100 commented May 21, 2024

I ran into the 'how do you make isort compatible with black' problem, and while I think I've resolved my issue via #1518, I think part of the problem is that the documentation doesn't tell you how to set most configuration flags when using Github actions or pre-commit.

GitHub actions

From https://pycqa.github.io/isort/docs/configuration/github_action.html:

configuration
Optional. isort configuration options to pass to the isort CLI. Defaults to --check-only --diff.
...
Example usage

name: Run isort
on:
  - push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-python@v2
        with:
          python-version: 3.8
      - uses: isort/isort-action@master
        with:
            requirementsFiles: "requirements.txt requirements-test.txt"

This seems to need an example of setting a few configuration flags. I suggest in the interests of DRY, one should be how to get config from pyproject.toml.

This part of https://github.com/isort/isort-action/blob/master/README.md seems to be identical.

pre-commit

https://pycqa.github.io/isort/docs/configuration/pre-commit.html doesn't seem to have any configuration examples in the code at all. Again perhaps one should be how to get config from pyproject.toml.

Although https://pycqa.github.io/isort/docs/configuration/black_compatibility.html does have this (doesn't have a corresponding example for GitHub actions though, I think it should):

- repo: https://github.com/pycqa/isort
    rev: 5.6.4
    hooks:
      - id: isort
        args: ["--profile", "black", "--filter-files"]

I am happy to submit a PR even if it is a strawman.

@keikoro
Copy link

keikoro commented May 25, 2024

@elliot-100 I saw your issue + comments in the other repo, only just found my way here.

Dropping the link to my issue over there as it's related: isort/isort-action#91 (lacking/mismatched docs on the website) No clue why they created a separate org for just the action, with zero backlinks to here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants