fix(lint): rename the short and mixed-case helper macros, and clear the last warnings (ratchet 4/n, #376) #421

Merged
allan merged 1 commits from fix/lint-macro-names into release/7.22 2026-11-01 09:06:09 +00:00
Collaborator

Rung 4 of the #376 ratchet, on top of #420. This clears the last 5 findings and promotes the three rules that produced them to error. With this applied in isolation, npm run lint:sas reports 0 warnings, 0 errors: every rule that fires on this codebase is now promoted.

Tests on sas.4gl.io

$ sasjs cbd -t server-lint
✔ Services have been successfully deployed to https://sas.4gl.io

$ sasjs request services/admin/makedata -d deploy/makeDataServer.json -t server-lint
[{'STATUS': 'SUCCESS', 'MESSAGE': 'Data Controller Config created by sasjssrv', ...}]

$ sasjs test -t server-lint
ℹ Tests provided results: 64/64 (100%)
  Tests that pass: 64/64 (100%)

Run against a scratch appLoc (/Public/app/dc-lint-ratchet), so /Public/app/dc is untouched. The scratch target was in sasjsconfig.json only for the run and is not part of the commit. The viewdata and usergroupsbymember suites are in that run, so both renames below are covered by passing tests.

What changed

  • services/public/viewdata.sas wraps its service body in a helper macro named x; it becomes viewdata_body. The wrapper is what keeps the %global and the %return in one macro scope, so the rename is purely mechanical.
  • targets/sas9/.../usernav/usergroupsbymember.sas builds work.iwant inside a helper macro named x; it becomes build_iwant.
  • targets/sas9/.../admin/refreshtablelineage.sas defines getTables with uppercase; it becomes gettables at the definition, the %mend and its seven call sites.
  • services/auditors/getstagetable.test.sas: one comment line carried three leading spaces where the file uses two.

Promoted: minMacroNameLength, lowerCaseMacroNames (both default-on settings that already warned at their default values) and indentationMultiple.

Verification

  • npm run lint:sas: 0 warnings, 0 errors, exit 0 - All matched files use @sasjs/lint code style!
  • sasjs compile: succeeds.
  • Full SAS suite on sas.4gl.io: 64/64 (above).

Remaining

The next rung turns on the off-by-default rules. Measured on this tree: noSingleAsteriskComments 9 findings, noUnusedLibnames 1, lineEndings 34 (33 files with no trailing newline, 3 stored with CRLF) - that last one is whitespace-only and will be its own PR. noMacroIfInOpenCode stays off, with the reason recorded in AGENTS.md: it flags the open-code %if blocks service bodies rely on, which need SAS 9.4M5, and the documented minimum is 9.4M3.

Rung 4 of the #376 ratchet, on top of #420. This clears the last 5 findings and promotes the three rules that produced them to `error`. With this applied in isolation, `npm run lint:sas` reports **0 warnings, 0 errors**: every rule that fires on this codebase is now promoted. ## Tests on sas.4gl.io ``` $ sasjs cbd -t server-lint ✔ Services have been successfully deployed to https://sas.4gl.io $ sasjs request services/admin/makedata -d deploy/makeDataServer.json -t server-lint [{'STATUS': 'SUCCESS', 'MESSAGE': 'Data Controller Config created by sasjssrv', ...}] $ sasjs test -t server-lint ℹ Tests provided results: 64/64 (100%) Tests that pass: 64/64 (100%) ``` Run against a scratch appLoc (`/Public/app/dc-lint-ratchet`), so `/Public/app/dc` is untouched. The scratch target was in `sasjsconfig.json` only for the run and is not part of the commit. The `viewdata` and `usergroupsbymember` suites are in that run, so both renames below are covered by passing tests. ## What changed - `services/public/viewdata.sas` wraps its service body in a helper macro named `x`; it becomes `viewdata_body`. The wrapper is what keeps the `%global` and the `%return` in one macro scope, so the rename is purely mechanical. - `targets/sas9/.../usernav/usergroupsbymember.sas` builds `work.iwant` inside a helper macro named `x`; it becomes `build_iwant`. - `targets/sas9/.../admin/refreshtablelineage.sas` defines `getTables` with uppercase; it becomes `gettables` at the definition, the `%mend` and its seven call sites. - `services/auditors/getstagetable.test.sas`: one comment line carried three leading spaces where the file uses two. Promoted: `minMacroNameLength`, `lowerCaseMacroNames` (both default-on settings that already warned at their default values) and `indentationMultiple`. ## Verification - `npm run lint:sas`: 0 warnings, 0 errors, exit 0 - `All matched files use @sasjs/lint code style!` - `sasjs compile`: succeeds. - Full SAS suite on sas.4gl.io: 64/64 (above). ## Remaining The next rung turns on the off-by-default rules. Measured on this tree: `noSingleAsteriskComments` 9 findings, `noUnusedLibnames` 1, `lineEndings` 34 (33 files with no trailing newline, 3 stored with CRLF) - that last one is whitespace-only and will be its own PR. `noMacroIfInOpenCode` stays off, with the reason recorded in `AGENTS.md`: it flags the open-code `%if` blocks service bodies rely on, which need SAS 9.4M5, and the documented minimum is 9.4M3.
hermes added 1 commit 2026-11-01 08:49:48 +00:00
fix(lint): rename the short and mixed-case helper macros, and clear the last warnings
Build / Build-and-ng-test (pull_request) Successful in 6m23s
Lighthouse Checks / lighthouse (pull_request) Successful in 20m45s
Build / Build-and-test-development (pull_request) Successful in 35m22s
7da67eb17b
Rung 4 of the #376 ratchet. It clears the last 5 findings and promotes the
three rules that produced them to "error": minMacroNameLength,
lowerCaseMacroNames and indentationMultiple. `sasjs lint` now reports no
warnings and no errors across the project.

- viewdata.sas wraps its service body in a helper macro named `x`; it
  becomes viewdata_body. The wrapper is what keeps the %global and the
  %return in one macro scope.
- usergroupsbymember.sas (sas9) builds work.iwant inside a helper macro
  named `x`; it becomes build_iwant.
- refreshtablelineage.sas (sas9) defines `getTables` with uppercase; it
  becomes `gettables`, at the definition, the %mend and its seven calls.
- getstagetable.test.sas: one comment line carried three leading spaces
  where the file uses two.

VERIFICATION

- `npm run lint:sas`: 0 warnings, 0 errors, exit 0, "All matched files
  use @sasjs/lint code style!".
- `sasjs compile`: succeeds.
- Deployed to sas.4gl.io and ran the SAS suite there against a scratch
  appLoc (/Public/app/dc-lint-ratchet) seeded with makedata: "Tests that
  pass: 64/64 (100%)". The viewdata and usergroupsbymember suites are in
  that run, so the two renames are covered by passing tests.
allan merged commit de5cb029eb into release/7.22 2026-11-01 09:06:09 +00:00
allan deleted branch fix/lint-macro-names 2026-11-01 09:06:09 +00:00
Sign in to join this conversation.