Repository navigation
feat(lint): add the noNestedCommentsInHeader rule - #265
Conversation
There was a problem hiding this comment.
Reviewed the full diff of #265 (rule, spec, schema, README, config wiring, mutation baseline).
-
src/rules/file/noNestedCommentsInHeader.ts:58 - the guard !value.slice(close + 2, terminator).includes('/') suppresses the case the rule exists for. A header whose truncated remainder holds a second comment (for example @details usage text with two / ... */ notes) goes silent, because the second opener is taken to mean another comment owns the terminator. Narrow the guard to a new header opener ('/**') inside that slice, which is what the later-header case actually turns on, and revisit the spec case that expects silence there: the first header's own plain close marker truncates it, so that shape is a true positive.
-
src/types/LintConfig.ts:162 and src/utils/getLintConfig.ts:38 - the rule ships enabled by default at Severity.Error (src/rules/file/noNestedCommentsInHeader.ts:40), so every consumer with a /* or /*/ in a doxygen header starts failing sasjs lint on upgrade while the commit type is feat: (minor release). Either mark it breaking (feat!: or a BREAKING CHANGE footer) or default it off, or to warn like the neighbouring header rules.
2 findings above for review.
cf61bdb to
c020bd2
Compare
There was a problem hiding this comment.
Reviewed the full base...head diff: new noNestedCommentsInHeader rule, its spec, and the config/schema/README/mutation-baseline wiring. All spec cases behave as asserted; two coverage gaps below.
-
src/rules/file/noNestedCommentsInHeader.ts:58 -
!value.slice(close + 2, terminator).includes('/*')blocks the report whenever ANY opener appears between the first close marker and the**/terminator, not just an opener that begins a later doxygen header. Consequence: a header holding two nested comments (@details /* a */followed by/* b */) is reported clean, and so is a header that holds both/*/text and a later/* ... */- both truncate the header exactly as the single-comment case does. Narrow the guard to a later header only, e.g./^\s*\/\*\*/m.test(value.slice(close + 2, terminator)), so a second plain comment inside the same header does not suppress the diagnostic. -
src/rules/file/noNestedCommentsInHeader.ts:46 -
!value.startsWith('/**', start)restricts the rule to a file whose first non-whitespace token is/**. A doxygen header that follows other code (a file opening with%put/%let, or a second header further down) is never inspected. If that is deliberate, say so in the README section, which currently reads as covering any header; otherwise scan from the leading/**onward rather than returning [] for the whole file.
No blocking issues; 2 findings above for review.
c020bd2 to
d43e516
Compare
|
All four findings addressed in d43e516. The The terminator, one level down (same class as the guard). While fixing that I found the mirror-image hole: a Bare close marker. Widened to match the rule name: a header closed early by a Severity (accepted). Default is now WARNING rather than ERROR - the neighbouring header rules' level - so Scope (documented, not widened). Only the header a file opens with is inspected, because that is the header Mutation: 89.69% (87 killed, 10 survived, 0 uncovered), baseline entry refreshed to those counts. The survivors are the Also fixed the coverage gap that made the first push red: |
There was a problem hiding this comment.
Reviewed the full base...head diff: the new noNestedCommentsInHeader file rule, its spec, and the config/schema/README/mutation-baseline wiring.
- src/rules/file/noNestedCommentsInHeader.ts:33 ownTerminator returns null unless the header's
**/terminator stands alone on its own line, so a header closed by a plain*/line - or one whose**/shares its line with header text - is treated as having no terminator and a nested/* ... */inside it is silently not reported. That is the truncation the rule exists to catch, and the shape the README section and the rule description claim to cover. Either fall back to the last close marker as the header terminator when no standalone**/is found, or state the**/-only constraint in the README section and in the rule description so the blind spot is visible.
1 finding above for review.
d43e516 to
8ed4e96
Compare
There was a problem hiding this comment.
Reviewed the full base...head diff: the rule, its spec, schema/README/config wiring, mutation baseline and the CI timeout change.
-
src/rules/file/noNestedCommentsInHeader.ts:33 (ownTerminator) searches for one terminator and stops there: it takes the first
**/at or after the close marker, andif (value.slice(lineStart, terminator).trim()) return nullgives up entirely when that candidate is not alone on its line. A header that holds a mid-line**/before its real terminator is therefore never reported, including the rule's own headline shape - header text with a bare close marker, followed later in the header text by an inline terminator in a usage example, never reaches a finding because the search bails on the inline one instead of moving on to the next candidate. Loop over successiveindexOf(TERMINATOR, ...)hits, skipping the non-standalone ones and the ones that fall after a later/**, and take the first that survives. -
src/rules/file/noNestedCommentsInHeader.ts:77:
value[close - 1] === '*'treats any**-prefixed close as the well-formed header terminator, so a nested comment written with a**/closer inside the header is skipped silently even though SAS cuts the header at that marker. If covering it is not worth the parsing, say so in the rule description so the gap is documented rather than implicit.
2 findings above for review.
8ed4e96 to
1f35a8c
Compare
|
Both points handled in 1f35a8c - one as a code change, one as the documentation you offered as the alternative. The missed inner snippet. Same class as a finding on the utils side: the early return A header closed by a plain Mutation after the change: 96.00% on the rule (92 killed, 4 survived, 4 timeouts), baseline entry refreshed. The four survivors are the Also in this push: the mutation job's |
There was a problem hiding this comment.
Reviewed the full base...head diff: rule implementation and spec, schema/README, LintConfig + getLintConfig wiring, mutation baseline, and the mutation-pr workflow timeout bump. Registration (default-on via !== false), severity plumbing, position reporting and the sibling-rule column convention all check out; two non-blocking notes.
-
src/rules/file/noNestedCommentsInHeader.ts:42 - the LATER_HEADER guard runs before the lineLeading check for every candidate and returns null outright, so a header that mentions a header shape in its own text (a line-leading
/**before the terminator) suppresses the report entirely, even when a real/* ... */precedes it./**inside an open block comment opens nothing in SAS - it is header text - so the guard should only disqualify candidates that come after such an opener when the earlier comment was already closed, not swallow the first candidate. As written, the primary case the rule exists for goes unreported for any header that documents the header format. -
src/rules/file/noNestedCommentsInHeader.ts:65 - the doc comment claims parity with sasjs/utils#288 in both directions ("and the other way round"), but this rule is deliberately silent on several truncation shapes: headers closed with a plain
*/, headers that are not the file's first, and truncated headers with no line-leading**/terminator. Unless the compile-time check keys on exactly the same boundaries, a file this rule passes can still failsasjs compile. Confirm the boundaries match utils and state it precisely, or drop the reciprocal claim here and at README.md:314.
2 findings above for review.
1f35a8c to
316b258
Compare
|
Both notes addressed in 316b258. The and In both, a line-leading The parity claim (fixed). The boundaries are in fact identical in both, which is why the claim was there - but "and the other way round" was the wrong way to say it. Both are silent on: a header that is not the file's first, a header closed with a plain Also: the push before this one broke the build. I put |
There was a problem hiding this comment.
Reviewed the full diff of #265: the new file rule noNestedCommentsInHeader and its spec, the config/schema/README wiring, and the mutation-runner timeout bump. Rule logic reads correctly against the documented boundaries (opening header only, line-leading **/ terminator, no later opener in between), including the /*/ text case and the bare */ text case.
- src/rules/file/noNestedCommentsInHeader.ts:21 -
positionOfre-implements index-to-line/column locally, while the rest of the repo routes this through src/utils/splitLines.ts (which documents why splitting is on/\r\n|\n/and not the configured line ending) and src/utils/getColumnNumber.ts. Two conventions for one job is how they drift; put agetPosition(text, index)in src/utils and use it here rather than a rule-local helper. - src/rules/file/noNestedCommentsInHeader.ts:111 -
endColumnNumber: columnNumber + 1spans one character, but the markers reported (/*,*/) are two characters, and the other file rules size the range to the token they name. Extend by the marker length so an editor highlight covers what the message reports.
2 findings above for review.
316b258 to
58737a1
Compare
|
Both taken in 58737a1 - the first one is the better catch, my helper duplicated a decision the repo had already made.
Mutation after the change: 96.88% (89 killed, 4 survived, 4 timeouts), baseline entry refreshed, gate green locally. Dropping the hand-rolled arithmetic removed a mutant family, so the score went up while the code got smaller. On the previous round's two notes, which are also answered: the |
There was a problem hiding this comment.
Reviewed the full base...head diff: the new file rule and its tests, registration in LintConfig and the file rule index, DefaultLintConfiguration, JSON schema, README, mutation baseline, and the mutation-pr workflow timeout change. Re-ran the rule's matching logic against the spec's boundary cases (well-formed header, plain-/ close, nested comment, // in text, bare close marker, later-header ownership) - behaviour matches the documented contract.
No blocking issues.
|
Two decisions from the maintainer, both keeping what is in this PR.
If you would rather review the guard as its own change, say so and I will split it out. |
58737a1 to
8428c28
Compare
|
The guard is in, in 8428c28, and to answer your question about where it belongs: That rule already reported the opener half ( The guard's own boundary, so it cannot make things worse: it only widens a close marker when the header's body holds no comment opener. A body with a Documentation followed the behaviour rather than sitting on the rule that only observes it: the closing style and its consequence are described under Numbers after the change: 522 tests, coverage thresholds met (the new branch needed two specs plus one for an unterminated header), and mutation 98.96% on One observation from the gate run that is worth your attention separately: it reports 246 static mutants, 57% of the total, estimated at 89% of the runtime. That is what pushes a three-file PR past twenty minutes - mostly mutated strings in |
There was a problem hiding this comment.
Reviewed the full diff: the new noNestedCommentsInHeader rule and its spec, the hasDoxygenHeader close-style check and fix, the LintConfig/schema/README wiring, and the mutation baseline and workflow timeout change.
- src/rules/file/hasDoxygenHeader.ts:20 -
const TERMINATOR = '**/'is declared but never referenced; the "already closed" test usesvalue[close - 1] === '*'instead. Dead constant - remove it, or use it in that comparison so the intent is in one place. - src/rules/file/hasDoxygenHeader.ts (test and fix) - this is a behaviour change, not just an addition: a header that closed with
*/passed before and now warns by default, on top of a new default-on rule. Projects that treat warnings as failures start failing on upgrade with no migration note, while the repo releases from commit messages and the subject isfeat(lint), which cuts a minor. Consider aBREAKING CHANGE:footer, or an explicit upgrade note in the README. - src/rules/file/hasDoxygenHeader.ts fix() -
singleAsteriskClose(...) as numbernarrows away thenullthe helper returns. If that null ever reached the branch,value.slice(0, null)yields '' and the fix would silently replace the file's contents with a single asterisk. Re-check for null and returnvalueunchanged rather than casting. - Pre-existing, not this diff: package.json declares
@sasjs/utilsas^4.0.0in dependencies - a floating range in a published runtime dependency. The rest of the manifest is exact-pinned, so this one stands out.
4 findings above for review.
8428c28 to
41f929b
Compare
|
Three of the four taken in 41f929b; the fourth is pre-existing policy, which I would rather raise than change inside this PR. Dead constant. Removed - The Upgrade visibility (accepted). The PR body now has an "Upgrade notes" section naming both visible changes - the new default-on rule and the
|
There was a problem hiding this comment.
Reviewed the full diff: the new noNestedCommentsInHeader rule and its spec, the hasDoxygenHeader close check and fix, schema/defaults/docs, mutation baseline and the mutation-pr timeout.
- src/rules/file/hasDoxygenHeader.ts:119-127 - fix() recomputes the close index with a weaker predicate than test() used (no double-asterisk guard, no comment-opener guard). The in-code claim that no input can reach a bad index only holds while the two predicates agree. Return the index from singleAsteriskClose and reuse it in the fix so the two cannot drift.
- src/rules/file/hasDoxygenHeader.ts:41 and src/rules/file/noNestedCommentsInHeader.ts:26 - positionOf is duplicated verbatim; move it to src/utils beside splitLines.
- Behaviour change - hasDoxygenHeader now warns on a header closed with a plain close marker, so codebases that were clean start reporting warnings, and with severityLevel hasDoxygenHeader=error a green pre-commit hook turns red. feat cuts a minor; say so in the release notes so the new warning is not a surprise.
- package.json - dependencies holds @sasjs/utils as a caret range while .npmrc sets save-exact=true (pre-existing, not introduced here). Pin it.
- README.md:516 - a blank line was inserted inside the machine-managed ALL-CONTRIBUTORS block, and the bullet and blank-line reformatting is unrelated to the rule. Leave the managed block as generated and keep the churn out of a rule PR.
- .github/workflows/mutation-pr.yml:39 - the cap is widened for every run to cover one file's mutation cost; scoping the mutant set for src/types/LintConfig.ts would keep the 20-minute guard.
CI at this head is pending with no contexts yet - re-check before merge.
6 findings above for review.
A doxygen header is a SAS block comment, and SAS block comments do not nest: the first close marker ends the comment. A `/* ... */` inside the header therefore closes the header early, and the rest of it - `@param` lines, and any code in a usage example - is compiled as live SAS. The same happens to header text that holds `/*/`, such as a glob like `src/*/file.sas`. `sasjs compile` now fails on that shape (sasjs/utils#288), which tells the author several hundred lines away from the header. This rule reports it where the header is edited: an error at the nested opener, or at the `/*/` when no comment was involved. The formatter guard lives in `hasDoxygenHeader`, the rule that already owns the header's form: it reports a header that closes with a single asterisk, and its fix widens that close marker to the double-asterisk form, which is what puts the header back where the truncation rule can locate its end. A header whose body holds a comment opener is left alone - the first close marker may belong to that comment, and that call is the author's. The rule is registered behind `noNestedCommentsInHeader !== false`, and a spec pins that it is left out when the setting is false - without it the branch coverage threshold for `src/types/` fails. Upgrade note: `noNestedCommentsInHeader` is on by default, and `hasDoxygenHeader` now also reports a header that closes with a single asterisk where it used to check the opener only. Both report at WARNING, so `sasjs lint` keeps its return code and this stays a minor. The rule is on by default and reports at WARNING severity, like the other header rules: `sasjs lint` keeps its return code, and the build still fails at the same shape through the compile check. It covers a nested comment, a literal sequence straight after an opener, and a bare close marker, and stays silent in the three states where nothing is truncated - a `**/` that closes the header first, a header with no terminator of its own, and a `**/` that belongs to a later header.
41f929b to
d4ef50d
Compare
|
All but two taken in d4ef50d. Both of the ones I did not change are decisions rather than code. fix/test drift (accepted, and it removed a cast). Duplicated positionOf (accepted). Moved to Release notes (done). The PR body has an "Upgrade notes" section naming both visible changes - the new default-on rule, and README churn (accepted - my damage). I had run @sasjs/utils caret (policy, not this PR). Published Mutation timeout (maintainer decision). Widening to 35 minutes for every run is deliberate - they were asked directly and chose to keep it. Your alternative is the better long-term answer and I have passed it on: scoping the mutant set so CI on this head was green before your review landed (both build jobs), and the local gate is green on d4ef50d. |
There was a problem hiding this comment.
Reviewed the full base...head diff: the new noNestedCommentsInHeader rule, the hasDoxygenHeader close-style change and its fix, the shared getPosition util, plus README, schema, LintConfig wiring, mutation baseline and the mutation-pr timeout change. Rule logic, boundary handling and the added spec coverage are sound; the new dependency-free util is covered for LF and CRLF.
- CI has no check contexts yet (pending) at this head - confirm the workflow run is green before merge.
No blocking issues.
|
CI is green on d4ef50d: Nothing else outstanding from your side; the last four findings (fix/test drift, the duplicated position helper, the README churn, the release note) are all in this head. |
|
🎉 This PR is included in version 4.4.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
`@sasjs/lint` 4.4.0 carries the author-time half of this work (sasjs/lint#265): the `noNestedCommentsInHeader` rule, and the `hasDoxygenHeader` check and fix for a header that closes with a single asterisk. Both report at WARNING, so a project's lint return code does not change on upgrade. `@sasjs/core` 6.1.1 is the `mx_execute` fix for the Viya outlogds step (sasjs/core#477) - a patch with no API change. The bumps ride in this PR because both touch `package.json` and `package-lock.json`, which this branch already changes for `@sasjs/utils` 4.1.1; two PRs editing the same lockfile would only conflict. Verified with `npm ci` against the new lockfile: lint 4.4.0, core 6.1.1 and utils 4.1.1 resolve; `npm audit --production --audit-level=low` reports no vulnerabilities.
The compile-time half of this (sasjs/utils#288) and the author-time half (sasjs/lint#265) are released; this brings them to the CLI and names the file in the error. `removeHeader` takes the source path from `@sasjs/utils` 4.1.1, so both call sites that read a file and strip its header pass it: the compile path for `SASJsFileType.file`, and the build path that reads program files. A truncated header used to report line numbers with no file name on those paths, which is the failure the check exists to prevent. Dependencies, all in this one commit because they share `package-lock.json`: - `@sasjs/utils` ^4.1.0 -> ^4.1.1, the release carrying the path argument. - `@sasjs/lint` ^4.3.2 -> ^4.4.0, carrying `noNestedCommentsInHeader` and the `hasDoxygenHeader` single-asterisk close check and fix. Both report at WARNING, so a project's lint return code does not change on upgrade. - `@sasjs/core` ^6.0.0 -> ^6.1.1, the `mx_execute` Viya outlogds fix (sasjs/core#477) - a patch with no API change. The `@sasjs/lint` devDependencies entry is gone: it is a runtime dependency of `src/commands/lint/processLint.ts`, so the second declaration was dead weight. Its peer range moves to ^4.4.0, since 4.4.0 is where the rule the CLI ships comes from. One unplanned effect of the lint bump: 4.3.2 pinned `@sasjs/utils` exactly and nested a second copy at 4.0.0 under `node_modules/@sasjs/lint`. 4.4.0 ranges it, so the tree carries a single utils at 4.1.1 and the lockfile loses 49 lines. That nesting is why these remain caret ranges rather than exact pins. CI: `.github/workflows/run-tests.yml` gains `HTTP_PORT=5000` in the server `.env`. `sasjs/server` 3.0.0 (released 2026-10-26 23:35) refuses to start with no listener enabled, and the job downloads `releases/latest`, so the server step failed before any test ran on every PR opened since. The wait step polls port 5000, which is why that is the port. Verified: `npm ci` on the new lockfile (one copy of each package), `npm audit --production` clean, tsc and prettier clean, mocked suite 629 passed with only the environmental `printVersion` failure that also fails on main in this environment. The new spec fails with the path argument reverted.
The compile-time half of this (sasjs/utils#288) and the author-time half (sasjs/lint#265) are released; this brings them to the CLI and names the file in the error. What changes for a project: a SAS file whose doxygen header is cut short by a block comment inside it used to compile, and the header text after the cut was handed to SAS as code. It now fails the compile with a message naming the file and the lines involved. The input cannot compile - SAS block comments do not nest, so the first `*/` ends the comment - and the old behaviour silently ran whatever followed. This is the check from @sasjs/utils 4.1.1, which this release adopts. `removeHeader` takes the source path from @sasjs/utils 4.1.1, so both call sites that read a file and strip its header pass it: the compile path for `SASJsFileType.file`, and the build path that reads program files. Without it the diagnostic reported line numbers with no file name on exactly the paths where a user meets it. Dependencies, all in this one commit because they share `package-lock.json`: - `@sasjs/utils` ^4.1.0 -> ^4.1.1, the release carrying the path argument. - `@sasjs/lint` ^4.3.2 -> ^4.4.0 in `devDependencies` and `peerDependencies`, carrying `noNestedCommentsInHeader` and the `hasDoxygenHeader` single-asterisk close check and fix. Both report at WARNING, so a project's lint return code does not change on upgrade. The declaration stays peer plus dev, as on main: lint is imported at runtime and npm 7+ installs a peer automatically, so it is not promoted to a hard dependency. - `@sasjs/core` ^6.0.0 -> ^6.1.1, the `mx_execute` Viya outlogds fix (sasjs/core#477) - a patch with no API change. One unplanned effect of the lint bump: 4.3.2 pinned `@sasjs/utils` exactly and nested a second copy at 4.0.0 under `node_modules/@sasjs/lint`. 4.4.0 ranges it, so the tree carries a single utils at 4.1.1 and the lockfile loses 49 lines. That nesting is why these remain caret ranges rather than exact pins. CI: `.github/workflows/run-tests.yml` gains `HTTP_PORT=5000` in the server `.env`. `sasjs/server` 3.0.0 (released 2026-10-26 23:35) refuses to start with no listener enabled, and the job downloads `releases/latest`, so the server step failed before any test ran on every PR opened since. The wait step polls port 5000, which is why that is the port. Verified: `npm ci` on the new lockfile (one copy of each package), `npm audit --production` clean, tsc and prettier clean, mocked suite 629 passed with only the environmental `printVersion` failure that also fails on main in this environment. The spec that pins the file name fails when the path argument is reverted, and asserts the diagnostic's shape rather than the library's wording.
The compile-time half of this (sasjs/utils#288) and the author-time half (sasjs/lint#265) are released; this brings them to the CLI and names the file in the error. What changes for a project: a SAS file whose doxygen header is cut short by a block comment inside it used to compile, and the header text after the cut was handed to SAS as code. It now fails the compile with a message naming the file and the lines involved. The input cannot compile - SAS block comments do not nest, so the first `*/` ends the comment - and the old behaviour silently ran whatever followed. This is the check from @sasjs/utils 4.1.1, which this release adopts. `removeHeader` takes the source path from @sasjs/utils 4.1.1, so both call sites that read a file and strip its header pass it: the compile path for `SASJsFileType.file`, and the build path that reads program files. Without it the diagnostic reported line numbers with no file name on exactly the paths where a user meets it. Dependencies, all in this one commit because they share `package-lock.json`: - `@sasjs/utils` ^4.1.0 -> ^4.1.1, the release carrying the path argument. - `@sasjs/lint` ^4.3.2 -> ^4.4.0 in `devDependencies` and `peerDependencies`, carrying `noNestedCommentsInHeader` and the `hasDoxygenHeader` single-asterisk close check and fix. Both report at WARNING, so a project's lint return code does not change on upgrade. The declaration stays peer plus dev, as on main: lint is imported at runtime and npm 7+ installs a peer automatically, so it is not promoted to a hard dependency. - `@sasjs/core` ^6.0.0 -> ^6.1.1, the `mx_execute` Viya outlogds fix (sasjs/core#477) - a patch with no API change. One unplanned effect of the lint bump: 4.3.2 pinned `@sasjs/utils` exactly and nested a second copy at 4.0.0 under `node_modules/@sasjs/lint`. 4.4.0 ranges it, so the tree carries a single utils at 4.1.1 and the lockfile loses 49 lines. That nesting is why these remain caret ranges rather than exact pins. CI: `.github/workflows/run-tests.yml` gains `HTTP_PORT=5000` in the server `.env`. `sasjs/server` 3.0.0 (released 2026-10-26 23:35) refuses to start with no listener enabled, and the job downloads `releases/latest`, so the server step failed before any test ran on every PR opened since. The wait step polls port 5000, which is why that is the port. Verified: `npm ci` on the new lockfile (one copy of each package), `npm audit --production` clean, tsc and prettier clean, mocked suite 629 passed with only the environmental `printVersion` failure that also fails on main in this environment. The spec that pins the file name fails when the path argument is reverted, and asserts the diagnostic's shape rather than the library's wording.
The compile-time half of this (sasjs/utils#288) and the author-time half (sasjs/lint#265) are released; this brings them to the CLI and names the file in the error. What changes for a project: a SAS file whose doxygen header is cut short by a block comment inside it used to compile, and the header text after the cut was handed to SAS as code. It now fails the compile with a message naming the file and the lines involved. The input cannot compile - SAS block comments do not nest, so the first `*/` ends the comment - and the old behaviour silently ran whatever followed. This is the check from @sasjs/utils 4.1.1, which this release adopts. `removeHeader` takes the source path from @sasjs/utils 4.1.1, so both call sites that read a file and strip its header pass it: the compile path for `SASJsFileType.file`, and the build path that reads program files. Without it the diagnostic reported line numbers with no file name on exactly the paths where a user meets it. Dependencies, all in this one commit because they share `package-lock.json`: - `@sasjs/utils` ^4.1.0 -> ^4.1.1, the release carrying the path argument. - `@sasjs/lint` ^4.3.2 -> ^4.4.0 in `devDependencies` and `peerDependencies`, carrying `noNestedCommentsInHeader` and the `hasDoxygenHeader` single-asterisk close check and fix. Both report at WARNING, so a project's lint return code does not change on upgrade. The declaration stays peer plus dev, as on main: lint is imported at runtime and npm 7+ installs a peer automatically, so it is not promoted to a hard dependency. - `@sasjs/core` ^6.0.0 -> ^6.1.1, the `mx_execute` Viya outlogds fix (sasjs/core#477) - a patch with no API change. One unplanned effect of the lint bump: 4.3.2 pinned `@sasjs/utils` exactly and nested a second copy at 4.0.0 under `node_modules/@sasjs/lint`. 4.4.0 ranges it, so the tree carries a single utils at 4.1.1 and the lockfile loses 49 lines. That nesting is why these remain caret ranges rather than exact pins. CI: `.github/workflows/run-tests.yml` gains `HTTP_PORT=5000` in the server `.env`. `sasjs/server` 3.0.0 (released 2026-10-26 23:35) refuses to start with no listener enabled, and the job downloads `releases/latest`, so the server step failed before any test ran on every PR opened since. The wait step polls port 5000, which is why that is the port. Verified: `npm ci` on the new lockfile (one copy of each package), `npm audit --production` clean, tsc and prettier clean, mocked suite 629 passed with only the environmental `printVersion` failure that also fails on main in this environment. The spec that pins the file name fails when the path argument is reverted, and asserts the diagnostic's shape rather than the library's wording.
…1500) The compile-time half of this (sasjs/utils#288) and the author-time half (sasjs/lint#265) are released; this brings them to the CLI and names the file in the error. What changes for a project: a SAS file whose doxygen header is cut short by a block comment inside it used to compile, and the header text after the cut was handed to SAS as code. It now fails the compile with a message naming the file and the lines involved. The input cannot compile - SAS block comments do not nest, so the first `*/` ends the comment - and the old behaviour silently ran whatever followed. This is the check from @sasjs/utils 4.1.1, which this release adopts. `removeHeader` takes the source path from @sasjs/utils 4.1.1, so both call sites that read a file and strip its header pass it: the compile path for `SASJsFileType.file`, and the build path that reads program files. Without it the diagnostic reported line numbers with no file name on exactly the paths where a user meets it. Dependencies, all in this one commit because they share `package-lock.json`: - `@sasjs/utils` ^4.1.0 -> ^4.1.1, the release carrying the path argument. - `@sasjs/lint` ^4.3.2 -> ^4.4.0 in `devDependencies` and `peerDependencies`, carrying `noNestedCommentsInHeader` and the `hasDoxygenHeader` single-asterisk close check and fix. Both report at WARNING, so a project's lint return code does not change on upgrade. The declaration stays peer plus dev, as on main: lint is imported at runtime and npm 7+ installs a peer automatically, so it is not promoted to a hard dependency. - `@sasjs/core` ^6.0.0 -> ^6.1.1, the `mx_execute` Viya outlogds fix (sasjs/core#477) - a patch with no API change. One unplanned effect of the lint bump: 4.3.2 pinned `@sasjs/utils` exactly and nested a second copy at 4.0.0 under `node_modules/@sasjs/lint`. 4.4.0 ranges it, so the tree carries a single utils at 4.1.1 and the lockfile loses 49 lines. That nesting is why these remain caret ranges rather than exact pins. CI: `.github/workflows/run-tests.yml` gains `HTTP_PORT=5000` in the server `.env`. `sasjs/server` 3.0.0 (released 2026-10-26 23:35) refuses to start with no listener enabled, and the job downloads `releases/latest`, so the server step failed before any test ran on every PR opened since. The wait step polls port 5000, which is why that is the port. Verified: `npm ci` on the new lockfile (one copy of each package), `npm audit --production` clean, tsc and prettier clean, mocked suite 629 passed with only the environmental `printVersion` failure that also fails on main in this environment. The spec that pins the file name fails when the path argument is reverted, and asserts the diagnostic's shape rather than the library's wording. Co-authored-by: [email protected] <[email protected]>
## What
`.sasjslint` promotes the two doxygen-header rules to `error`:
```json
"severityLevel": {
"hasDoxygenHeader": "error",
"noNestedCommentsInHeader": "error"
}
```
## Why
Both rules already report on this corpus; at their default severity they
report and nothing else. Promoted, a truncated header stops at the
commit rather than surviving to a build - which is what `sasjs/utils`
4.1.1 now catches at compile time and what the lint reports at author
time, released in `@sasjs/lint` 4.4.0 (sasjs/lint#265).
`hasDoxygenHeader` at `error` also makes its new check fatal: a header
closed with a single asterisk. SAS ends a block comment at the first
`*/`, so everything a `*/`-closed header appears to enclose is parsed as
code.
## Measurement, not assumption
Ran `@sasjs/lint` 4.4.0 over every folder in `sasjs/sasjsconfig.json`
(base, ddl, fcmp, lua, meta, metax, server, viya, xplatform, tests/*)
with the current config and with both rules at `error`: 232 findings
either way, all from other rules (line endings, indentation, undeclared
macros), none from these two. So this changes no macro and cannot redden
CI on today's corpus.
The severity override was validated separately - setting `lineEndings:
error` flips 78 findings from warning to error, so the override path is
live and the zero above is a real zero.
`sasjs lint` (CLI 6.2.4) against the project exits with warnings only,
and none of them are header findings.
## Also
`AGENTS.md` gains the header-shape line, so the rules a contributor
reads match what the lint enforces.
Co-authored-by: sasjs-dev[bot] <sasjs-dev[bot]@users.noreply.github.com>
Issue
sasjs/cli#1499 - a nested block comment inside a doxygen header truncates the header and the remainder is compiled as SAS. The compile-time fix is sasjs/utils#288; this is the author-time gate.
Intent
Report a block comment inside the doxygen header where the header is written, instead of leaving the author to bisect a build.
A doxygen header is a SAS block comment, and SAS block comments do not nest: the first close marker ends the comment. So a
/* ... */inside the header closes it early, and the rest -@paramlines, code in a usage example - runs as live SAS. Header text holding/*/ends the header the same way, with no comment involved:@details outputs land in src/*/file.sasis enough.Implementation
src/rules/file/noNestedCommentsInHeader.ts, a file rule registered with the others:sasjs lintkeeps its return code on upgrade, and the build still fails at the same shape through the compile check.severityLevel: {"noNestedCommentsInHeader": "error"}makes it fatal for a project that wants that./*/), is bare text, or is an inner snippet closing with its own**/- a distinct message for the first three.**/inside a statement is that statement's text, and one behind a later/**closes that header, so neither counts. A second plain comment inside the same header does not suppress the report - it is part of the text that leaked.**/that is the header's own terminator, and a header with no terminator of its own.sasjs compilereads. A file that opens with code has no header to truncate, andhasDoxygenHeadercovers that shape.No
fix: deleting the author's comment would rewrite their code, and the/*/case has no mechanical repair.Wiring follows the repo's own guards:
src/rules/file/index.ts, theLintConfigregistration,DefaultLintConfiguration, the README defaults block plus a section, andsasjslint-schema.json(default, property andseverityLevelentry) - the specs that compare all of these fail if any one is missed.The formatter guard
hasDoxygenHeader- the rule that already owns the header's form - now also reports a header that closes with a single asterisk, and its fix widens that marker to the double-asterisk form:becomes
That is what closes the blind spot below rather than only documenting it: two tools locate the header's end by its terminator, so a plain-
*/header is invisible to both, and the truncation check can only see a header once it is in the form. A header whose body holds a comment opener is left alone - the first close marker may belong to that comment, and that call belongs to the author.Documentation moved with the behaviour: the closing style is described under
hasDoxygenHeader(where the fix lives), andnoNestedCommentsInHeaderpoints at it rather than restating the constraint.Upgrade notes
Two changes are visible to an existing project, both at WARNING severity, so
sasjs lintkeeps its return code and the commit stays afeat:noNestedCommentsInHeaderis on by default. It reports a doxygen header that SAS ends early - a nested comment, a/*/, a bare close marker, or an inner snippet closing with its own**/.hasDoxygenHeadernow also reports a header that closes with a single asterisk, where before it only checked the opener.sasjs formatrewrites that close marker to the double-asterisk form.A project that promotes warnings to errors (
severityLevel) sees both on its next lint run; set"noNestedCommentsInHeader": falseto silence the first, and runsasjs formatfor the second.Checks
npm run lint- Prettier clean.npx tsc --noEmit- clean.npm test- 522 tests, 48 suites.node scripts/mutation-gate.mjs pr- passed.Mutation
Scoped to the new file, before the baseline entry was written:
The four survivors are the
null/-1guard families and index arithmetic where the characters at the offsets are/,*or whitespace, and the four timeouts are terminator-loop mutants that stop advancing the cursor - a hang is itself a detection for any input that reaches it.The run reached this from 96.55% of a smaller module: the added branch for a bare close marker and the line-leading terminator check cost score but cover two more shapes, and the specs grew by five to kill what could be killed.
mutation-baseline.jsongains an entry with those counts, so the ratchet starts from this PR rather than the 80% new-file floor.Not in this PR
Once
@sasjs/utilsreleases thegetDoxygenHeaderexport from sasjs/utils#288, this rule can delegate the extent arithmetic to it instead of keeping its own copy. The semantics are deliberately identical today, and the specs pin the same shapes in both repos.