diff --git a/.github/workflows/lint-pr.yml b/.github/workflows/lint-pr.yml index e3dfb587..aee6da2d 100644 --- a/.github/workflows/lint-pr.yml +++ b/.github/workflows/lint-pr.yml @@ -1,20 +1,24 @@ -name: "Lint PR" +name: Lint PR on: - pull_request_target: - types: - - opened - - edited - - synchronize - -permissions: - pull-requests: read + pull_request: + branches: [main] jobs: - main: - name: Validate PR title + lint: runs-on: ubuntu-latest steps: - - uses: amannn/action-semantic-pull-request@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ruff isort black + - name: Run linters + run: | + ruff check . + isort --check-only --diff . + black --check --diff . \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 83f05fd2..7b0cca06 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,5 +6,13 @@ repos: args: - --fix - id: ruff-format + - repo: https://github.com/pycqa/isort + rev: 5.12.0 + hooks: + - id: isort + - repo: https://github.com/psf/black + rev: 23.3.0 + hooks: + - id: black ci: autoupdate_schedule: weekly diff --git a/pyproject.toml b/pyproject.toml index 8fa0586f..13bec1fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -98,5 +98,27 @@ exclude = ["src/*", ".git", "docs"] [tool.ruff.mccabe] max-complexity = 10 +[tool.isort] +profile = "black" +line_length = 160 + +[tool.black] +line-length = 160 +target-version = ['py38'] +include = '\.pyi?$' +extend-exclude = ''' +/( + # directories + \.eggs + | \.git + | \.hg + | \.mypy_cache + | \.tox + | \.venv + | build + | dist +)/ +''' + [tool.maturin] module-name = "robyn"