Skip to content

P1B: Refactor (src/groups/user.js): Function with many returns (count = 6) #62

@FaizFarooqMoazam

Description

@FaizFarooqMoazam

Uniqueness check

  • I have searched open issues and confirmed this file + smell is not already taken.

Full path to the JavaScript file

src/groups/user.js

Function(s)/scope targeted

module.exports

Relevant Qlty output

Function with many returns (count = 6): exports

           6  module.exports = function (Groups) {
           7    Groups.getUsersFromSet = async function (set, fields = []) {
           8            const uids = await db.getSetMembers(set);
           9            const userData = await user.getUsersFields(uids, fields);
          10            return userData.filter(u => u && u.uid);
          11    };
              [hid 52 additional lines]

The issue here is that there are numerous exit points, making the code much harder to follow.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions