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.
86 lines
2.1 KiB
SAS
86 lines
2.1 KiB
SAS
/**
|
|
@file getauditfile.sas
|
|
@brief Downloads a zip file containing audit info.
|
|
@details The staging location from the &mpelocapprovals location
|
|
is zipped and returned as a file download. A user can only request the
|
|
audit pack if they have EDIT or APPROVE rights on the target table.
|
|
|
|
<h4> SAS Macros </h4>
|
|
@li mf_getuser.sas
|
|
@li mf_verifymacvars.sas
|
|
@li mpe_accesscheck.sas
|
|
@li mp_abort.sas
|
|
@li mp_dirlist.sas
|
|
@li mf_getattrn.sas
|
|
@li mp_streamfile.sas
|
|
|
|
|
|
@version 9.2
|
|
@author 4GL Apps Ltd
|
|
@copyright 4GL Apps Ltd. This code may only be used within Data Controller
|
|
and may not be re-distributed or re-sold without the express permission of
|
|
4GL Apps Ltd.
|
|
|
|
**/
|
|
|
|
%mpeinit()
|
|
options mprint;
|
|
|
|
/* security checks */
|
|
%let user=%mf_getuser();
|
|
|
|
proc sql noprint;
|
|
select cats(base_lib,'.',base_ds) into: libds
|
|
from &mpelib..mpe_submit
|
|
where table_id="&table";
|
|
|
|
%mp_abort(
|
|
iftrue=(%mf_verifymacvars(libds table)=0)
|
|
,mac=&_program
|
|
,msg=%str(Missing: libds table)
|
|
)
|
|
|
|
%mpe_accesscheck(&libds,outds=authEDIT,user=&user,access_level=EDIT);
|
|
%mpe_accesscheck(&libds,outds=authAPP,user=&user,access_level=APPROVE);
|
|
|
|
%mp_abort(
|
|
iftrue=(
|
|
%mf_getattrn(work.authEDIT,NLOBS)=0 & %mf_getattrn(work.authAPP,NLOBS)=0
|
|
)
|
|
,mac=mpestp_audit
|
|
,msg=%str(&user not authorised to download audit data for &table)
|
|
)
|
|
|
|
ods package(ProdOutput) open nopf;
|
|
|
|
options notes source2 mprint;
|
|
%let table=%unquote(&table);
|
|
%mp_dirlist(outds=dirs, path=&mpelocapprovals/&TABLE);
|
|
data _null_;
|
|
set dirs;
|
|
retain str1
|
|
"ods package(ProdOutput) add file='&mpelocapprovals/&TABLE/";
|
|
retain str2 "' mimetype='text/plain' path='contents/';";
|
|
call execute(cats(str1,filename,str2));
|
|
run;
|
|
|
|
%let archive_path=%sysfunc(pathname(work));
|
|
|
|
ods package(ProdOutput) publish archive properties
|
|
(archive_name= "&table..zip" archive_path="&archive_path");
|
|
|
|
ods package(ProdOutput) close;
|
|
|
|
%mp_abort(iftrue= (&syscc ne 0)
|
|
,mac=&_program..sas
|
|
,msg=%nrstr(syscc=&syscc)
|
|
)
|
|
|
|
/* now serve zip file to client */
|
|
%mp_streamfile(contenttype=ZIP
|
|
,inloc=%str(&archive_path/&table..zip)
|
|
,outname=&table..zip
|
|
)
|
|
|
|
%mpeterm()
|