From 4bfc94ef049f395516f46bf86ab6ff1a42394e7b Mon Sep 17 00:00:00 2001 From: Rasmus Rendal Date: Wed, 5 Aug 2026 16:32:32 +0200 Subject: [PATCH] chore(deps): Bump engineering-standards --- .config/filegen-manifest.json | 33 ----- .config/nextest.toml | 2 +- .editorconfig | 29 ++-- .gitattributes | 4 +- .github/workflows/check-pre-commit-hooks.yml | 20 ++- .pre-commit-config.yaml | 43 +++++- .taplo.toml | 14 ++ Cargo.toml | 33 ++--- REUSE.toml | 12 ++ deny.toml | 134 ++++++++++++++----- flake.lock | 28 +++- flake.nix | 4 +- gen-config-schema.sh | 4 +- treefmt.toml | 45 +++++++ 14 files changed, 286 insertions(+), 119 deletions(-) delete mode 100644 .config/filegen-manifest.json create mode 100644 .taplo.toml create mode 100644 treefmt.toml 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..37de939 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,30 +1,27 @@ -# SPDX-FileCopyrightText: 2025 Famedly GmbH (info@famedly.com) +# 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..4d7f8b5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,6 @@ .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 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/.pre-commit-config.yaml b/.pre-commit-config.yaml index 40030cd..dfa6037 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,24 +1,43 @@ 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 +48,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 +57,25 @@ 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 diff --git a/.taplo.toml b/.taplo.toml new file mode 100644 index 0000000..7e84803 --- /dev/null +++ b/.taplo.toml @@ -0,0 +1,14 @@ +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..5e9fb8c 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -22,3 +22,15 @@ path = ".github/workflows/check-pre-commit-hooks.yml" SPDX-FileCopyrightText = "2026 Famedly GmbH" SPDX-License-Identifier = "Apache-2.0" path = ".pre-commit-config.yaml" +[[annotations]] +SPDX-FileCopyrightText = "2026 Famedly GmbH" +SPDX-License-Identifier = "Apache-2.0" +path = ".editorconfig" +[[annotations]] +SPDX-FileCopyrightText = "2026 Famedly GmbH" +SPDX-License-Identifier = "Apache-2.0" +path = ".taplo.toml" +[[annotations]] +SPDX-FileCopyrightText = "2026 Famedly GmbH" +SPDX-License-Identifier = "Apache-2.0" +path = "treefmt.toml" 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..19f1794 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": 1785900961, + "narHash": "sha256-eiTBgAEt1Fw+blSYDOEzMN+FPqLvgG/aeuOwet8XKsc=", "owner": "famedly", "repo": "engineering-standards", - "rev": "290c8d41a96f2ae17e6fa2569b61eaba5a1141b9", + "rev": "c9a72157f5682df78e394badfca08a7436822f03", "type": "github" }, "original": { @@ -149,6 +150,27 @@ "type": "github" } }, + "treefmt": { + "inputs": { + "nixpkgs": [ + "famedly-engineering-standards", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1780220602, + "narHash": "sha256-eynAfOmbmxJnkp7YewvCEbShNnnYJ9gLLqkzsYtBPeM=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "db947814a175b7ca6ded66e21383d938df01c227", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "wrappers": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index a851905..7110d54 100644 --- a/flake.nix +++ b/flake.nix @@ -12,9 +12,7 @@ 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; 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..6629a63 --- /dev/null +++ b/treefmt.toml @@ -0,0 +1,45 @@ +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", +] +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"]