The attribute plugin is not available, 2fa disabled
Inhaltsverzeichnis
Code Quality Checklist
Checks for naming conventions, function design, DRY principle, and SSOT.
This checklist complements the Code Conventions with concrete verification points.
Naming Conventions
Namespace Pattern (MS Style)
[ ] Unit names follow WvdS.<Category>.<Component>.pas [ ] Mirrors Microsoft .NET structure with WvdS. prefix [ ] Example: WvdS.UI.Controls.Button, WvdS.System.Logging
Class Hierarchy (Borland Style)
[ ] Abstract base uses TWvdSCustom* prefix [ ] Public base uses TWvdSBase* prefix [ ] Concrete classes use TWvdS* prefix [ ] Pattern: TWvdSCustomXxx → TWvdSBaseXxx → TUserXxx
Type Prefixes
| Category | Prefix | Example |
|---|---|---|
| Classes | TWvdS* | TWvdSRouter, TWvdSButton |
| Interfaces | IWvdS* | IWvdSActionResult, IWvdSBindable |
| Exceptions | EWvdS* | EWvdSRoutingException |
| Records | TWvdS* | TWvdSBuildResult |
| Enums | TWvdS* | TWvdSProjectType |
| Callbacks | TWvdS* | TWvdSBuildCallback |
General Naming
[ ] Descriptive names (no single letters except loops) [ ] No abbreviations except well-known (URL, HTTP, JSON) [ ] Interfaces have GUID for DI container [ ] Private fields: F* prefix (FValue, FCount) [ ] Parameters: A* prefix (AIndex, APath)
Function Design
Size Guidelines
[ ] 12-24 lines ideal [ ] Maximum 40 lines (split above that) [ ] Maximum nesting depth: 3
Parameter Guidelines
[ ] Maximum 5-7 parameters [ ] For more parameters: use record/class [ ] Optional parameters at the end
Single Responsibility
[ ] Each function has ONE task [ ] Function name fully describes the task [ ] If "and" needed in name → split
Verb-First Naming
[ ] Get* - Retrieve value [ ] Set* - Set value [ ] Calculate* - Perform calculation [ ] Process* - Perform processing [ ] Validate* - Perform validation [ ] Create* - Create object [ ] Parse* - Parse input [ ] Format* - Format output
DRY Principle
[ ] No duplicated code (more than 3 identical lines → extract) [ ] No copy-paste patterns [ ] Common logic in helper functions [ ] Constants instead of repeated literals
Example: Fixing DRY Violation
(* FORBIDDEN - Duplicated code *) procedure ProcessUserA(const AUser: TUser); begin if not ValidateEmail(AUser.Email) then raise EValidationError.Create('Invalid email'); if Length(AUser.Name) > 64 then raise EValidationError.Create('Name too long'); (* ... further processing *) end; procedure ProcessUserB(const AUser: TUser); begin if not ValidateEmail(AUser.Email) then raise EValidationError.Create('Invalid email'); if Length(AUser.Name) > 64 then raise EValidationError.Create('Name too long'); (* ... other processing *) end; (* CORRECT - Common logic extracted *) procedure ValidateUser(const AUser: TUser); begin if not ValidateEmail(AUser.Email) then raise EValidationError.Create(rsInvalidEmail); if Length(AUser.Name) > MAX_NAME_LENGTH then raise EValidationError.Create(rsNameTooLong); end; procedure ProcessUserA(const AUser: TUser); begin ValidateUser(AUser); (* ... further processing *) end;
SSOT Check
Single Source of Truth - No local copies of common code!
Use Common Libraries
[ ] NodeJS APIs via ~/sources/common/web/nodejs/
- NodeJS.FS, NodeJS.Path, NodeJS.ChildProcess
[ ] VSCode APIs via ~/sources/common/web/vscode/
- VSCode.Window, VSCode.Commands, VSCode.Workspace
[ ] WvdS Core via ~/sources/common/core/
- WvdS.System.Logging, WvdS.VSCode.Security
Forbidden
[ ] No direct require() calls in extensions [ ] No duplicates of common units in extensions [ ] No local wrapper implementations
Example: SSOT Violation
(* FORBIDDEN - Local require() *) function FileExists(const APath: string): Boolean; begin asm var fs = require('fs'); (* SSOT violation! *) Result = fs.existsSync(APath); end; end; (* CORRECT - Common library *) uses NodeJS.FS; function FileExists(const APath: string): Boolean; begin Result := ExistsSync(APath); (* From NodeJS.FS *) end;
Separation of Concerns
[ ] UI logic only in UI layer (extension_main, *Dialog) [ ] Business logic only in service layer (*Service) [ ] Data structures only in model layer (*Models) [ ] Services don't call VSCode APIs directly [ ] Models contain no logic
Layer Architecture
┌─────────────────────────────────────────────────┐ │ UI Layer (extension_main.pas, *Dialog.pas) │ │ → VSCode APIs, User Interaction │ ├─────────────────────────────────────────────────┤ │ Service Layer (*Service.pas) │ │ → Business logic, Validation │ ├─────────────────────────────────────────────────┤ │ Model Layer (*Models.pas) │ │ → Records, Types, Enums │ ├─────────────────────────────────────────────────┤ │ Infrastructure (NodeJS.*, VSCode.*, WvdS.*) │ │ → External APIs, Platform Abstraction │ └─────────────────────────────────────────────────┘
Quick Checklist for Copy/Paste
Review Checklist (Code Quality): Naming: - [ ] Unit names: WvdS.<Category>.<Component>.pas - [ ] Classes: TWvdS* prefix - [ ] Interfaces: IWvdS* prefix - [ ] Descriptive names (no abbreviations) Functions: - [ ] 12-24 lines ideal, max 40 - [ ] Max 5-7 parameters - [ ] Single responsibility - [ ] Verb-first naming DRY: - [ ] No duplicated code - [ ] Common logic extracted - [ ] Constants instead of literals SSOT: - [ ] Common libraries used - [ ] No local require() calls - [ ] No duplicates of common units SoC: - [ ] UI only in UI layer - [ ] Logic only in service layer - [ ] Services without direct VSCode calls
See also
Zuletzt geändert: on 2026/01/29 at 10:31 PM