Repository navigation
chore(lints): [#2134] enforce cognitive complexity - #2147
josecelano merged 42 commits into
Conversation
Include directly coupled HTTP core const accessors required by the protocol API.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #2147 +/- ##
===========================================
+ Coverage 84.48% 85.11% +0.62%
===========================================
Files 351 351
Lines 28357 29268 +911
Branches 28357 29268 +911
===========================================
+ Hits 23958 24911 +953
+ Misses 4004 3959 -45
- Partials 395 398 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
There is at least one confirmed compile-time issue in the updated test helper logging writer and a security concern where full env-sourced config contents are logged.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR enforces clippy::cognitive_complexity as a denied workspace lint and makes all workspace crates inherit the shared lint policy, then refactors affected code paths (and adds/updates regression tests + docs) to satisfy the stricter lint baseline.
Changes:
- Deny
clippy::cognitive_complexityat the workspace root and enable[lints] workspace = trueacross workspace crates. - Refactor multiple event listeners/handlers and related logic to reduce cognitive complexity while preserving behavior, adding deterministic regression tests where needed.
- Fix assorted Clippy/style findings (e.g.,
const fn,Self::usage, unnecessary clones/drops), plus documentation/link maintenance and an implementation retrospective.
File summaries
| File | Description |
|---|---|
| src/console/profiling.rs | Extracts shutdown waiting helper and adjusts shutdown/log messaging in profiling console. |
| packages/udp-server/tests/server/contract.rs | Test helper made const fn to satisfy lint policy. |
| packages/udp-server/tests/server/asserts.rs | Makes simple predicate helpers const fn. |
| packages/udp-server/tests/common/udp.rs | Uses Self in constructors for consistency. |
| packages/udp-server/src/testing/environment.rs | Applies const fn/helper extraction for lint compliance in test environment. |
| packages/udp-server/src/statistics/services.rs | Updates rustdoc links/examples to match current module paths and events. |
| packages/udp-server/src/statistics/repository.rs | Drops guards explicitly in tests to avoid holding across awaits / lint issues. |
| packages/udp-server/src/server/states.rs | Makes constructor const fn; adjusts task-await ignoring style. |
| packages/udp-server/src/server/spawner.rs | Uses Self in return types for consistency. |
| packages/udp-server/src/server/receiver.rs | Minor constructor refactor (Self) + const fn. |
| packages/udp-server/src/server/processor.rs | Avoids holding stats across loop checks (drop before branching). |
| packages/udp-server/src/server/launcher.rs | Removes unnecessary clone/await ignores to satisfy clippy. |
| packages/udp-server/src/lib.rs | Fixes/updates rustdoc links and references. |
| packages/udp-server/src/handlers/mod.rs | Broadens visibility for test helper structs/functions and removes redundant clones. |
| packages/udp-server/src/handlers/error.rs | Refactors logging to reduce complexity; adds focused tests. |
| packages/udp-server/src/handlers/announce.rs | Uses Self in test builder for lint consistency. |
| packages/udp-server/src/event.rs | Adds Eq derives; minor Self:: refactors; adjusts cloning. |
| packages/udp-server/src/container.rs | Removes redundant broadcaster/repository clones. |
| packages/udp-server/src/banning/event/listener.rs | Refactors event dispatch loop into helpers + adds deterministic receiver tests. |
| packages/udp-server/src/banning/event/handler.rs | Drops lock guard before awaiting metric update to avoid holding locks across await. |
| packages/udp-server/examples/udp_only_public_tracker.rs | Adds print_stdout allowance for example under denied lint. |
| packages/udp-server/Cargo.toml | Enables workspace lint inheritance. |
| packages/udp-protocol/src/response.rs | Uses Self:: patterns; reduces unnecessary clones in tests. |
| packages/udp-protocol/src/request.rs | Uses Self:: patterns; makes small constructors const fn; removes clones in tests. |
| packages/udp-protocol/src/common.rs | Makes numeric wrappers const fn constructors; minor Self refactors. |
| packages/udp-protocol/src/announce.rs | Makes interval constructor const fn. |
| packages/udp-protocol/Cargo.toml | Enables workspace lint inheritance. |
| packages/udp-core/src/statistics/event/listener.rs | Refactors dispatch loop; adds deterministic receiver tests for cancel/closed/lagged/metrics-policy behavior. |
| packages/udp-core/src/statistics/event/handler.rs | Reduces duplication by extracting label computation; adds label propagation regression test. |
| packages/udp-core/src/services/mod.rs | Exposes test helper functions publicly (was pub(crate)). |
| packages/udp-core/src/services/banning.rs | Removes stray println! from tests (print lints). |
| packages/udp-core/src/event.rs | Makes constructors/accessors const fn; minor Self refactors. |
| packages/udp-core/src/container.rs | Adjusts container return types; removes redundant broadcaster clones. |
| packages/udp-core/Cargo.toml | Enables workspace lint inheritance. |
| packages/udp-core/benches/helpers/utils.rs | Makes sample helpers const fn. |
| packages/udp-core/benches/helpers/sync.rs | Removes unnecessary broadcaster clone. |
| packages/udp-core/benches/ban_service_benchmark.rs | Makes name() const fn. |
| packages/tracker-core/tests/integration.rs | Removes unnecessary mutable env bindings. |
| packages/tracker-core/tests/common/test_env.rs | Refactors job startup to reduce complexity; switches methods to &self where possible. |
| packages/tracker-core/src/whitelist/test_helpers.rs | Removes redundant Arc clones in test helper wiring. |
| packages/tracker-core/src/whitelist/repository/persisted.rs | Fixes vec!(...) to vec![...] in tests. |
| packages/tracker-core/src/whitelist/manager.rs | Makes constructor const fn. |
| packages/tracker-core/src/whitelist/authorization.rs | Makes small helper const fn; removes redundant Arc clones in tests. |
| packages/tracker-core/src/torrent/services.rs | Adds Eq derives; fixes vec macro style in tests. |
| packages/tracker-core/src/torrent/repository/in_memory.rs | Makes constructor const fn. |
| packages/tracker-core/src/torrent/manager.rs | Tightens doc comment to clearer, shorter description. |
| packages/tracker-core/src/test_helpers.rs | Removes redundant Arc clone when passing references. |
| packages/tracker-core/src/statistics/repository.rs | Simplifies counter access; drops metrics guard explicitly in tests. |
| packages/tracker-core/src/statistics/persisted/downloads.rs | Uses Self return type for constructor. |
| packages/tracker-core/src/statistics/mod.rs | Clarifies ADR doc link formatting and wording. |
| packages/tracker-core/src/scrape_handler.rs | Removes redundant Arc clone when passing references. |
| packages/tracker-core/src/databases/driver/postgres/mod.rs | Uses tracing instead of stdout for skip message; makes helper const fn. |
| packages/tracker-core/src/databases/driver/mysql/mod.rs | Uses tracing instead of stdout for skip message; makes helper const fn. |
| packages/tracker-core/src/authentication/service.rs | Makes small helper const fn; removes redundant Arc clones in tests. |
| packages/tracker-core/src/authentication/mod.rs | Removes redundant Arc clones when wiring handlers in tests. |
| packages/tracker-core/src/authentication/key/repository/persisted.rs | Fixes vec macro style in tests. |
| packages/tracker-core/src/authentication/key/peer_key.rs | Uses Self in parsing/generation for consistency. |
| packages/tracker-core/src/authentication/key/mod.rs | Simplifies option handling and Self:: usage. |
| packages/tracker-core/src/announce_handler.rs | Adds Eq derive; makes small constructors const fn; Self:: refactors. |
| packages/tracker-core/Cargo.toml | Enables workspace lint inheritance. |
| packages/tracker-client/src/udp/client.rs | Uses Self return/struct init. |
| packages/tracker-client/src/http/client/mod.rs | Simplifies path building using map_or_else. |
| packages/tracker-client/Cargo.toml | Enables workspace lint inheritance. |
| packages/test-helpers/src/logging.rs | Refactors log writer to avoid print! + makes small helpers const fn. |
| packages/test-helpers/Cargo.toml | Enables workspace lint inheritance. |
| packages/swarm-coordination-registry/src/swarm/registry.rs | Reduces lock guard scope / refactors pagination handling; updates docs/tests vec style. |
| packages/swarm-coordination-registry/src/swarm/coordinator.rs | Refactors optional-limit logic; makes metadata/accessors const fn. |
| packages/swarm-coordination-registry/src/statistics/event/listener.rs | Refactors receive loop; adds deterministic receiver tests for cancel/closed/lagged behavior. |
| packages/swarm-coordination-registry/src/container.rs | Removes redundant broadcaster clone. |
| packages/swarm-coordination-registry/examples/bench_peers.rs | Makes peer factory const fn; switches to locked stdout + writeln! error handling. |
| packages/swarm-coordination-registry/Cargo.toml | Enables workspace lint inheritance. |
| packages/rest-api-runtime-adapter/src/v1/container.rs | Uses Arc<Self> return types and Self init style. |
| packages/rest-api-runtime-adapter/src/v1/adapters/stats.rs | Avoids storing intermediate metrics; merges from awaited results inline. |
| packages/rest-api-runtime-adapter/Cargo.toml | Enables workspace lint inheritance. |
| packages/rest-api-protocol/src/v1/context/whitelist/resources/whitelist.rs | Uses Self:: patterns in Display impl. |
| packages/rest-api-protocol/src/v1/context/auth_key/resources/auth_key.rs | Uses Self:: patterns in Display impl. |
| packages/rest-api-protocol/Cargo.toml | Enables workspace lint inheritance. |
| packages/rest-api-client/src/v1/client.rs | Removes redundant clone() on URLs; adjusts generic bounds; refactors header injection. |
| packages/rest-api-client/src/connection_info.rs | Makes simple constructors/accessors const fn; uses Self init. |
| packages/rest-api-client/src/common/http.rs | Makes small constructors const fn. |
| packages/rest-api-client/Cargo.toml | Enables workspace lint inheritance. |
| packages/rest-api-application/Cargo.toml | Enables workspace lint inheritance. |
| packages/primitives/src/swarm_metadata.rs | Makes accessors const fn; adds Eq derive for aggregate metadata. |
| packages/primitives/src/scrape.rs | Adds Eq derive for scrape data. |
| packages/primitives/src/runtime_service_metadata.rs | Makes accessor const fn. |
| packages/primitives/src/policy.rs | Makes defaults const fn. |
| packages/primitives/src/peer.rs | Broad const fn + Self:: cleanup; simplifies string conversion; adds Eq derive where applicable. |
| packages/primitives/src/pagination.rs | Adds Eq derive; makes small helpers const fn; uses Self. |
| packages/primitives/src/mode.rs | Makes default helper const fn. |
| packages/primitives/src/driver.rs | Makes as_str const fn. |
| packages/primitives/src/announce.rs | Adds Eq derive; makes defaults const fn; doc wording tweak. |
| packages/primitives/Cargo.toml | Enables workspace lint inheritance. |
| packages/http-protocol/src/v1/services/peer_ip_resolver.rs | Simplifies mode conversions; makes small helpers/accessors const fn. |
| packages/http-protocol/src/v1/responses/scrape/encoding.rs | Adds Eq derive. |
| packages/http-protocol/src/v1/responses/scrape/deserialization.rs | Adds Eq derives for scrape response structs. |
| packages/http-protocol/src/v1/responses/scrape/data.rs | Adds Eq derive for scrape data model. |
| packages/http-protocol/src/v1/responses/error.rs | Adds Eq derive. |
| packages/http-protocol/src/v1/responses/announce/encoding.rs | Reduces intermediate collections; adds Eq derives; makes compact peer constructors const fn. |
| packages/http-protocol/src/v1/responses/announce/deserialization.rs | Adds Eq derives; uses Self in constructors. |
| packages/http-protocol/src/v1/responses/announce/data.rs | Adds Eq derive. |
| packages/http-protocol/src/v1/requests/scrape.rs | Adds Eq derive; uses Self in conversions. |
| packages/http-protocol/src/v1/requests/announce.rs | Adds Eq derives; refactors Option parsing; strengthens tests for invalid params. |
| packages/http-protocol/Cargo.toml | Enables workspace lint inheritance. |
| packages/http-core/src/statistics/event/listener.rs | Refactors dispatch loop; adds deterministic receiver tests mirroring UDP core behavior. |
| packages/http-core/src/statistics/event/handler.rs | Extracts labels/request-kind; adds label propagation regression test. |
| packages/http-core/src/services/scrape.rs | Removes redundant Arc clone in test wiring. |
| packages/http-core/src/services/error_mapping.rs | Makes protocol error mapping function public. |
| packages/http-core/src/services/announce.rs | Simplifies Option mapping; removes redundant Arc clones; removes unnecessary broadcaster clone. |
| packages/http-core/src/event.rs | Makes constructors/accessors const fn; minor Self refactors. |
| packages/http-core/src/container.rs | Removes unnecessary broadcaster clone. |
| packages/http-core/Cargo.toml | Enables workspace lint inheritance. |
| packages/http-core/benches/helpers/util.rs | Makes sample peer const fn; removes redundant clones in bench wiring. |
| packages/events/src/receiver.rs | Uses Self:: patterns in Display. |
| packages/events/src/bus.rs | Makes constructor const fn. |
| packages/events/src/broadcaster.rs | Uses Self init; simplifies conversions. |
| packages/events/Cargo.toml | Enables workspace lint inheritance. |
| packages/configuration/src/v3_0_0/udp_tracker.rs | Makes defaults const fn. |
| packages/configuration/src/v3_0_0/udp_tracker_server.rs | Makes default helper const fn. |
| packages/configuration/src/v3_0_0/types.rs | Makes validator const fn. |
| packages/configuration/src/v3_0_0/tracker_api.rs | Makes defaults const fn. |
| packages/configuration/src/v3_0_0/public_url.rs | Makes accessors const fn. |
| packages/configuration/src/v3_0_0/network.rs | Makes defaults const fn; uses Self in parsing/deser. |
| packages/configuration/src/v3_0_0/mod.rs | Uses Self return types; refactors optional TOML source selection. |
| packages/configuration/src/v3_0_0/logging.rs | Makes default helpers const fn; simplifies Display match. |
| packages/configuration/src/v3_0_0/http_tracker.rs | Makes defaults const fn. |
| packages/configuration/src/v3_0_0/health_check_api.rs | Makes default bind helper const fn. |
| packages/configuration/src/v3_0_0/database.rs | Makes field rejection helper const fn. |
| packages/configuration/src/v3_0_0/core.rs | Makes defaults const fn. |
| packages/configuration/src/v2_0_0/udp_tracker.rs | Makes defaults const fn. |
| packages/configuration/src/v2_0_0/tracker_api.rs | Makes defaults const fn; replaces empty token map construction. |
| packages/configuration/src/v2_0_0/network.rs | Makes defaults const fn; uses Self in parsing/deser. |
| packages/configuration/src/v2_0_0/mod.rs | Uses Self return types; refactors optional TOML source selection. |
| packages/configuration/src/v2_0_0/logging.rs | Makes defaults const fn; simplifies Display match. |
| packages/configuration/src/v2_0_0/http_tracker.rs | Makes defaults const fn. |
| packages/configuration/src/v2_0_0/health_check_api.rs | Makes default bind helper const fn. |
| packages/configuration/src/v2_0_0/database.rs | Makes default driver helper const fn. |
| packages/configuration/src/v2_0_0/core.rs | Makes defaults const fn. |
| packages/configuration/src/lib.rs | Moves config load notices to tracing; refactors env var reading. |
| packages/configuration/Cargo.toml | Enables workspace lint inheritance. |
| packages/axum-server/src/custom_axum_server.rs | Makes small constructors const fn; simplifies poll comparison. |
| packages/axum-server/Cargo.toml | Enables workspace lint inheritance. |
| packages/axum-rest-api-server/tests/server/connection_info.rs | Makes test helper const fn. |
| packages/axum-rest-api-server/src/v1/middlewares/auth.rs | Removes redundant string allocations; Self:: patterns in response mapping. |
| packages/axum-rest-api-server/src/v1/context/whitelist/routes.rs | Removes unnecessary .clone() when wiring router state. |
| packages/axum-rest-api-server/src/v1/context/torrent/responses.rs | Marks simple JSON response constructors as const fn. |
| packages/axum-rest-api-server/src/v1/context/torrent/handlers.rs | Simplifies Option handling via map_or_else. |
| packages/axum-rest-api-server/src/v1/context/stats/handlers.rs | Refactors format selection via map_or_else. |
| packages/axum-rest-api-server/src/v1/context/auth_key/routes.rs | Removes unnecessary .clone() when wiring router state. |
| packages/axum-rest-api-server/src/testing/environment.rs | Tightens generic bounds to satisfy Send/Sync lints; removes redundant clones. |
| packages/axum-rest-api-server/src/server.rs | Makes constructors const fn; adjusts task-await ignoring style; removes redundant clones. |
| packages/axum-rest-api-server/Cargo.toml | Enables workspace lint inheritance. |
| packages/axum-http-server/tests/common/http.rs | Makes query constructors const fn. |
| packages/axum-http-server/src/v1/handlers/scrape.rs | Removes redundant Arc clone in test wiring. |
| packages/axum-http-server/src/v1/handlers/announce.rs | Removes redundant Arc clones; removes unnecessary broadcaster clone in tests. |
| packages/axum-http-server/src/v1/extractors/scrape_request.rs | Uses Self(...) for extractor wrapper construction. |
| packages/axum-http-server/src/v1/extractors/client_ip_sources.rs | Uses .ok().map(...) to simplify optional extraction; uses Self. |
| packages/axum-http-server/src/v1/extractors/authentication_key.rs | Uses Self(...) for extractor wrapper construction. |
| packages/axum-http-server/src/v1/extractors/announce_request.rs | Uses Self(...) for extractor wrapper construction. |
| packages/axum-http-server/src/testing/environment.rs | Tightens generic bounds; makes bind accessor const fn. |
| packages/axum-http-server/src/server.rs | Makes constructor const fn; adjusts task-await ignoring style. |
| packages/axum-http-server/src/lib.rs | Updates rustdoc links and test helper visibility. |
| packages/axum-http-server/examples/http_only_public_tracker.rs | Switches to locked stdout + writeln! to comply with print lints. |
| packages/axum-http-server/Cargo.toml | Enables workspace lint inheritance. |
| packages/axum-health-check-api-server/tests/server/contract.rs | Removes unnecessary visibility qualifiers from tests. |
| packages/axum-health-check-api-server/src/server.rs | Removes redundant protocol clone. |
| packages/axum-health-check-api-server/src/responses.rs | Marks response constructors const fn. |
| packages/axum-health-check-api-server/src/resources.rs | Makes report helpers/accessors const fn where possible; uses Self. |
| packages/axum-health-check-api-server/src/handlers.rs | Avoids drain(..) patterns; simplifies iteration ownership. |
| packages/axum-health-check-api-server/Cargo.toml | Enables workspace lint inheritance. |
| docs/issues/open/2134-fix-cognitive-complexity-lint-enforcement/implementation-retrospective.md | Adds implementation retrospective for issue #2134. |
| Cargo.toml | Denies clippy::cognitive_complexity at workspace level and adjusts nursery lint priority. |
Review details
Suppressed comments (1)
src/console/profiling.rs:217
- Log message has a double period (
shutdown..). This looks like a typo and makes log output noisier when the timed shutdown triggers.
- Files reviewed: 177/177 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
ACK 8bc6473 |
da2ce7
left a comment
There was a problem hiding this comment.
This is a post-merge review of #2147 as it stands at a94c3ced8 on the default branch.
What still runs: the workspace denies clippy::cognitive_complexity (Cargo.toml:237), with nursery lowered to priority -2 so that the member lint's deny wins, and all 37 member manifests carry [lints] workspace = true. The split statistics handlers and listeners in swarm-coordination-registry, tracker-core, http-core, udp-core and udp-server, the split UDP error logger (packages/udp-server/src/handlers/error.rs:63-134), the banning listener and profiling::wait_for_shutdown (src/console/profiling.rs:218) are all live. Later changes have added cancellation draining and per-instance statistics-policy logging on top of them. Most of the rewrites forced by lint inheritance (Self, const fn, map_or_else) are also unchanged at the tip.
[Minor] packages/configuration/src/lib.rs:210-227: #2147 changed the configuration-source messages from println! to tracing::info!. Info::from_environment runs inside initialize_configuration (src/bootstrap/app.rs:56), which comes before initialize_global_services installs the subscriber (src/bootstrap/app.rs:64), so the tracker binary now discards these events. Before #2147, starting the tracker from the repository root with no configuration variables printed Loading extra configuration from default configuration file: `./share/default/config/tracker.development.sqlite3.toml` .... At a94c3ced8 no line says which source was read. The later configuration dump (src/bootstrap/app.rs:66) gives the values but not the source. So if TORRUST_TRACKER_CONFIG_TOML_PATH is misspelled, the tracker falls back to the default file without any sign. The run-tracker-locally skill (SKILL.md:41-49) still tells readers to expect the old line. The explicit-file message at packages/configuration/src/lib.rs:197, added later, is dropped the same way. Smallest fix: have initialize_configuration return the selected source together with the configuration, and log it in bootstrap::app::setup right after initialize_global_services. For inline TOML, log only its byte length, as 8dea740 does. Then remove the info! calls that run before a subscriber exists.
[Nit] The listener helpers split out by #2147 disagree on what their bool means. should_stop_after_receiving_event (packages/http-core/src/statistics/event/listener.rs:108, packages/udp-core/src/statistics/event/listener.rs:105) returns true to stop. handle_received_event (packages/udp-server/src/statistics/event/listener.rs:106, packages/udp-server/src/banning/event/listener.rs:119), handle_receive_result (packages/swarm-coordination-registry/src/statistics/event/listener.rs:89) and the two tracker-core helpers (packages/tracker-core/src/statistics/event/listener.rs:191, :204) return true to continue. The name handle_received_event itself means two things: in udp-server it takes the Result and returns bool, while in http-core and udp-core it takes the Event and returns (). If a call site is copied from one listener to another, it compiles with its exit test inverted. The listener then either returns Completion::Completed after its first event, or spins on RecvError::Closed without ever returning. Smallest fix: return std::ops::ControlFlow<()> from these helpers, with Break on Closed, so that the type carries the meaning.
Description against diff: the description lists profiling shutdown among the behaviours that deterministic regression tests preserve, but the diff adds no test for profiling::run or wait_for_shutdown. The refactor also kept the timed branch that neither cancelled nor joined the jobs. a08c24d later fixed that and added the test. The description also does not mention several public-surface changes: the configuration messages above, registry::Error becoming an alias of Infallible, post_form gaining a Sync bound, and many public functions becoming const fn.
Checked and found sound:
- The handler splits keep every metric name, label set and increment/decrement pairing, including the role-change gauges and the completed-state reversion counter.
- The persistent listener still increments the global download count when the per-torrent write fails.
- Every listener keeps
biasedcancellation, stops onClosedand continues onLagged. - Enabled, disabled and unknown instances are still routed through the metrics policy.
- The UDP error logger keeps its cookie/non-cookie level split and its transaction-id handling.
extract_numwantstill rejects-1withInvalidParam.- The guard-scope changes in
packages/swarm-coordination-registry/src/swarm/registry.rs:269and:288do not widen the window in which an announce racing peerless-torrent removal loses its peer, and the guard is no longer held across the removal event send. - Neither
clippy.tomlnor the source sets a complexity threshold or allowance. - Since 8dea740, the inline configuration TOML is logged only by length.
Summary
Enables the denied
clippy::cognitive_complexityworkspace lint and makes every workspace package inherit the shared Cargo lint policy.Refactors all fourteen discovered complexity violations across the swarm registry, tracker core, HTTP/UDP cores, UDP server, and profiling runner without threshold changes or cognitive-complexity allowances. The refactors use focused helpers and deterministic regression tests to preserve metric, persistence, policy-routing, listener-lifecycle, UDP error, and profiling shutdown behavior.
Also corrects stale intra-doc links found by the mandatory nightly documentation build, and migrates the materially expanded issue specification to folder-style layout with an implementation retrospective.
Closes #2134
Validation
cargo clippy --workspace --all-targets --all-featureslinter allcargo test --tests --benches --examples --workspace --all-targets --all-featurespre-push.sh --format=json— nightly formatting, checks, documentation build, and complete stable suiteprofiling::runshape madelinter allfail with the expected 27/25 cognitive-complexity diagnostic; the compliant implementation was restored and linting passed.