diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml new file mode 100644 index 00000000..484d5f60 --- /dev/null +++ b/.github/workflows/pre-commit.yaml @@ -0,0 +1,14 @@ +name: Code quality checks using pre-commit + +on: + pull_request: + push: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a8851816..a9ae48bb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -12,12 +12,15 @@ repos: - id: check-toml - id: pretty-format-json args: ["--autofix", "--no-sort-keys"] + exclude_types: ["jupyter"] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.8 + rev: v0.6.9 hooks: - id: ruff args: [--fix] + exclude_types: ["jupyter"] - id: ruff-format + exclude_types: ["jupyter"] - repo: https://github.com/pycqa/isort rev: 5.13.2 hooks: diff --git a/openeo_udp_cost_profiling/utils.py b/openeo_udp_cost_profiling/utils.py index 6cfa8d17..f77bb796 100644 --- a/openeo_udp_cost_profiling/utils.py +++ b/openeo_udp_cost_profiling/utils.py @@ -113,7 +113,7 @@ def get_job_cost_info(connection, job_id): try: job = connection.job(job_id).describe_job() return float(job["costs"]) - except: + except Exception: return None @@ -155,7 +155,7 @@ def plot_spatio_temporal_cost_profile(df): # Plotting the heatmap using seaborn plt.figure(figsize=(12, 8)) - ax = sns.heatmap( + sns.heatmap( job_cost_grid, cmap=cmap, norm=norm,