amber-api 2.0.0

Rust client for Amber Electric's API
Documentation
---
default_install_hook_types:
  - commit-msg
  - pre-commit
  - pre-push

# Unless otherwise specified, all hooks below are run during pre-commit.
default_stages:
  - pre-commit

repos:
  # Generic hooks that apply to a lot of files
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: check-added-large-files
      - id: check-case-conflict
      - id: check-executables-have-shebangs
      - id: check-shebang-scripts-are-executable
        exclude: |
          (?x)^(
            .*\.rs  # The //! used in Rust is not a shebang
          )$
      - id: check-symlinks
      - id: destroyed-symlinks
      - id: end-of-file-fixer
      - id: mixed-line-ending
      - id: trailing-whitespace
        exclude: |
          (?x)^(
            .*\.rs |  # rustfmt handles this, leaving intentional trailing whitespace
            .*/snapshots/.*\.snap  # Snaps are verbatim
          )

      # The following only check that the files are parseable and does _not_
      # modify the formatting.
      - id: check-toml
      - id: check-xml

  - repo: https://github.com/lyz-code/yamlfix/
    rev: 1.19.1
    hooks:
      - id: yamlfix
        args:
          - --config-file=.yamlfix.toml

  - repo: https://gitlab.com/bmares/check-json5
    rev: v1.0.1
    hooks:
      # As above, this only checks for valid JSON files. This implementation
      # allows for comments within JSON files.
      - id: check-json5

  - repo: https://github.com/biomejs/pre-commit
    rev: v2.3.12
    hooks:
      - id: biome-check

  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.14.14
    hooks:
      - id: ruff-check
        args:
          - --fix
          - --exit-non-zero-on-fix
      - id: ruff-format

  - repo: https://github.com/crate-ci/committed
    rev: v1.1.10
    hooks:
      - id: committed

  - repo: https://github.com/DavidAnson/markdownlint-cli2
    rev: v0.20.0
    hooks:
      - id: markdownlint-cli2
        exclude: |
          (?x)^(
            \.github/PULL_REQUEST_TEMPLATE\.md
          )

  - repo: https://github.com/crate-ci/typos
    rev: v1.42.1
    hooks:
      - id: typos

  - repo: https://github.com/shellcheck-py/shellcheck-py
    rev: v0.10.0.1
    hooks:
      - id: shellcheck
        args:
          - --external-sources

  - repo: https://github.com/scop/pre-commit-shfmt
    rev: v3.11.0-1
    hooks:
      - id: shfmt

  - repo: local
    hooks:
      - id: cargo-fmt
        name: cargo fmt
        entry: cargo fmt --
        language: system
        types:
          - rust
        pass_filenames: false  # This makes it a lot faster

      - id: cargo-clippy
        name: cargo clippy
        entry: cargo clippy --all-targets -- -D warnings
        language: system
        types:
          - rust
        pass_filenames: false

      - id: check-ci-scripts-used
        name: Check CI scripts are used
        entry: ./scripts/check-ci-scripts-used
        language: script
        pass_filenames: false
        files: |
          (?x)^(
            scripts/ci/.*
          | \.github/workflows/.*\.yml
          )$

      - id: check-no-embedded-bash
        name: Check no embedded bash in workflows
        entry: ./scripts/check-no-embedded-bash
        language: script
        pass_filenames: false
        files: |-
          (?x)^(
            \.github/workflows/.*\.yml
          )$