docs(rules): fix contradictions, update technical rules, enforce rule structure
CI / CI configuration security checks (pull_request) Successful in 2s
CI / Capabilities and shell quality (pull_request) Successful in 15s
CI / Python tests and compilation (pull_request) Successful in 36s
CI / QMD unit tests (pull_request) Successful in 7s
CI / Build and inspect generated packages (pull_request) Successful in 16s
CI / Bash integration and installation guards (pull_request) Failing after 51s
CI / PowerShell tests on Ubuntu (pull_request) Failing after 1m45s
CI / Installed client configuration smoke tests (pull_request) Canceled after 1m24s
CI / CI configuration security checks (pull_request) Successful in 2s
CI / Capabilities and shell quality (pull_request) Successful in 15s
CI / Python tests and compilation (pull_request) Successful in 36s
CI / QMD unit tests (pull_request) Successful in 7s
CI / Build and inspect generated packages (pull_request) Successful in 16s
CI / Bash integration and installation guards (pull_request) Failing after 51s
CI / PowerShell tests on Ubuntu (pull_request) Failing after 1m45s
CI / Installed client configuration smoke tests (pull_request) Canceled after 1m24s
- Resolve contradictions: authorization is never a skipped "boundary check"; one browser token policy (BFF/HttpOnly cookies first, RFC 10017); one sanitizer-bypass rule; Angular responses are unknown until validated. - Add security rules for AI/LLM integration and Java XXE, concrete crypto and password-hashing parameters, and RFC 8725 JWT validation. - Update version-dependent guidance after checking official sources: Angular 22, TypeScript 6/7, Node 24+, .NET 10/C# 14, JDK 21-25, Spring Boot 4; add a Spring Boot and Spring Security topic. - Give every rule a unique level-1 title and scope line, keep language security files to language specifics, and fix routing for inbound vs outbound HTTP, XML parsing, and WPF/Angular parent rules. - Validate rule structure and routing in validate-config.py, with tests. - Fix CI issues found by a local run: shellcheck directive order, pinned ruff rule set, Invoke-Python test mock, CRLF-tolerant package checks, Windows-only credential test, and refreshed prompt-budget baselines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
79694fbaa2
commit
6159c6373c
62 files changed
+453
-300
No files matched your search
@@ -1,9 +1,12 @@
|
||||
# WPF Architecture, Dependency Injection, Testing, and Performance
|
||||
|
||||
Apply these rules when structuring a WPF application, wiring dependency injection, testing view models, or optimizing performance. Load the C# rules for language-level guidance.
|
||||
|
||||
## Architecture
|
||||
|
||||
* Use modern C# and current WPF conventions. Prefer MVVM for non-trivial views and keep code-behind limited to view-specific behavior.
|
||||
* Use the C# version the project targets (see the C# coding-style rule; .NET Framework 4.x WPF apps default to C# 7.3). Prefer MVVM for non-trivial views and keep code-behind limited to view-specific behavior.
|
||||
* Keep UI, application, and domain logic separate. Avoid business logic in views and direct service access from controls.
|
||||
* Keep dependencies explicit and testable; prefer composition over inheritance and avoid unnecessary abstractions or framework wrappers.
|
||||
* Keep presentation, application, domain and infrastructure concerns separated.
|
||||
* Avoid direct database access from views or ViewModels.
|
||||
* Avoid direct HTTP access from controls.
|
||||
* Keep external integrations behind focused services.
|
||||
@@ -16,13 +19,11 @@
|
||||
|
||||
## Dependency Injection
|
||||
|
||||
* Use dependency injection where lifecycle management, substitution or testability benefits from it.
|
||||
* Avoid service locator patterns.
|
||||
* Keep constructor dependencies minimal.
|
||||
* Do not inject dependencies that are not used.
|
||||
* Choose service lifetimes intentionally.
|
||||
* Do not make stateful services global without a concrete reason.
|
||||
* Avoid introducing interfaces solely for dependency injection when no abstraction is needed.
|
||||
Follow the C# architecture rule for general dependency injection, plus:
|
||||
|
||||
* Register views and view models as transient unless they hold intentionally shared state; register shared services as singletons only when they are thread-safe and stateless or own deliberately shared state.
|
||||
* Do not resolve services from `App.Current` or a static container inside view models; inject them.
|
||||
* Create EF Core contexts per operation through `IDbContextFactory<T>` (see the C# architecture rule).
|
||||
|
||||
## Testing
|
||||
|
||||
@@ -37,30 +38,22 @@
|
||||
|
||||
## Code Quality
|
||||
|
||||
* Use nullable reference types.
|
||||
* Prefer modern, readable C# syntax.
|
||||
* Avoid unnecessary interfaces and abstractions.
|
||||
* Prefer concrete types where no abstraction is required.
|
||||
* Use descriptive names.
|
||||
* Remove dead code.
|
||||
* Add comments only for non-obvious decisions or public contracts.
|
||||
* Treat compiler, analyzer and binding warnings seriously.
|
||||
* Do not suppress warnings without a concrete reason.
|
||||
* Prefer correctness, responsiveness, security and maintainability over cleverness.
|
||||
Follow the C# coding-style and testing rules, plus:
|
||||
|
||||
* Treat binding errors as defects: check the debugger output or XAML binding failures diagnostics for failed bindings after UI changes.
|
||||
|
||||
## Performance
|
||||
|
||||
* Keep the UI thread responsive.
|
||||
* Minimize visual tree depth.
|
||||
* Keep virtualization enabled.
|
||||
* Keep virtualization enabled (see the virtualization section of the collections rule).
|
||||
* Avoid unnecessary bindings.
|
||||
* Avoid unnecessary converters.
|
||||
* Avoid unnecessary resource lookups.
|
||||
* Avoid unnecessary property change notifications.
|
||||
* Avoid frequent full collection refreshes.
|
||||
* Avoid loading large datasets eagerly.
|
||||
* Avoid loading large images at full resolution when unnecessary.
|
||||
* Freeze `Freezable` objects where practical.
|
||||
* Load images as the images section of the resources rule defines, and freeze `Freezable` objects where practical.
|
||||
* Reuse immutable resources where appropriate.
|
||||
* Avoid unnecessary animations.
|
||||
* Avoid high-frequency timers on the UI thread.
|
||||
|
||||
Reference in new issue
Block a user