Fast lint CI job: Rustfmt, Prettier, Ruff (#2406)

Add a single job for for fast lint tools. Rustfmt for rust, ruff for
python formatting and linting, prettier avoids inconsistent formatter
changes between pycharm and vscode.
This commit is contained in:
konsti 2024-03-20 01:16:46 +01:00 committed by GitHub
parent ab99a18cbc
commit 79fbac7af5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 31 additions and 22 deletions

View file

@ -23,11 +23,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Install Rust toolchain"
- name: "Install Rustfmt"
run: rustup component add rustfmt
- name: "rustfmt"
run: cargo fmt --all --check
- name: "Prettier"
run: npx prettier --check "**/*.{yaml,yml}"
- name: "Ruff format"
run: pipx run ruff format --diff .
- name: "Ruff check"
run: pipx run ruff check .
cargo-clippy:
name: "cargo clippy"
strategy:

View file

@ -36,4 +36,4 @@ repos:
hooks:
- id: ruff-format
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
args: [--fix, --exit-non-zero-on-fix]

View file

@ -1,6 +1,7 @@
"""
This is implementation has some very rudimentary python bindings
"""
from pep440_rs import Version, VersionSpecifier, Operator, VersionSpecifiers

View file

@ -22,6 +22,7 @@ def _detect_virtualenv() -> str:
return ""
def _run() -> None:
uv = os.fsdecode(find_uv_bin())
@ -39,6 +40,5 @@ def _run() -> None:
os.execvpe(uv, [uv, *sys.argv[1:]], env=env)
if __name__ == "__main__":
_run()

View file

@ -25,6 +25,7 @@ each build, as in:
--uv-path ./target/release/baseline \
requirements.in
"""
import abc
import argparse
import enum
@ -271,11 +272,9 @@ class PipCompile(Suite):
],
)
def install_cold(self, requirements_file: str, *, cwd: str) -> Command | None:
...
def install_cold(self, requirements_file: str, *, cwd: str) -> Command | None: ...
def install_warm(self, requirements_file: str, *, cwd: str) -> Command | None:
...
def install_warm(self, requirements_file: str, *, cwd: str) -> Command | None: ...
class PipSync(Suite):
@ -283,16 +282,13 @@ class PipSync(Suite):
self.name = path or "pip-sync"
self.path = path or "pip-sync"
def resolve_cold(self, requirements_file: str, *, cwd: str) -> Command | None:
...
def resolve_cold(self, requirements_file: str, *, cwd: str) -> Command | None: ...
def resolve_warm(self, requirements_file: str, *, cwd: str) -> Command | None:
...
def resolve_warm(self, requirements_file: str, *, cwd: str) -> Command | None: ...
def resolve_incremental(
self, requirements_file: str, *, cwd: str
) -> Command | None:
...
) -> Command | None: ...
def install_cold(self, requirements_file: str, *, cwd: str) -> Command | None:
cache_dir = os.path.join(cwd, ".cache")

View file

@ -17,6 +17,7 @@ Acknowledgements:
Derived from https://github.com/mitsuhiko/rye/tree/f9822267a7f00332d15be8551f89a212e7bc9017
Originally authored by Armin Ronacher under the MIT license
"""
import argparse
import hashlib
import json

View file

@ -144,9 +144,9 @@ def main(scenarios: list[Path], snapshot_update: bool = True):
"local-used-without-sdist",
):
expected["satisfiable"] = False
expected[
"explanation"
] = "We do not have correct behavior for local version identifiers yet"
expected["explanation"] = (
"We do not have correct behavior for local version identifiers yet"
)
# Split scenarios into `install` and `compile` cases
install_scenarios = []
@ -167,13 +167,13 @@ def main(scenarios: list[Path], snapshot_update: bool = True):
ref = "HEAD" if packse_version == "0.0.0" else packse_version
# Add generated metadata
data[
"generated_from"
] = f"https://github.com/zanieb/packse/tree/{ref}/scenarios"
data["generated_from"] = (
f"https://github.com/zanieb/packse/tree/{ref}/scenarios"
)
data["generated_with"] = "./scripts/scenarios/sync.sh"
data[
"vendor_links"
] = f"https://raw.githubusercontent.com/zanieb/packse/{ref}/vendor/links.html"
data["vendor_links"] = (
f"https://raw.githubusercontent.com/zanieb/packse/{ref}/vendor/links.html"
)
data["index_url"] = f"https://astral-sh.github.io/packse/{ref}/simple-html/"