Files
dc/sas/sasjs/db/migrations/20220615_v5.0_release.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

67 lines
1.7 KiB
SAS

/**
@file
@brief migration script to move from v4 to v5.0 of data controller
BREAKING CHANGE - deprecate MPE_APPROVALS and MPE_REVIEW (now MPE_SUBMIT does
both)
**/
%let dclib=YOURDCLIB;
libname &dclib "/your/dc/path";
/**
* Change 1
* New MPE_SUBMIT table
*/
proc sql;
create table &dclib..mpe_submit(
table_id varchar(32) not null,
submit_status_cd varchar(10) not null,
base_lib char(8) not null,
base_ds char(32) not null,
submitted_by_nm varchar(100) not null,
submitted_on_dttm num not null format=datetime19.3,
submitted_reason_txt varchar(400),
input_obs num,
input_vars num,
num_of_approvals_required num not null,
num_of_approvals_remaining num not null,
reviewed_by_nm char(100),
reviewed_on_dttm num,
constraint pk_mpe_submit
primary key(table_id)
);
/* change 2 - col level security */
%let notnull=not null;
proc sql;
create table &dclib..mpe_column_level_security(
tx_from num &notnull format=datetime19.3,
tx_to num &notnull format=datetime19.3,
CLS_SCOPE char(4) &notnull,
CLS_GROUP char(64) &notnull,
CLS_LIBREF char(8) &notnull,
CLS_TABLE char(32) &notnull,
CLS_VARIABLE_NM char(32) &notnull,
CLS_ACTIVE num &notnull,
CLS_HIDE num
);quit;
proc datasets lib=&dclib noprint;
modify mpe_column_level_security;
index create
pk_mpe_column_level_security=
(tx_to CLS_SCOPE CLS_GROUP CLS_LIBREF CLS_TABLE CLS_VARIABLE_NM)
/nomiss unique;
quit;
/* change 3 - drop helpful_link and add audit_libds */
proc sql;
alter table &dclib..mpe_tables drop helpful_link;
alter table &dclib..mpe_tables add audit_libds char(41);
/* now update the metadata if running SAS 9 EBI */