/** * Offline X++ / XML Best Practice validator. * * Checks generated code against the rule set in systemInstructions.ts without * requiring xppbp.exe or a Windows VM. Returns structured violations that the * model can action in one step. * * Rules implemented: * SEL001 today() deprecated * SEL002 forceLiterals forbidden (SQL injection risk) * SEL003 crossCompany on joined buffer (must be on driving buffer) * SEL004 Nested while select (N+1 query anti-pattern) * SEL005 Function call in where clause (assign to variable first) * COC001 Default param value copied into CoC wrapper signature * COC002 [ExtensionOf] class not declared final * COC003 [ExtensionOf] class name not ending _Extension * COC004 next not reached exactly once and unconditionally (SYS10028) * COC005 Global function (checkFailed/error/…) called as this.() on a table buffer * COC006 Re-reading the record the buffer already holds, instead of this.orig() * BP001 Hardcoded string literal in info/warning/error/checkFailed * BP002 doInsert/doUpdate/doDelete outside explicit migration comment * BP003 Generic doc-comment (/// Foo class. / /// methodName.) * BP004 Developer-only statements left in code (pause / print) * BP005 an enum SYMBOL (enum2Symbol / value2Symbol) in user-facing text — never translated * FN001 fixed-arity built-in called with the wrong number of arguments * TTS001 Unbalanced ttsbegin / ttscommit * TTS002 Dead catch inside an open tts scope (only UpdateConflict/DuplicateKeyException reach it) * TTS003 retry with no visible guard in its catch block (infinite-loop risk) * SEL006 index hint without allowIndexHint(true) * SEL007 left/right join or join…on — SQL/C# join syntax that is not X++ * CS001 C# constructs that do not compile in X++ ($"…", =>, foreach, ??, string type) * RPT001 DP reads parmDataContract() but declares no [SRSReportParameterAttribute] * RPT002 DP has processReport() but no [SRSReportDataSetAttribute] getter * RPT101 AxReport XML without a design node (codeType="xml-report") * RPT102 AxReport dataset without (codeType="xml-report") * XML001 AxTable XML missing an index with Yes * XML006 AxTable elements out of canonical order (silently dropped by the AOT) * XML007 Table-level property that does not exist in the AxTable model * * Added from compiler diagnostics (see src/knowledge/compilerFacts.ts): * FN002 a call to a predefined function this platform version does not have * BP006 pause / window / tableLock / changeSite — removed from the language * MAC001 a precompiler directive written without its dot (#define X) * SEL008 order by / group by after the where of the same segment * SEL009 the in operator with an inline container literal * SEL010 a select expression on an aliased buffer; validTimeState given an expression * ATTR001 an attribute argument that is not a compile-time literal * ATTR002 [SysObsolete] without message, isError AND date (xppbp moniker) * EXT001 an extension-method class whose class or methods are not static * KW001 a variable named after a reserved word * * Keyword scans run against a comment/string-masked copy of the source * (maskStringsAndComments) to avoid false positives inside literals/comments. * * Data-driven property rules (thresholds mined from STANDARD models into the * property_stats table during build-database; static defaults when no stats): * XML002 AxTable missing