diff --git a/.config/filegen-manifest.json b/.config/filegen-manifest.json deleted file mode 100644 index 5a4fc9e..0000000 --- a/.config/filegen-manifest.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "clobber-by-default": true, - "files": [ - { - "clobber": null, - "deactivate": null, - "ignore-modification": null, - "permissions": "600", - "source": "/nix/store/i9wgm4ljangrsv39rjdqyq9j96hj29zm-pre-commit-config.yaml", - "target": "./.pre-commit-config.yaml", - "type": "copy" - }, - { - "clobber": null, - "deactivate": null, - "ignore-modification": null, - "permissions": "600", - "source": "/nix/store/yw3vsh26id80w6bivi9v4x3b835b4r5j-check-pre-commit-hooks.yml", - "target": "./.github/workflows/check-pre-commit-hooks.yml", - "type": "copy" - }, - { - "clobber": null, - "deactivate": null, - "ignore-modification": null, - "permissions": "600", - "source": "/nix/store/mv9zlzz043051izx92fxk6ibz6fn21yd-gitattributes", - "target": ".gitattributes", - "type": "copy" - } - ], - "version": 3 -} diff --git a/.config/nextest.toml b/.config/nextest.toml index 46e3098..30a57bd 100644 --- a/.config/nextest.toml +++ b/.config/nextest.toml @@ -7,5 +7,5 @@ fail-fast = false [profile.ci.junit] path = "junit.xml" -store-success-output = true store-failure-output = true +store-success-output = true diff --git a/.editorconfig b/.editorconfig index 0f1092f..280943d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,30 +1,31 @@ -# SPDX-FileCopyrightText: 2025 Famedly GmbH (info@famedly.com) +## SPDX-FileCopyrightText: 2026 Famedly GmbH +## +## SPDX-License-Identifier: Apache-2.0 + +# managed-by: engineering-standards — do not edit manually. # -# SPDX-License-Identifier: Apache-2.0 -# SPDX-License-Identifier: CC0-1.0 +# Regenerate with `nix run .#filegen-activate`. root = true [*] +charset = utf-8 end_of_line = lf insert_final_newline = true -trim_trailing_whitespace = true -indent_size = 4 -indent_style = tab -[*.y{,a}ml] indent_style = space indent_size = 2 -[*.sql] -indent_style = space +# Matches the `shfmt` settings in our treefmt configuration. +[*.{sh,bash}] +indent_style = tab -[*.toml] -indent_style = space +[{Makefile,*.mk}] +indent_style = tab -[*.md] -indent_style = space -indent_size = 2 +[*.{rs,go}] +indent_style = tab -[*.ldif] -insert_final_newline = false +# Deliberately absent: `trim_trailing_whitespace`. It conflicts with rustfmt in +# places (which is why the `trailing-whitespace` pre-commit hook is off too), +# and hard-wrapped markdown uses it for line breaks. diff --git a/.gitattributes b/.gitattributes index 5daa663..79d47b0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,15 @@ +## SPDX-FileCopyrightText: 2026 Famedly GmbH +## +## SPDX-License-Identifier: Apache-2.0 + +# managed-by: engineering-standards — do not edit manually. +# +# Regenerate with `nix run .#filegen-activate`. + .pre-commit-config.yaml linguist-generated .github/workflows/check-pre-commit-hooks.yml linguist-generated .gitattributes linguist-generated -.config/filegen-manifest.json linguist-generated +.editorconfig linguist-generated +treefmt.toml linguist-generated +.taplo.toml linguist-generated +.github/workflows/check-pre-commit-hooks.yml.license linguist-generated diff --git a/.github/workflows/check-pre-commit-hooks.yml b/.github/workflows/check-pre-commit-hooks.yml index f5477fd..8d75af6 100644 --- a/.github/workflows/check-pre-commit-hooks.yml +++ b/.github/workflows/check-pre-commit-hooks.yml @@ -7,13 +7,25 @@ jobs: prek: runs-on: ubuntu-latest steps: + - name: Free up disk space + run: | + sudo rm -rf /usr/share/dotnet /usr/share/swift /usr/local/lib/android \ + /opt/ghc /opt/hostedtoolcache + df -h / - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 + with: + persist-credentials: false - uses: cachix/install-nix-action@8aa03977d8d733052d78f4e008a241fd1dbf36b3 - - name: Run pre-commit hooks - run: prek --all-files --show-diff-on-failure - shell: nix develop .#standards --command bash {0} + - env: + PREK_COLOR: always + TREEFMT_NO_CACHE: "1" + name: Run pre-commit hooks + run: prek --all-files --show-diff-on-failure --stage pre-push + shell: nix develop .#standards --command bash -e {0} + timeout-minutes: 30 name: Make sure all pre-commit hooks pass "on": + merge_group: {} pull_request: branches: - '**' @@ -22,3 +34,5 @@ name: Make sure all pre-commit hooks pass - reopened - synchronize - ready_for_review +permissions: + contents: read diff --git a/.github/workflows/check-pre-commit-hooks.yml.license b/.github/workflows/check-pre-commit-hooks.yml.license new file mode 100644 index 0000000..ee35b44 --- /dev/null +++ b/.github/workflows/check-pre-commit-hooks.yml.license @@ -0,0 +1,3 @@ +SPDX-FileCopyrightText: 2026 Famedly GmbH + +SPDX-License-Identifier: Apache-2.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 40030cd..d1a50b0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,24 +1,47 @@ +## SPDX-FileCopyrightText: 2026 Famedly GmbH +## +## SPDX-License-Identifier: Apache-2.0 + repos: - hooks: - id: check-added-large-files + stages: [] - id: check-case-conflict + stages: [] - id: check-illegal-windows-names + stages: [] - id: end-of-file-fixer + stages: [] - id: fix-byte-order-marker + stages: [] - id: check-json + stages: [] - id: check-json5 + stages: [] - id: check-toml + stages: [] - id: check-vcs-permalinks + stages: [] - id: check-xml + stages: [] - args: - --fix=lf id: mixed-line-ending + stages: [] - id: check-symlinks + stages: [] - id: destroyed-symlinks + stages: [] - id: check-merge-conflict + stages: [] - id: detect-private-key - - id: check-shebang-scripts-are-executable + stages: [] + - exclude_types: + - rust + id: check-shebang-scripts-are-executable + stages: [] - id: check-executables-have-shebangs + stages: [] repo: builtin - hooks: - args: @@ -29,6 +52,7 @@ repos: id: typos language: system name: typos + stages: [] types: - text - description: Ensure that files set up with the filegen module are up-to-date @@ -37,4 +61,35 @@ repos: language: system name: filegen pass_filenames: false + stages: [] + - description: Format *all* files + entry: treefmt + id: treefmt + language: system + name: treefmt + require_serial: true + stages: [] + repo: local +- hooks: + - args: + - follow + description: Ensure that flake inputs are recursively de-duplicated + entry: flake-edit + files: + glob: '{flake.nix,flake.lock}' + id: flake-follows + language: system + name: flake-follows + pass_filenames: false + stages: [] + repo: local +- hooks: + - args: + - lint-file + description: Ensure compliance with REUSE recommendations + entry: reuse + id: reuse + language: system + name: reuse + stages: [] repo: local diff --git a/.taplo.toml b/.taplo.toml new file mode 100644 index 0000000..09bbd80 --- /dev/null +++ b/.taplo.toml @@ -0,0 +1,18 @@ +## SPDX-FileCopyrightText: 2026 Famedly GmbH +## +## SPDX-License-Identifier: Apache-2.0 + +exclude = ["target-analyzer/**", "target/**"] + +[formatting] +# Aligning entries causes conflicts regularly. While it does increase readability, it harms the devex, so we don't align +# them for now. +align_entries = false +allowed_blank_lines = 1 +array_auto_collapse = true +array_auto_expand = true +column_width = 120 +# We can't reorder arrays, since `module-item-order-groupings` in .clippy.toml +# is sensitive to the ordering of its elements +reorder_arrays = false +reorder_keys = true diff --git a/Cargo.toml b/Cargo.toml index d72d320..c6bb6c1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,14 +3,14 @@ # SPDX-License-Identifier: Apache-2.0 [package] -name = "rust-telemetry" -version = "1.4.0" authors = [] +description = "Observability helpers originally developed for internal use at Famedly" edition = "2024" +license = "Apache-2.0" +name = "rust-telemetry" repository = "https://github.com/famedly/rust-telemetry" resolver = "2" -license = "Apache-2.0" -description = "Observability helpers originally developed for internal use at Famedly" +version = "1.4.0" # publish = ["famedly"] [[bin]] @@ -20,10 +20,7 @@ required-features = ["schemars", "serde_yaml"] [dependencies] async-trait = { version = "^0.1.51" } -famedly_rust_utils = { version = "1.1.0", features = [ - "level_filter", - "schemars", -] } +famedly_rust_utils = { version = "1.1.0", features = ["level_filter", "schemars"] } http = { version = "1.2.0" } once_cell = { version = "1.20.2" } opentelemetry = { version = "0.32.0" } @@ -31,14 +28,14 @@ opentelemetry-appender-tracing = { version = "0.32.0" } opentelemetry-otlp = { version = "0.32.0", features = ["grpc-tonic"] } opentelemetry-semantic-conventions = { version = "0.32.0" } opentelemetry_sdk = { version = "0.32.0", features = ["rt-tokio"] } +schemars = { version = "1.0.4", optional = true, features = ["url2"] } +serde = { version = "1.0.210", features = ["derive"] } +serde_yaml = { version = "0.9.34", optional = true } thiserror = "1.0.64" +tracing = "0.1.40" tracing-opentelemetry = { version = "0.33.0" } tracing-subscriber = { version = "0.3.19", features = ["env-filter", "json"] } -tracing = "0.1.40" -serde = { version = "1.0.210", features = ["derive"] } url = { version = "2.5.2", features = ["serde"] } -schemars = { version = "1.0.4", optional = true, features = ["url2"] } -serde_yaml = { version = "0.9.34", optional = true } # tracing-error tracing-error = { version = "0.2.1", optional = true } @@ -50,21 +47,15 @@ reqwest-middleware = { version = "0.5.1", optional = true } # axum axum = { version = "^0.8", optional = true } -opentelemetry-instrumentation-tower = { version = "0.18.0", features = [ - "axum", -], optional = true } +opentelemetry-instrumentation-tower = { version = "0.18.0", features = ["axum"], optional = true } opentelemetry-resource-detectors = "0.11.0" [dev-dependencies] tokio = { version = "1.43.0", features = ["full"] } [features] -reqwest-middleware = [ - "dep:reqwest", - "dep:reqwest-middleware", - "dep:opentelemetry-http", -] axum = ["dep:axum", "dep:opentelemetry-instrumentation-tower"] +reqwest-middleware = ["dep:reqwest", "dep:reqwest-middleware", "dep:opentelemetry-http"] schemars = ["dep:schemars", "famedly_rust_utils/schemars"] tracing-error = ["dep:tracing-error"] @@ -79,7 +70,6 @@ unused_import_braces = "warn" unused_qualifications = "warn" [lints.clippy] -tabs_in_doc_comments = "allow" branches_sharing_code = "warn" cast_lossless = "warn" cast_possible_wrap = "warn" @@ -143,6 +133,7 @@ str_to_string = "warn" string_to_string = "warn" suboptimal_flops = "warn" suspicious_operation_groupings = "warn" +tabs_in_doc_comments = "allow" too_many_lines = "warn" trait_duplication_in_bounds = "warn" trivially_copy_pass_by_ref = "warn" diff --git a/REUSE.toml b/REUSE.toml index b0d1dcb..0bdb6d2 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -3,22 +3,3 @@ # SPDX-License-Identifier: CC0-1.0 version = 1 - -# Files autogenerated by engineering-standards -# Quite unlikely to be actually copyrightable, but we might as well try -[[annotations]] -SPDX-FileCopyrightText = "2026 Famedly GmbH" -SPDX-License-Identifier = "Apache-2.0" -path = ".gitattributes" -[[annotations]] -SPDX-FileCopyrightText = "2026 Famedly GmbH" -SPDX-License-Identifier = "Apache-2.0" -path = ".config/filegen-manifest.json" -[[annotations]] -SPDX-FileCopyrightText = "2026 Famedly GmbH" -SPDX-License-Identifier = "Apache-2.0" -path = ".github/workflows/check-pre-commit-hooks.yml" -[[annotations]] -SPDX-FileCopyrightText = "2026 Famedly GmbH" -SPDX-License-Identifier = "Apache-2.0" -path = ".pre-commit-config.yaml" diff --git a/deny.toml b/deny.toml index 94ba1d9..3e7f967 100644 --- a/deny.toml +++ b/deny.toml @@ -7,19 +7,19 @@ # See https://spdx.org/licenses/ for list of possible licenses # [possible values: any SPDX 3.11 short identifier (+ optional exception)]. allow = [ - "MIT", - "MIT-0", - "Apache-2.0", - "ISC", - "0BSD", - "BSD-2-Clause", - "BSD-3-Clause", - "BSD-3-Clause-Clear", - "BSD-4-Clause", - "CC0-1.0", - "MS-PL", - "Zlib", - "Unicode-3.0", + "MIT", + "MIT-0", + "Apache-2.0", + "ISC", + "0BSD", + "BSD-2-Clause", + "BSD-3-Clause", + "BSD-3-Clause-Clear", + "BSD-4-Clause", + "CC0-1.0", + "MS-PL", + "Zlib", + "Unicode-3.0", ] # Do not warn if we allow a license not used by any crate in the dependency graph unused-allowed-license = "allow" @@ -30,26 +30,90 @@ unused-allowed-license = "allow" confidence-threshold = 0.95 exceptions = [ - { crate = "famedly_rust_utils", allow = ["AGPL-3.0"] }, - { crate = "icu_collections", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "icu_locid", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "icu_locid_transform", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "icu_locid_transform_data", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "icu_normalizer", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "icu_normalizer_data", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "icu_properties", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "icu_properties_data", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "icu_provider", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "icu_provider_macros", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "litemap", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "tinystr", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "unicode-ident", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "webpki-root-certs", allow = ["CDLA-Permissive-2.0"] }, - { crate = "writable", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "yoke", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "yoke-derive", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "zerofrom", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "zerofrom-derive", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "zerovec", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, - { crate = "zerovec-derive", allow = ["Unicode-DFS-2016", "Unicode-3.0"] }, + { crate = "famedly_rust_utils", allow = [ + "AGPL-3.0", + ] }, + { crate = "icu_collections", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "icu_locid", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "icu_locid_transform", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "icu_locid_transform_data", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "icu_normalizer", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "icu_normalizer_data", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "icu_properties", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "icu_properties_data", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "icu_provider", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "icu_provider_macros", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "litemap", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "tinystr", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "unicode-ident", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "webpki-root-certs", allow = [ + "CDLA-Permissive-2.0", + ] }, + { crate = "writable", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "yoke", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "yoke-derive", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "zerofrom", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "zerofrom-derive", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "zerovec", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, + { crate = "zerovec-derive", allow = [ + "Unicode-DFS-2016", + "Unicode-3.0", + ] }, ] diff --git a/flake.lock b/flake.lock index f05257b..c4eb1a8 100644 --- a/flake.lock +++ b/flake.lock @@ -28,14 +28,15 @@ "github-actions-nix": "github-actions-nix", "nixpkgs": "nixpkgs", "rust-overlay": "rust-overlay", + "treefmt": "treefmt", "wrappers": "wrappers" }, "locked": { - "lastModified": 1781559938, - "narHash": "sha256-vb0triMbrih+SNoWRBH4lWSCsjo7bCL26TrZwNrBTHs=", + "lastModified": 1787134750, + "narHash": "sha256-C8QH+AYna7E/P2vuGc06q/UeCknMp0WAT5dihYzhpYY=", "owner": "famedly", "repo": "engineering-standards", - "rev": "290c8d41a96f2ae17e6fa2569b61eaba5a1141b9", + "rev": "0009f3c52555fb5d2461871b2d1573f5429ee2a4", "type": "github" }, "original": { @@ -49,11 +50,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1778716662, - "narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=", + "lastModified": 1785627969, + "narHash": "sha256-4dtXQk/NMePegK/nWp5NSeuZKLATItOq61lpEvmXqGw=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb", + "rev": "427bf4bd9435fdf21321c8cc628c24efc14c0f7a", "type": "github" }, "original": { @@ -74,11 +75,11 @@ ] }, "locked": { - "lastModified": 1773808042, - "narHash": "sha256-97K9g40SdtDVWslJG8ytpiC3+qgeQzftsZheGQ8qoGY=", + "lastModified": 1780538232, + "narHash": "sha256-4fAohjPxuyg7m9iK1A9j/bLgsrNf7Nkqsl9BUks02SE=", "owner": "synapdeck", "repo": "github-actions-nix", - "rev": "805a4f69856e0f3d0bcd8ae916f1625f22b0578c", + "rev": "9068b31c3acd21b5d3354268faf182dafb21f5a5", "type": "github" }, "original": { @@ -89,11 +90,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1779622335, - "narHash": "sha256-6lZN0CPBbeK9UVgFQ8EV4t2qSVQPhhlerFBGZRiz73Y=", - "rev": "705e9929918b43bd7b715dc0a878ac870449bb03", + "lastModified": 1786430034, + "narHash": "sha256-1MqAfG80fHLnWolvR3ULsMsXwMKFIJaWob8OI9yRcB0=", + "rev": "70cc4559b10a6062b05ff1af17e0add065ccaed9", "type": "tarball", - "url": "https://releases.nixos.org/nixos/26.05/nixos-26.05beta1.705e9929918b/nixexprs.tar.xz?lastModified=1779622335&rev=705e9929918b43bd7b715dc0a878ac870449bb03" + "url": "https://releases.nixos.org/nixos/26.05/nixos-26.05.7443.70cc4559b10a/nixexprs.tar.xz" }, "original": { "type": "tarball", @@ -102,11 +103,11 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1777168982, - "narHash": "sha256-GOkGPcboWE9BmGCRMLX3worL4EMnsnG8MyKmXNeYuhQ=", + "lastModified": 1785031560, + "narHash": "sha256-OmshNvn2vupOFpYinLUu+1Dnpu4n7Q5N3ggGVNHpkUI=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "f5901329dade4a6ea039af1433fb087bd9c1fe14", + "rev": "0e79af5e3d4dcfcd676ab5ba3f95d2e3352e078c", "type": "github" }, "original": { @@ -136,11 +137,11 @@ ] }, "locked": { - "lastModified": 1779851998, - "narHash": "sha256-UkkMh3bX9QW4Luqkm98nUaOqKWrU6i65mUnph3WeSSw=", + "lastModified": 1786507911, + "narHash": "sha256-w5aZRLbiu7H6TqsYXVMdRKg0S4DRaJpxyqxx86AwxVk=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "6cddd512fa2bf7231f098d3a2f92f6e4cff71e0a", + "rev": "39db48099ad16834af7e27485a4babf9c28b3897", "type": "github" }, "original": { @@ -149,6 +150,27 @@ "type": "github" } }, + "treefmt": { + "inputs": { + "nixpkgs": [ + "famedly-engineering-standards", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1785945821, + "narHash": "sha256-NLSyTCW4K4ofhNBllt3omPasm6QpralXH1DBZOc91Dw=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "ae7910970dddc408fe6ab1c8e4b277bb21d72dc0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "wrappers": { "inputs": { "nixpkgs": [ @@ -157,11 +179,11 @@ ] }, "locked": { - "lastModified": 1780661205, - "narHash": "sha256-3F5DixT3Gk91lBI9E+TGMm0ko5HrRbDiL23di16TJGA=", + "lastModified": 1782135443, + "narHash": "sha256-vAmbArdCyjqpVW+37aCy/PMBOLIqukUXLQuEKLwUhA4=", "owner": "BirdeeHub", "repo": "nix-wrapper-modules", - "rev": "8dd304c3582ddd339217e1cc5fb53f50acb63c2d", + "rev": "6e7f66fa2cdf4d63162580b438f7fcf87c28a46f", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a851905..d2b6b8c 100644 --- a/flake.nix +++ b/flake.nix @@ -12,16 +12,12 @@ outputs = { flake-parts, ... }@inputs: flake-parts.lib.mkFlake { inherit inputs; } { - imports = [ - inputs.famedly-engineering-standards.flakeModules.default - ]; + imports = [ inputs.famedly-engineering-standards.flakeModules.default ]; systems = inputs.famedly-engineering-standards.lib.famedlySystems; - perSystem = - { inputs', ... }: - { - devShells.default = inputs'.famedly-engineering-standards.devShells.rust; - }; + perSystem = { inputs', ... }: { + devShells.default = inputs'.famedly-engineering-standards.devShells.rust; + }; }; } diff --git a/gen-config-schema.sh b/gen-config-schema.sh index 2b73171..3fb60ba 100755 --- a/gen-config-schema.sh +++ b/gen-config-schema.sh @@ -3,13 +3,13 @@ # SPDX-FileCopyrightText: 2025 Famedly GmbH (info@famedly.com) # # SPDX-License-Identifier: Apache-2.0 -cat < config-schema.yaml +cat <config-schema.yaml # SPDX-FileCopyrightText: 2025 Famedly GmbH (info@famedly.com) # # SPDX-License-Identifier: Apache-2.0 EOF -cargo run -q --features serde_yaml,schemars --bin gen-config-schema >> config-schema.yaml +cargo run -q --features serde_yaml,schemars --bin gen-config-schema >>config-schema.yaml if [ ! -z "$(git diff --name-only 'config-schema.yaml' 2>&1)" ]; then echo "config-schema.yaml has changed, try adding and committing it again" diff --git a/treefmt.toml b/treefmt.toml new file mode 100644 index 0000000..ac605ae --- /dev/null +++ b/treefmt.toml @@ -0,0 +1,50 @@ +## SPDX-FileCopyrightText: 2026 Famedly GmbH +## +## SPDX-License-Identifier: Apache-2.0 + +allowMissingFormatter = false +excludes = [ + "*.lock", + "*.patch", + "package-lock.json", + "go.mod", + "go.sum", + ".gitattributes", + ".gitignore", + ".gitmodules", + ".hgignore", + ".svnignore", + "LICENSE", + ".pre-commit-config.yaml", + ".github/workflows/check-pre-commit-hooks.yml", + ".gitattributes", + ".editorconfig", + "treefmt.toml", + ".taplo.toml", + ".github/workflows/check-pre-commit-hooks.yml.license", +] +walk = "git" + +[formatter.nixfmt] +command = "nixfmt" +excludes = [] +includes = ["*.nix"] +options = ["--strict"] + +[formatter.rustfmt] +command = "rustfmt" +excludes = [] +includes = ["*.rs"] +options = ["--config", "skip_children=true", "--edition", "2024"] + +[formatter.shfmt] +command = "shfmt" +excludes = [] +includes = ["*.sh", "*.bash", "*.envrc", "*.envrc.*"] +options = ["-w", "-i", "0", "-s"] + +[formatter.taplo] +command = "taplo" +excludes = [] +includes = ["*.toml"] +options = ["format"]