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.
148 lines
4.0 KiB
SAS
Executable File
148 lines
4.0 KiB
SAS
Executable File
/**
|
|
@file mpeinit.sas
|
|
@brief Initialisation file for Data Controller- sets SASAUTOs etc
|
|
@details Runs at the beginning of every service. Used to configure settings,
|
|
options and macro variables. Requires the staging area and DC library to be
|
|
preconfigured.
|
|
|
|
<h4> SAS Macros </h4>
|
|
@li dc_getsettings.sas
|
|
@li mf_fmtdttm.sas
|
|
@li mp_abort.sas
|
|
@li mp_init.sas
|
|
|
|
@param fetch= Fetch the SASjs tables. Use NO if not loading SASjs content,
|
|
eg for file upload.
|
|
|
|
@version 9.3
|
|
@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.
|
|
**/
|
|
|
|
|
|
%macro mpeinit(fetch=YES);
|
|
%global mpeinit
|
|
mpeadmins /* group with unrestricted Meditor access */
|
|
mpelocapprovals /* location for landing and staging files */
|
|
mpelib /* location of configuration tables for DC */
|
|
dc_repo_users /* location of user / group metadata */
|
|
/* extracted in dc_getsettings */
|
|
dc_activation_key
|
|
dc_licence_key
|
|
dc_locale
|
|
dc_request_logs
|
|
dc_restrict_viewer
|
|
dc_dttmtfmt /* can be overridden in dc_getsettings */
|
|
_debug /* automatic variable when provided in URL */
|
|
sasjs_mdebug /* used to show extra info when _debug is enabled */
|
|
sqlrc /* avoid errors when using DI jobs in HOOK scripts */
|
|
;
|
|
|
|
%if &mpeinit=1 %then %return;
|
|
%else %let mpeinit=1;
|
|
%mp_abort(iftrue= (&syscc ne 0)
|
|
,mac=&_program
|
|
,msg=%str(Problem on service startup (&syswarningtext &syserrortext))
|
|
)
|
|
|
|
%mp_init()
|
|
|
|
%if &fetch=YES %then %do;
|
|
%webout(FETCH)
|
|
%end;
|
|
|
|
%global _CLIENTNAME;
|
|
%mp_abort(iftrue= (&_CLIENTNAME=SAS Enterprise Guide)
|
|
,mac=&_program..sas
|
|
,msg=%str(Data Controller is a web app and should not be executed from EG)
|
|
)
|
|
|
|
options urlencoding=utf8 nobomfile lrecl=32767;
|
|
|
|
%let perf=%sysfunc(datetime());
|
|
%put perfdiff: 0;
|
|
|
|
%let dc_locale=SYSTEM; /* default if not set */
|
|
|
|
/**
|
|
* E8601DT26.6 has widest database support - but not all SAS flavours can
|
|
* handle it. Override in the settings STP if needed.
|
|
*/
|
|
data _null_;
|
|
dc_dttmtfmt='"%sysfunc(datetime(),'!!"%mf_fmtdttm()"!!')"dt';
|
|
call symputx('dc_dttmtfmt',dc_dttmtfmt);
|
|
put dc_dttmtfmt=;
|
|
run;
|
|
|
|
%put &=dc_dttmtfmt;
|
|
|
|
%mp_abort(iftrue= (&syscc ne 0)
|
|
,mac=&_program
|
|
,msg=%str(syscc=&syscc prior to dc_getsettings)
|
|
)
|
|
|
|
%dc_getsettings()
|
|
|
|
%mp_abort(iftrue= (&syscc ne 0)
|
|
,mac=&_program
|
|
,msg=%str(syscc=&syscc after dc_getsettings)
|
|
)
|
|
|
|
data _null_;
|
|
set &DC_LIBREF..mpe_config(where=(
|
|
var_scope="DC"
|
|
and &dc_dttmtfmt lt tx_to
|
|
and var_active=1
|
|
));
|
|
call symputx(var_name,var_value,'G');
|
|
putlog var_name "=" var_value;
|
|
run;
|
|
|
|
%let mpelib=&dc_libref;
|
|
%let mpeadmins=&dc_admin_group;
|
|
%let mpelocapprovals=&dc_staging_area;
|
|
%let dc_repo_users=&dc_repo_users;
|
|
|
|
%if &dc_locale ne SYSTEM %then %do;
|
|
options locale=&dc_locale;
|
|
%end;
|
|
|
|
%mp_abort(iftrue= (&syscc ne 0)
|
|
,mac=&_program..sas
|
|
,msg=%str(Problem during compilation or with STP precode (&syswarningtext))
|
|
)
|
|
|
|
/* `_debug` is 131 by default, but the adapter sends 128 on the Viya WEB JES
|
|
* path when runAsTask is enabled (see WebJobExecutor.getRequestParams), and
|
|
* 128 also arrives when a `log` debug value is requested. All of them mean
|
|
* "debug on" - so all of them enable the extra logging below. */
|
|
%if "&_debug"="2477" or "&_debug"="fields,log,trace" or "&_debug"="131"
|
|
or "&_debug"="128"
|
|
%then %do;
|
|
%let sasjs_mdebug=1;
|
|
%end;
|
|
|
|
%if "&sasjs_mdebug"="1" %then %do;
|
|
%if %sysfunc(exist(work.browser_url_vars)) %then %do;
|
|
data _null_;
|
|
length name value $1024;
|
|
set work.browser_url_vars;
|
|
putlog "NOTE: &sysmacroname: work.browser_url_vars:";
|
|
putlog name= value=;
|
|
run;
|
|
%end;
|
|
%else %put NOTE: &sysmacroname: no work.browser_url_vars on this request;
|
|
%if %sysfunc(exist(work.browser_info)) %then %do;
|
|
data _null_;
|
|
set work.browser_info;
|
|
putlog "NOTE: &sysmacroname: work.browser_info:";
|
|
putlog (_all_)(=);
|
|
run;
|
|
%end;
|
|
%else %put NOTE: &sysmacroname: no work.browser_info on this request;
|
|
%end;
|
|
|
|
%mend mpeinit;
|