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

Replace Travis with pre-commit #429

Closed
marfox opened this issue Sep 3, 2021 · 3 comments · Fixed by #443
Closed

Replace Travis with pre-commit #429

marfox opened this issue Sep 3, 2021 · 3 comments · Fixed by #443
Labels
discussion Extra attention is needed extra New feature or request low priority

Comments

@marfox
Copy link
Member

marfox commented Sep 3, 2021

you may look into pre-commit to automatically run type checking, linting, formatting, etc. on commit

Very interesting suggestion! We currently have a similar mechanism in place on Travis CI, see this dotfile.
However, it's a bit hacky and doesn't run mypy type hints check.
From a first glimpse, it looks like pre-commit is a much better solution:

Originally posted by @marfox in #428 (comment)

@marfox marfox added the story Task with multiple sub-tasks label Sep 3, 2021
@marfox marfox added this to the Refactoring & documentation milestone Sep 3, 2021
@marfox marfox added the extra New feature or request label Sep 3, 2021
@marfox marfox added discussion Extra attention is needed and removed story Task with multiple sub-tasks labels Sep 3, 2021
@marfox
Copy link
Member Author

marfox commented Sep 3, 2021

I tried to reproduce the same invocation of isort, autoflake, black as in .travis.yml in the terminal, but the output is different.

/app/soweego# pre-commit run -a

Here's the .pre-commit-config.yaml I used:

repos:
    - repo: https://github.com/pycqa/isort
      rev: 4.3.21
      hooks:
          - id: isort
            args: [-y, -rc, -s soweego/cli.py]
    - repo: https://github.com/myint/autoflake
      rev: v1.4
      hooks:
          - id: autoflake
            args: [-i, -r, --remove-all-unused-imports, --remove-unused-variables]
    - repo: https://github.com/psf/black
      rev: 19.10b0
      hooks:
          - id: black
            args: [-S, -l 80]

Let'see what happens with the CI service

@marfox
Copy link
Member Author

marfox commented Sep 3, 2021

@marfox
Copy link
Member Author

marfox commented Sep 3, 2021

It looks like the isort hook doesn't work as expected: for instance, it ignores the -s soweego/cli.py option, and actually runs on that file, too.

@marfox marfox changed the title Consider replacing Travis with pre-commit Replace Travis with pre-commit Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Extra attention is needed extra New feature or request low priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant