diff --git a/Cargo.toml b/Cargo.toml index dff49b3b..0b2aaa95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,3 +64,51 @@ overflow-checks = true [workspace.metadata.fmt] check_command = "cargo fmt --all -- --check" format_command = "cargo fmt --all" + +# ── Workspace-level lint configuration (#1199) ──────────────────────────────── +# Selected clippy::pedantic lints enabled across all 19 contracts. +# See clippy.toml for the full rationale on lints that were SKIPPED. +# +# Each crate that inherits this workspace lint table via `[lints] workspace = true` +# will have these lints active. Individual allow-attributes with a comment +# justification are used at the call site when a lint fires on intentional code. +[workspace.lints.clippy] +# Correctness / subtle bugs +bool_to_int_with_if = "warn" # prefer `usize::from(cond)` over `if cond { 1 } else { 0 }` +cloned_instead_of_copied = "warn" # prefer `.copied()` for Copy types +default_trait_access = "warn" # prefer `Default::default()` over `SomeType::default()` +explicit_iter_loop = "warn" # prefer `for x in iter` over `for x in iter.into_iter()` +filter_map_next = "warn" # prefer `.find_map()` over `.filter_map().next()` +flat_map_option = "warn" # prefer `.filter_map()` over `.flat_map(|x| Some(x)...)` +if_not_else = "warn" # prefer positive conditions first +inconsistent_struct_constructor = "warn" # field order must match struct definition +inefficient_to_string = "warn" # avoid redundant `.to_string()` on already-owned strings +items_after_statements = "warn" # keep item definitions at the top of blocks +manual_assert = "warn" # prefer `assert!()` over `if cond { panic!(...) }` +manual_let_else = "warn" # prefer `let … else` over `match` with early return +manual_ok_or = "warn" # prefer `.ok_or()` over `match … { Some(v) => Ok(v), None => Err(e) }` +map_unwrap_or = "warn" # prefer `.unwrap_or_else()` over `.map().unwrap_or()` +match_bool = "warn" # prefer `if/else` over `match` on booleans +match_same_arms = "warn" # merge identical match arms +needless_continue = "warn" # remove redundant `continue` at end of loop +needless_pass_by_value = "warn" # prefer pass-by-reference when ownership is not needed +range_minus_one = "warn" # prefer `..end` over `..=end - 1` +range_plus_one = "warn" # prefer `..=end` over `..end + 1` +redundant_closure_for_method_calls = "warn" # prefer method references over wrapping closures +return_self_not_must_use = "warn" # builder-pattern methods should be `#[must_use]` +same_functions_in_if_blocks = "warn" # identical function calls in if/else branches +semicolon_if_nothing_returned = "warn" # add trailing `;` to expression statements +unnested_or_patterns = "warn" # prefer `A | B` over nested `match` +unused_self = "warn" # methods that don't use `self` should be free functions +used_underscore_binding = "warn" # using a `_`-prefixed variable suggests it's intentionally unused + +# Lints kept at allow (would require large churn or are inapplicable): +# missing_errors_doc, missing_panics_doc — see clippy.toml rationale +# module_name_repetitions — ABI-breaking rename for TokenContract, etc. +# must_use_candidate — too noisy on entry-point fns +# wildcard_imports — soroban_sdk glob imports are idiomatic +# too_many_lines — contract fns are intentionally verbose +# struct_excessive_bools — on-chain state structs need bool fields +# cast_possible_truncation — required for SDK TTL/timestamp APIs +# cast_sign_loss — same as above +# cast_precision_loss — no float arithmetic in contracts diff --git a/apps/backend/package.json b/apps/backend/package.json index 182b8003..884b8c61 100644 --- a/apps/backend/package.json +++ b/apps/backend/package.json @@ -98,10 +98,8 @@ "xml2js": "^0.6.2" }, "devDependencies": { - "@eslint/js": "^8.56.0", "@faker-js/faker": "^8.4.1", - "@nestjs/apollo": "^10.0.0", - "@nestjs/cli": "^12.0.7", + "@nestjs/cli": "^10.0.0", "@nestjs/testing": "^10.4.22", "@pact-foundation/pact": "^16.3.0", "@testcontainers/postgresql": "^12.1.0", diff --git a/clippy.toml b/clippy.toml index 3c8c97f8..6dc0da2d 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,7 +1,12 @@ # Brain-Storm Clippy configuration # Run: cargo clippy --workspace -- -D warnings +# +# Pedantic lint selection (#1199): +# The selected clippy::pedantic lints are declared in [workspace.lints.clippy] +# in the root Cargo.toml and inherited by every contract crate via +# `[lints] workspace = true`. See Cargo.toml for the full annotated list and +# the rationale for lints that were intentionally skipped. -# Disallow integer arithmetic that doesn't use checked/saturating/wrapping variants -# (enforced manually; use checked_add, checked_sub, etc.) - +# Minimum Supported Rust Version — keeps lint suggestions compatible with the +# toolchain declared in rust-toolchain.toml. msrv = "1.70.0" diff --git a/contracts/analytics/Cargo.toml b/contracts/analytics/Cargo.toml index 3b58166b..080861bc 100644 --- a/contracts/analytics/Cargo.toml +++ b/contracts/analytics/Cargo.toml @@ -13,3 +13,6 @@ brain-storm-shared = { path = "../shared", default-features = false } [dev-dependencies] soroban-sdk = { version = "21.0.0", features = ["testutils"] } proptest = "1.4" + +[lints] +workspace = true diff --git a/contracts/badges/Cargo.toml b/contracts/badges/Cargo.toml index eb71c36e..ddf8d712 100644 --- a/contracts/badges/Cargo.toml +++ b/contracts/badges/Cargo.toml @@ -18,3 +18,6 @@ opt-level = "z" lto = true codegen-units = 1 strip = true + +[lints] +workspace = true diff --git a/contracts/buyback/Cargo.toml b/contracts/buyback/Cargo.toml index 907c930c..bb15e729 100644 --- a/contracts/buyback/Cargo.toml +++ b/contracts/buyback/Cargo.toml @@ -14,4 +14,6 @@ crate-type = ["cdylib", "rlib"] opt-level = "z" lto = true codegen-units = 1 -strip = true \ No newline at end of file +strip = true +[lints] +workspace = true diff --git a/contracts/certificate/Cargo.toml b/contracts/certificate/Cargo.toml index 95af0b89..3d98f423 100644 --- a/contracts/certificate/Cargo.toml +++ b/contracts/certificate/Cargo.toml @@ -13,3 +13,6 @@ brain-storm-shared = { path = "../shared", default-features = false } [dev-dependencies] soroban-sdk = { version = "21.0.0", features = ["testutils"] } proptest = "1.4" + +[lints] +workspace = true diff --git a/contracts/credential_metadata/Cargo.toml b/contracts/credential_metadata/Cargo.toml index d9210637..22e610ac 100644 --- a/contracts/credential_metadata/Cargo.toml +++ b/contracts/credential_metadata/Cargo.toml @@ -15,3 +15,6 @@ crate-type = ["cdylib", "rlib"] [profile.release] opt-level = "z" lto = true + +[lints] +workspace = true diff --git a/contracts/dispute/Cargo.toml b/contracts/dispute/Cargo.toml index 54601882..253c9a94 100644 --- a/contracts/dispute/Cargo.toml +++ b/contracts/dispute/Cargo.toml @@ -15,3 +15,6 @@ opt-level = "z" lto = true codegen-units = 1 strip = true + +[lints] +workspace = true diff --git a/contracts/governance/Cargo.toml b/contracts/governance/Cargo.toml index adf38c2c..2c5fea17 100644 --- a/contracts/governance/Cargo.toml +++ b/contracts/governance/Cargo.toml @@ -12,3 +12,6 @@ brain-storm-shared = { path = "../shared", default-features = false } [dev-dependencies] soroban-sdk = { version = "21.0.0", features = ["testutils"] } + +[lints] +workspace = true diff --git a/contracts/grants/Cargo.toml b/contracts/grants/Cargo.toml index e571d761..6a689040 100644 --- a/contracts/grants/Cargo.toml +++ b/contracts/grants/Cargo.toml @@ -18,3 +18,6 @@ opt-level = "z" lto = true codegen-units = 1 strip = true + +[lints] +workspace = true diff --git a/contracts/integration/Cargo.toml b/contracts/integration/Cargo.toml index 4ddc836e..c65eecab 100644 --- a/contracts/integration/Cargo.toml +++ b/contracts/integration/Cargo.toml @@ -8,3 +8,6 @@ soroban-sdk = { version = "21.0.0", features = ["testutils"] } brain-storm-analytics = { path = "../analytics" } brain-storm-token = { path = "../token" } brain-storm-shared = { path = "../shared" } + +[lints] +workspace = true diff --git a/contracts/liquidity_pool/Cargo.toml b/contracts/liquidity_pool/Cargo.toml index c729a873..1906c6cb 100644 --- a/contracts/liquidity_pool/Cargo.toml +++ b/contracts/liquidity_pool/Cargo.toml @@ -14,4 +14,6 @@ crate-type = ["cdylib", "rlib"] opt-level = "z" lto = true codegen-units = 1 -strip = true \ No newline at end of file +strip = true +[lints] +workspace = true diff --git a/contracts/market/Cargo.toml b/contracts/market/Cargo.toml index 9bad5efb..42c9c847 100644 --- a/contracts/market/Cargo.toml +++ b/contracts/market/Cargo.toml @@ -14,3 +14,6 @@ testutils = ["soroban-sdk/testutils"] [dev-dependencies] soroban-sdk = { version = "20.0.0", features = ["testutils"] } + +[lints] +workspace = true diff --git a/contracts/nft/Cargo.toml b/contracts/nft/Cargo.toml index 406da335..17d46df0 100644 --- a/contracts/nft/Cargo.toml +++ b/contracts/nft/Cargo.toml @@ -15,3 +15,6 @@ opt-level = "z" lto = true codegen-units = 1 strip = true + +[lints] +workspace = true diff --git a/contracts/registry/Cargo.toml b/contracts/registry/Cargo.toml index e5bc8dce..a21b7561 100644 --- a/contracts/registry/Cargo.toml +++ b/contracts/registry/Cargo.toml @@ -18,3 +18,6 @@ opt-level = "z" lto = true codegen-units = 1 strip = true + +[lints] +workspace = true diff --git a/contracts/reputation/Cargo.toml b/contracts/reputation/Cargo.toml index f4d0a731..dd73ba6b 100644 --- a/contracts/reputation/Cargo.toml +++ b/contracts/reputation/Cargo.toml @@ -14,4 +14,6 @@ crate-type = ["cdylib", "rlib"] opt-level = "z" lto = true codegen-units = 1 -strip = true \ No newline at end of file +strip = true +[lints] +workspace = true diff --git a/contracts/royalty_distribution/Cargo.toml b/contracts/royalty_distribution/Cargo.toml index 2a675cd7..1f4b1dd8 100644 --- a/contracts/royalty_distribution/Cargo.toml +++ b/contracts/royalty_distribution/Cargo.toml @@ -17,3 +17,6 @@ crate-type = ["cdylib", "rlib"] [profile.release] opt-level = "z" lto = true + +[lints] +workspace = true diff --git a/contracts/scholarship_fund/Cargo.toml b/contracts/scholarship_fund/Cargo.toml index 09038888..621486d8 100644 --- a/contracts/scholarship_fund/Cargo.toml +++ b/contracts/scholarship_fund/Cargo.toml @@ -16,3 +16,6 @@ crate-type = ["cdylib", "rlib"] [profile.release] opt-level = "z" lto = true + +[lints] +workspace = true diff --git a/contracts/shared/Cargo.toml b/contracts/shared/Cargo.toml index 8d15f579..7e256c21 100644 --- a/contracts/shared/Cargo.toml +++ b/contracts/shared/Cargo.toml @@ -11,3 +11,6 @@ crate-type = ["cdylib", "rlib"] [features] testutils = ["soroban-sdk/testutils"] + +[lints] +workspace = true diff --git a/contracts/token/Cargo.toml b/contracts/token/Cargo.toml index 7d67f3ed..e9ceeabc 100644 --- a/contracts/token/Cargo.toml +++ b/contracts/token/Cargo.toml @@ -14,3 +14,6 @@ testutils = ["soroban-sdk/testutils"] [dev-dependencies] soroban-sdk = { version = "20.0.0", features = ["testutils"] } + +[lints] +workspace = true diff --git a/contracts/token_restrictions/Cargo.toml b/contracts/token_restrictions/Cargo.toml index 79237216..d911752f 100644 --- a/contracts/token_restrictions/Cargo.toml +++ b/contracts/token_restrictions/Cargo.toml @@ -16,3 +16,6 @@ crate-type = ["cdylib", "rlib"] [profile.release] opt-level = "z" lto = true + +[lints] +workspace = true diff --git a/docs/README.md b/docs/README.md index 13876926..ff516182 100644 --- a/docs/README.md +++ b/docs/README.md @@ -52,6 +52,12 @@ Entry point for `docs/`. Start here, then follow the links below by topic. [analytics-guide.md](./analytics-guide.md) · [ANALYTICS.md](./ANALYTICS.md) · [community-moderation.md](./community-moderation.md) · [notifications-guide.md](./notifications-guide.md) · [i18n-guide.md](./i18n-guide.md) · [shared-types.md](./shared-types.md) · [dependency-injection-guide.md](./dependency-injection-guide.md) · [dependency-injection-best-practices.md](./dependency-injection-best-practices.md) · [utilities-guide.md](./utilities-guide.md) · [user-rate-limiting.md](./user-rate-limiting.md) · [ASSET_SUPPORT.md](./ASSET_SUPPORT.md) · [scripts.md](./scripts.md) +## Historical Artifacts + +Implementation summaries and PR description drafts from earlier development phases have been moved out of the repository root and consolidated here for posterity: + +**[history/](./history/README.md)** — `IMPLEMENTATION_SUMMARY*.md` and `PR_DESC*.md` files (issues #626–#841). These are no longer actively referenced; see merged PRs in GitHub for full context. + --- New to the repo? Read [development-setup.md](./development-setup.md) first, then [architecture.md](./architecture.md), then [adr/README.md](./adr/README.md) for the reasoning behind the current structure. diff --git a/IMPLEMENTATION_SUMMARY.md b/docs/history/IMPLEMENTATION_SUMMARY.md similarity index 100% rename from IMPLEMENTATION_SUMMARY.md rename to docs/history/IMPLEMENTATION_SUMMARY.md diff --git a/IMPLEMENTATION_SUMMARY_626-629.md b/docs/history/IMPLEMENTATION_SUMMARY_626-629.md similarity index 100% rename from IMPLEMENTATION_SUMMARY_626-629.md rename to docs/history/IMPLEMENTATION_SUMMARY_626-629.md diff --git a/IMPLEMENTATION_SUMMARY_834_837.md b/docs/history/IMPLEMENTATION_SUMMARY_834_837.md similarity index 100% rename from IMPLEMENTATION_SUMMARY_834_837.md rename to docs/history/IMPLEMENTATION_SUMMARY_834_837.md diff --git a/IMPLEMENTATION_SUMMARY_838-841.md b/docs/history/IMPLEMENTATION_SUMMARY_838-841.md similarity index 100% rename from IMPLEMENTATION_SUMMARY_838-841.md rename to docs/history/IMPLEMENTATION_SUMMARY_838-841.md diff --git a/PR_DESCRIPTION.md b/docs/history/PR_DESCRIPTION.md similarity index 100% rename from PR_DESCRIPTION.md rename to docs/history/PR_DESCRIPTION.md diff --git a/PR_DESCRIPTION_REPOSITORY_PATTERN.md b/docs/history/PR_DESCRIPTION_REPOSITORY_PATTERN.md similarity index 100% rename from PR_DESCRIPTION_REPOSITORY_PATTERN.md rename to docs/history/PR_DESCRIPTION_REPOSITORY_PATTERN.md diff --git a/PR_DESC_COMPLETE.md b/docs/history/PR_DESC_COMPLETE.md similarity index 100% rename from PR_DESC_COMPLETE.md rename to docs/history/PR_DESC_COMPLETE.md diff --git a/PR_DESC_INFRASTRUCTURE.md b/docs/history/PR_DESC_INFRASTRUCTURE.md similarity index 100% rename from PR_DESC_INFRASTRUCTURE.md rename to docs/history/PR_DESC_INFRASTRUCTURE.md diff --git a/PR_DESC_USERS_REPO.md b/docs/history/PR_DESC_USERS_REPO.md similarity index 100% rename from PR_DESC_USERS_REPO.md rename to docs/history/PR_DESC_USERS_REPO.md diff --git a/docs/history/README.md b/docs/history/README.md new file mode 100644 index 00000000..e05c7818 --- /dev/null +++ b/docs/history/README.md @@ -0,0 +1,17 @@ +# Historical Implementation Summaries & PR Descriptions + +This directory holds implementation summaries and PR description drafts that are historical artifacts from earlier development phases. They are preserved here for reference but are no longer actively maintained. + +| File | Description | +|------|-------------| +| [IMPLEMENTATION_SUMMARY.md](./IMPLEMENTATION_SUMMARY.md) | General implementation summary | +| [IMPLEMENTATION_SUMMARY_626-629.md](./IMPLEMENTATION_SUMMARY_626-629.md) | Implementation summary for issues #626–#629 | +| [IMPLEMENTATION_SUMMARY_834_837.md](./IMPLEMENTATION_SUMMARY_834_837.md) | Implementation summary for issues #834–#837 | +| [IMPLEMENTATION_SUMMARY_838-841.md](./IMPLEMENTATION_SUMMARY_838-841.md) | Implementation summary for issues #838–#841 | +| [PR_DESCRIPTION.md](./PR_DESCRIPTION.md) | Generic PR description template/draft | +| [PR_DESC_COMPLETE.md](./PR_DESC_COMPLETE.md) | PR description — complete feature set | +| [PR_DESC_INFRASTRUCTURE.md](./PR_DESC_INFRASTRUCTURE.md) | PR description — infrastructure changes | +| [PR_DESC_USERS_REPO.md](./PR_DESC_USERS_REPO.md) | PR description — users repository pattern | +| [PR_DESCRIPTION_REPOSITORY_PATTERN.md](./PR_DESCRIPTION_REPOSITORY_PATTERN.md) | PR description — repository pattern migration | + +These files were moved from the repository root to `docs/history/` as part of issue #1198. diff --git a/packages/types/package.json b/packages/types/package.json index b1ca18b7..fe6fa17d 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -32,7 +32,6 @@ "zod": "^3.23.8" }, "devDependencies": { - "@types/jest": "^29.5.12", "jest": "^29.7.0", "ts-jest": "^29.1.4", "typescript": "^5.4.0"