Files
dc/sas/sasjs/targets/sas9/services_meta/usernav/usermembersbyrole.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

60 lines
2.0 KiB
SAS

/**
@file usermembersbyrole.sas
@brief List the members of a role
<h4> SAS Macros </h4>
@li mpeinit.sas
@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()
data sasMembers sasgroups;
attrib uriGrp uriMem roleId roleName Group_or_Role MemberName MemberType
MemberUpdated membercreated emailuri length=$64
roleDesc email length=$256
rcGrp rcMem rc i j length=3;
call missing (of _all_);
set iwant;
i=1;
* Grab the URI for the first Group ;
rcGrp=metadata_getnobj(roleid,i,uriGrp);
* If Group found, enter do loop ;
if rcGrp>0 then do;
call missing (rcMem,uriMem,roleId,roleName,Group_or_Role
,MemberName,MemberType,roleDesc);
* get group info ;
rc = metadata_getattr(uriGrp,"Id",roleId);
rc = metadata_getattr(uriGrp,"Name",roleName);
rc = metadata_getattr(uriGrp,"PublicType",Group_or_Role);
rc = metadata_getattr(uriGrp,"Desc",roleDesc);
j=1;
if Group_or_Role='Role' then do while
(metadata_getnasn(uriGrp,"MemberIdentities",j,uriMem) > 0);
call missing (MemberName,MemberType);
call missing(email,emailuri);
rc = metadata_getattr(uriMem,"Name",MemberName);
rc = metadata_getattr(uriMem,"PublicType",MemberType);
rc=metadata_getattr(uriMem, "MetadataCreated", MemberCreated);
rc=metadata_getattr(uriMem, "MetadataUpdated", MemberUpdated);
emailrc=metadata_getnasn(uriMem,"EmailAddresses",1,emailuri);
if (emailrc>0) then rc=metadata_getattr(emailuri,"Address",email);
if membertype='UserGroup' then output sasgroups;
else output sasmembers;
j+1;
end;
end;
if _n_=1 then delete; /* no roles so don't send empty row */
keep uriMem membertype membername MemberCreated MemberUpdated email;
run;
%webout(OPEN)
%webout(OBJ,sasGroups)
%webout(OBJ,sasMembers)
%webout(CLOSE)