jhaabhijeet864 opened a new pull request, #4083: URL: https://github.com/apache/incubator-kie-tools/pull/4083
Closes https://github.com/apache/incubator-kie-tools/issues/3711 ### Description This PR introduces in-source per-code diagnostic suppression for the DRL Language Server under the `@drl-lsp-lint` directive namespace, and establishes stable diagnostic codes across all `drools-lint` heuristics. Key behaviors: - Stable diagnostic codes are now assigned to all lint passes: `missing-end`, `missing-separator`, `missing-semicolon`, `unbalanced-parens`, `mvel-property-access`, `unknown-type`, and `unknown-member`. - Directives parsed: - `// @drl-lsp-lint:disable-file [code, ...]` — file-level suppression - `// @drl-lsp-lint:disable-line [code, ...]` — current line suppression - `// @drl-lsp-lint:disable-next-line [code, ...]` — next line suppression - `// @drl-lsp-lint:disable-rule [code, ...]` — rule-level suppression (when placed above or inside a rule) - `// @drl-lsp-lint:disable [code, ...]` & `// @drl-lsp-lint:enable [code, ...]` — region/block suppression - Directives accept comma- or space-separated codes, or omit codes to act as wildcards (`*`) for all lint diagnostics. - Directives support single-line (`//`, `#`) and block comment (`/* ... */`) styles, as well as descriptive trailing notes (`-- note`). - Invariant safety: Directives apply strictly to `drools-lint` and `drools-type` diagnostics. Parser/syntax errors (`drools-drl-parser`) and compiler diagnostics (`drools`) are never dropped. Directives appearing inside string literals are ignored. ### Changes - `packages/drools-lsp/drools-completion/src/main/java/org/drools/completion/DRLLintHelper.java`: - Defined public constants `CODE_MISSING_END`, `CODE_MISSING_SEPARATOR`, `CODE_MISSING_SEMICOLON`, `CODE_UNBALANCED_PARENS`, `CODE_MVEL_PROPERTY_ACCESS`, `CODE_UNKNOWN_TYPE`, and `CODE_UNKNOWN_MEMBER`. - Assigned diagnostic codes in `lintMissingRuleEnds`, `lintMissingConstraintSeparators`, `lintMissingThenSemicolons`, and `lintUnbalancedParens`. - Routed diagnostic outputs in `lint(...)` and `lintUnknownTypes(...)` through `DRLLintSuppression.filter(...)`. - `packages/drools-lsp/drools-completion/src/main/java/org/drools/completion/DRLLintSuppression.java`: - Added parser and filter index for `@drl-lsp-lint` directives across file, rule, line, next-line, and region scopes. - Implemented string blanking to ensure directives in string literals are ignored while comment positions and line offsets are preserved. - `packages/drools-lsp/drools-completion/src/test/java/org/drools/completion/DRLLintSuppressionTest.java`: - Added comprehensive test suite covering all directive scopes, wildcard and targeted suppression, region disable/enable, comment styles, and non-suppression invariants for parser and compiler diagnostics. ### How to test Run the completion and suppression tests with Maven: ```bash mvn test -Drevision=0.0.0 -Dtest=DRLLintSuppressionTest,DRLLintHelperTest -pl packages/drools-lsp/drools-completion ``` ### Checklist - [x] Linked to an issue: https://github.com/apache/incubator-kie-tools/issues/3711 - [x] Follows pull request title guidelines - [x] Apache License 2.0 header in new source files - [x] Unit tests added and passing -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
