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

update pre-commit hooks #341

Closed
nwesem opened this issue Apr 2, 2024 · 3 comments
Closed

update pre-commit hooks #341

nwesem opened this issue Apr 2, 2024 · 3 comments

Comments

@nwesem
Copy link
Contributor

nwesem commented Apr 2, 2024

Hi everyone, I realized that we are not using the full functionality of pre-commit, so I'm suggesting that we update it to use all standard hooks for python-based projects. I extended the current one with pyupgrade, isort, black, ruff, markdownlint-cli2, and codespell. Please see suggested change below.

Regarding pyupgrade we could use python 3.8+ for now eventhough I would recommend to go for at least 3.10+

As this changes many files of the project I created this issue for discussion.

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.5.0
    hooks:
    -   id: trailing-whitespace
        exclude_types: ["csv", "proto"]
    -   id: end-of-file-fixer
        exclude_types: ["json", "proto"]
        exclude: ".*\\.[fidl|jsonschema]"
    -   id: check-yaml
    -   id: check-added-large-files
  - repo: https://github.com/pycqa/flake8
    rev: '7.0.0'
    hooks:
    -   id: flake8
  - repo: https://github.com/asottile/pyupgrade
    rev: v3.3.1
    hooks:
      - id: pyupgrade
        args: [ --py38-plus ]
  - repo: https://github.com/pycqa/isort
    rev: 5.12.0
    hooks:
      - id: isort
        args: ["--profile", "black", "--filter-files"]
  - repo: https://github.com/psf/black
    rev: 23.10.1
    hooks:
      - id: black
  - repo: https://github.com/astral-sh/ruff-pre-commit
    # Ruff version.
    rev: v0.1.1
    hooks:
      - id: ruff
  - repo: https://github.com/DavidAnson/markdownlint-cli2
    rev: v0.12.1
    hooks:
      - id: markdownlint-cli2
        args:
          - --fix
  - repo: https://github.com/codespell-project/codespell
    rev: v2.2.4
    hooks:
      - id: codespell
@erikbosch
Copy link
Collaborator

MoM:

  • Please discuss
  • PP: Python 3.8 is soon out of life, good to get rid of
  • Erik: What is oldest Python version you have interest in? Anyone using for instance 3.9?
  • PP: In installation instructions show how to install/run using venv, then we could specify version
  • Adnan: Possibly use 3.11+
  • PP: Some may use own python code on top that require 3.8
  • PP: 3.10 is default for Ubuntu22.04

@erikbosch
Copy link
Collaborator

Some thought from my side - In general I am positive but we need to make sure that Continuous integration continue to work. Maybe update to some 3.10 version in files like https://github.com/COVESA/vss-tools/blob/master/Pipfile and https://github.com/COVESA/vss-tools/blob/master/.github/workflows/buildcheck.yml

@erikbosch
Copy link
Collaborator

MoM:

  • Niclas: Will give it a try, but many files changes
  • Erik: We only run it for changed files as of today.
  • Possibly first check a small subset so we can check if changes are accepted

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

3 participants