Closed Bug 1303725 Opened 4 years ago Closed 4 years ago

Make mach eslint output more helpful in case of an error

Categories

(Firefox Build System :: Lint and Formatting, defect)

3 Branch
defect
Not set
normal

Tracking

(firefox52 fixed)

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: Fallen, Assigned: Fallen)

Details

Attachments

(1 file)

If eslint produces an error, the output is not JSON. Therefore mach produces this very unhelpful error that sends you hunting:

ValueError: No JSON object could be decoded

  File "/Users/kewisch/mozilla/comm/mozilla/tools/lint/mach_commands.py", line 60, in eslint
    linters=['eslint'], paths=paths, **kwargs)
  File "/Users/kewisch/mozilla/comm/mozilla/python/mach/mach/registrar.py", line 123, in dispatch
    return self._run_command_handler(handler, context=context, **kwargs)
  File "/Users/kewisch/mozilla/comm/mozilla/python/mach/mach/registrar.py", line 90, in _run_command_handler
    result = fn(**kwargs)
  File "/Users/kewisch/mozilla/comm/mozilla/tools/lint/mach_commands.py", line 42, in lint
    return cli.run(*runargs, **lintargs)
  File "/Users/kewisch/mozilla/comm/mozilla/python/mozlint/mozlint/cli.py", line 101, in run
    results = lint.roll(paths, rev=rev, workdir=workdir)
  File "/Users/kewisch/mozilla/comm/mozilla/python/mozlint/mozlint/roller.py", line 140, in roll
    for k, v in worker.get().iteritems():
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py", line 554, in get
    raise self._value

I have a patch prepared that adds a try/catch around the json loading and bails with the real output if an error occurs.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=dfe8935421b3
(contains a few other patches I am working on, let me know if you want a separate try run)
Comment on attachment 8792653 [details]
Bug 1303725 - Make mach eslint output more helpful in case of an error.

https://reviewboard.mozilla.org/r/79568/#review78438
Attachment #8792653 - Flags: review?(mratcliffe) → review+
Pushed by mozilla@kewis.ch:
https://hg.mozilla.org/integration/autoland/rev/fdfd1f5b3131
Make mach eslint output more helpful in case of an error. r=miker
https://hg.mozilla.org/mozilla-central/rev/fdfd1f5b3131
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Product: Testing → Firefox Build System
Version: Version 3 → 3 Branch
You need to log in before you can comment on or make changes to this bug.