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

Add ruff and update files #142

Merged
merged 11 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

5 changes: 1 addition & 4 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ jobs:
VALIDATE_JSON: true
VALIDATE_MD: true
VALIDATE_POWERSHELL: true
VALIDATE_PYTHON: true
VALIDATE_PYTHON_PYLINT: true
VALIDATE_PYTHON_ISORT: true
PYTHON_ISORT_CONFIG_FILE: pyproject.toml
VALIDATE_PYTHON: false
VALIDATE_TYPESCRIPT_ES: true
VALIDATE_YAML: true
DISABLE_ERRORS: false
Expand Down
5 changes: 0 additions & 5 deletions .isort.cfg

This file was deleted.

48 changes: 15 additions & 33 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,29 @@ repos:
entry: python3 tests/build-init-files.py -v --root .
language: python
pass_filenames: false
additional_dependencies: [click~=7.1]
# The following, commented hook is the usual way to add isort. However, it doesn't work in some environments.
# See https://github.com/PyCQA/isort/issues/1874#issuecomment-1002212936
# -----------------------------------------------------
# - repo: https://github.com/pycqa/isort
# rev: 5.9.3
# hooks:
# - id: isort
# -----------------------------------------------------
# The hook below is the workaround for the issue above.
additional_dependencies: [click~=8.1]
- repo: local
hooks:
- id: isort
name: isort
entry: isort
- id: ruff_format
name: ruff format
entry: ./activated.py ruff format
language: system
require_serial: true
language: python
language_version: python3
types_or: [cython, pyi, python]
args: ['--filter-files']
minimum_pre_commit_version: '2.9.2'
additional_dependencies: [isort==5.10.1]
types_or: [python, pyi]
- repo: local
hooks:
- id: ruff
name: Ruff
entry: ./activated.py ruff check --fix
language: system
types: [python]
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.8.0-1
rev: v3.10.0-2
hooks:
- id: shfmt
args: ["--diff", "--write", "-i", "2"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v5.0.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
Expand All @@ -43,18 +37,6 @@ repos:
- id: check-merge-conflict
- id: check-ast
- id: debug-statements
- repo: local
hooks:
- id: black
name: black
entry: black
language: system
require_serial: true
types_or: [python, pyi]
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
- repo: local
hooks:
- id: mypy
Expand Down
8 changes: 6 additions & 2 deletions activated.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
$ErrorActionPreference = "Stop"

$script_directory = Split-Path $MyInvocation.MyCommand.Path -Parent
$command = $args[0]
$parameters = [System.Collections.ArrayList]$args
$parameters.RemoveAt(0)

if (Test-Path -Path $script_directory/venv) {
& $script_directory/venv/Scripts/Activate.ps1
}
& @args
}
& $command @parameters

exit $LASTEXITCODE
2 changes: 1 addition & 1 deletion activated.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def main(*args: str) -> int:
script = "activated.sh"
command = ["sh", os.fspath(here.joinpath(script)), *args]

completed_process = subprocess.run(command)
completed_process = subprocess.run(command, check=False)

return completed_process.returncode

Expand Down
Loading
Loading