Files
dc/sas/sasjs/services/editors/getdynamiccolvals.test.1.sas
T
dc c8c0858295
Build / Build-and-ng-test (pull_request) Successful in 5m45s
Lighthouse Checks / lighthouse (pull_request) Successful in 21m2s
Build / Build-and-test-development (pull_request) Successful in 31m7s
fix(lint): make noUnusedMacros an error and clear its 54 findings
sas/.sasjslint now promotes noUnusedMacros to "error", so the rule fails
the build rather than printing a warning. The 54 findings it reported are
gone:

- 46 header entries nothing calls are dropped. Each removal was checked
  against the compiled artefacts rather than the linter alone: the
  project was compiled before and after, and the two sasjsbuild trees
  compared. 37 macro definitions disappear from the generated programs -
  every one of them either a duplicate of a definition the file still
  reaches through another declared macro, or a macro no generated program
  calls. No macro that a generated program calls lost its definition.
- 8 entries are kept, in five files that carry
  @sasjslint {"noUnusedMacros": false} with the reason written above it:
  the three serviceInit programs and serviceterm.sas declare mpeinit and
  mpeterm without calling them, because that declaration is how a service
  body reaches those macros at all; loadfile.sas declares mp_binarycopy
  for the fallback that is commented out on SAS 9.4 and later.
- Four headers are left with no macros to declare, so their empty
  <h4> SAS Macros </h4> section is removed rather than kept as a stub.

@sasjs/cli is bumped 6.2.0 -> 6.5.0 in sas/package.json. The lint engine
ships inside the CLI and is not a direct dependency, so the pinned CLI is
what fixes the rule set: 6.2.0 resolves @sasjs/lint 4.3.0, 6.5.0 pins
4.9.0 exactly. Both versions were compiled against this tree and the
sasjsbuild output is byte-identical, so the bump changes the lint engine
and nothing else.

`sasjs lint` is also now reachable as `npm run lint:sas`, and a CI step in
build.yaml runs it. Until now nothing ran SAS lint automatically, and a
bare `sasjs` resolves whatever CLI is installed globally - a different
lint version reports a different rule set, which is why the counts in
issue #376 (taken with 6.2.5) do not match the pinned 6.2.0.

43 warnings remain under the rules not yet promoted: noUndeclaredMacros
(25), noBannedStrings (13), macro name length and case (4),
indentationMultiple (1). They are the next rungs of the ratchet.

The pre-commit Prettier gate could not run: it needs client/node_modules,
which this worktree does not install, and the fix it attempted touched
three client files that this change does not modify (reverted). No client
file is in this commit.
2026-11-01 00:36:05 +00:00

100 lines
2.5 KiB
SAS

/**
@file
@brief testing getdynamiccolvals service
<h4> SAS Macros </h4>
@li mp_assertcols.sas
@li mp_assertcolvals.sas
@li mf_getuniquefileref.sas
@li mx_execute.sas
**/
%let _program=&appLoc/services/editors/getdynamiccolvals;
/**
* Test 1 - basic fetch
*/
%let f1=%mf_getuniquefileref();
data _null_;
file &f1 termstr=crlf;
put 'libds:$41. variable_nm:$32.';
put "&dclib..MPE_SECURITY,SAS_GROUP";
run;
%let f2=%mf_getuniquefileref();
data _null_;
file &f2 termstr=crlf;
put '_____DELETE__THIS__RECORD_____:$2. LIBREF:$8. DSN:$10. ACCESS_LEVEL:$7.';
put 'No,DC265453,MPE_X_TEST,APPROVE';
run;
%mx_execute(&_program,
viyacontext=&defaultcontext,
inputfiles=&f1:sascontroltable &f2:source_row,
outlib=web1,
mdebug=&sasjs_mdebug
)
data work.DYNAMIC_VALUES;
set web1.DYNAMIC_VALUES;
if _n_=1 then do;
putlog '>>TEST1<<';
putlog (_all_)(=);
end;
run;
/* results are sent as ARRAY so there are no column names. Check for table,
and the two array elements (DISPLAY_INDEX, RAW_VALUE)
*/
%mp_assertcols(work.DYNAMIC_VALUES,
cols=display_index raw_value,
test=ALL,
desc=Check two columns exist in DYNAMIC_VALUES
)
/**
* Test 2 - check libds
*/
%let f1=%mf_getuniquefileref();
data _null_;
file &f1 termstr=crlf;
put 'libds:$41. variable_nm:$32.';
put "&dclib..MPE_TABLES,LIBREF";
run;
%let f2=%mf_getuniquefileref();
data _null_;
file &f2 termstr=crlf;
put 'LIBREF:$char8. DSN:$char16. NUM_OF_APPROVALS_REQUIRED:best. LOADTYPE:$char10. '@;
put 'BUSKEY:$char35. VAR_TXFROM:$char7. VAR_TXTO:$char5. VAR_BUSFROM:$char1. '@;
put 'VAR_BUSTO:$char1. VAR_PROCESSED:$char1. CLOSE_VARS:$char1. PRE_EDIT_HOOK:$char1. '@;
put 'POST_EDIT_HOOK:$char1. PRE_APPROVE_HOOK:$char1. POST_APPROVE_HOOK:$char1. '@;
put 'SIGNOFF_COLS:$char1. SIGNOFF_HOOK:$char1. NOTES:$char55. RK_UNDERLYING:$char1. '@;
put 'AUDIT_LIBDS:$char1. _____DELETE__THIS__RECORD_____:$char2.';
put 'DC266708,MPE_VALIDATIONSF,14,TXTEMPORAL,BASE_LIB BASE_DS BASE_COL RULE_TYPE,TX_FROM'@;
put ',TX_TO, , , , , , , , ,,,Configuration of data quality rules in Editor component, , ,No';
run;
%mx_execute(&_program,
viyacontext=&defaultcontext,
inputfiles=&f1:sascontroltable &f2:source_row,
outlib=web2,
mdebug=&sasjs_mdebug
)
data DYNAMIC_VALUES;
set web2.DYNAMIC_VALUES;
if _n_=1 then do;
putlog '>>TEST2<<';
putlog (_all_)(=);
end;
run;
data work.check;
val="&dclib";
run;
%mp_assertcolvals(work.dynamic_values.raw_value,
checkvals=work.check.val,
desc=DCLIB found in getdynamicgolvals RAW_VALUE response,
test=ANYVAL
)