Replace repeated `x.get(y) or {}` chaining with a safer accessor

Open
#6,629 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
backend

Research direction

Start by reading the repeated access patterns in services/hackbot-pulse-listener/app/{taskcluster,github,notify}.py and services/hackbot-api/app/{actions_applier,routers/events,phabricator_webhook,routers/webhooks}.py. Compare whether a shared accessor or parsing-boundary normalization best fits the existing flows. Done means the repeated defensive fallbacks are consistently replaced without changing optional-field behavior.

Written by the indexing model from the issue text.

Description

hackbot

This defensive-defaulting idiom is widespread, for example in services/hackbot-pulse-listener/app/{taskcluster,github,notify}.py and services/hackbot-api/app/{actions_applier,routers/events,phabricator_webhook,routers/webhooks}.py. Introduce a small helper, or normalize optional fields at the parsing boundary, instead of re-deriving {} fallbacks ad hoc throughout the codebase.

Dominant language
Python
Stars
570
Forks
351
Avg merge
2d 13h
Merged PRs (30d)
65

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mozilla/bugbug

All issues in mozilla/bugbug

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.