Closed Bug 1476652 Opened 6 years ago Closed 6 years ago

Convert lodash .omit(), .invert() and .mapValues() to native ES6 JS

Categories

(Tree Management :: Treeherder: Frontend, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: soundharya, Assigned: SirR4T)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Blocks: 1466494
needs review.

Added a

   arg.filter(x => !!x)

instead of 

   _.omit(arg, [undefined])
Assignee: nobody → sarat.addepalli
Status: NEW → ASSIGNED
Attachment #8996627 - Flags: review?(cdawson)
Since _.omit, _.invert, and _.mapValues are used only once in the treeherder code base,
and since all three relate to building an inverted map of buildbot buildername to taskcluster tasklabel,

I propose that Bugs 1476652, 1468308 and 1476243 be merged as one, so that this can be tackled in one place.

I suggest the code should be converted to the following:


                    const builderToTask = {};
                    Object.entries(graph).forEach(([key, value]) => {
                        if (value && value.task && value.task.payload && value.task.payload.buildername) {
                            builderToTask[value.task.payload.buildername] = key;
                        }
                    });
That sounds fine to me - happy for you to update the existing PR (amend the commit locally including commit message, then force push to the same branch, then update the PR title etc).
Cool! done. Although i'm not sure if the PR title in GitHub will be picked up by autolander to mark all the three bugs.
Summary: Convert lodash .omit() to native ES6 JS → Convert lodash .omit(), .invert() and .mapValues() to native ES6 JS
Left review feedback in the PR. :)
thanks! in hindsight, reduce obviously! fixed and pushed.
Commit pushed to master at https://github.com/mozilla/treeherder

https://github.com/mozilla/treeherder/commit/44032ff5185049ebf9ccb412c3b17067db6d1d2d
Bug 1476652 1468308 1476243 - _.omit, _.invert, _.mapValues to ES6 (#3859)

Since _.omit, _.invert, and _.mapValues are all used only once in
the treeherder codebase, for building a map of buildbot buildername
to taskcluster tasklabel, this commit fixes all the three at once
instead of three different bugs.

Related Bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1476652
- https://bugzilla.mozilla.org/show_bug.cgi?id=1468308
- https://bugzilla.mozilla.org/show_bug.cgi?id=1476243
Attachment #8996627 - Flags: review?(cdawson) → review+
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: