Open Bug 1637669 Opened 5 years ago Updated 2 years ago

Unhelpful error from rustfmt linter when rustfmt is not installed

Categories

(Developer Infrastructure :: Lint and Formatting, defect, P3)

Unspecified
Windows 10

Tracking

(Not tracked)

People

(Reporter: molly, Unassigned)

References

(Regression)

Details

(Keywords: regression)

I tried to lint some Rust files using mach lint --workdir without realizing that I didn't actually have the rustfmt component installed, and I got this output:

error: problem with lint setup, skipping android-api-lint, android-checkstyle, android-javadoc, android-lint, android-test
Traceback (most recent call last):
  File "c:\Users\mhowell\source\repos\mozilla-central\python/mozlint\mozlint\roller.py", line 60, in _run_worker
    res = func(paths, config, **lintargs) or []
  File "c:\Users\mhowell\source\repos\mozilla-central\python/mozlint\mozlint\types.py", line 54, in __call__
    return self._lint(paths, config, **lintargs)
  File "c:\Users\mhowell\source\repos\mozilla-central\python/mozlint\mozlint\types.py", line 139, in _lint
    return func(files, config, **lintargs)
  File "c:\Users\mhowell\source\repos\mozilla-central\tools\lint\rust\__init__.py", line 144, in lint
    actual_version = get_rustfmt_version(binary)
  File "c:\Users\mhowell\source\repos\mozilla-central\tools\lint\rust\__init__.py", line 127, in get_rustfmt_version
    version = re.findall(r'\d.\d+.\d+', output)[0]
IndexError: list index out of range
Traceback (most recent call last):
  File "c:\Users\mhowell\source\repos\mozilla-central\python/mozlint\mozlint\roller.py", line 60, in _run_worker
    res = func(paths, config, **lintargs) or []
  File "c:\Users\mhowell\source\repos\mozilla-central\python/mozlint\mozlint\types.py", line 54, in __call__
    return self._lint(paths, config, **lintargs)
  File "c:\Users\mhowell\source\repos\mozilla-central\python/mozlint\mozlint\types.py", line 139, in _lint
    return func(files, config, **lintargs)
  File "c:\Users\mhowell\source\repos\mozilla-central\tools\lint\rust\__init__.py", line 144, in lint
    actual_version = get_rustfmt_version(binary)
Traceback (most recent call last):
  File "c:\Users\mhowell\source\repos\mozilla-central\tools\lint\rust\__init__.py", line 127, in get_rustfmt_version
    version = re.findall(r'\d.\d+.\d+', output)[0]
  File "c:\Users\mhowell\source\repos\mozilla-central\python/mozlint\mozlint\roller.py", line 60, in _run_worker
    res = func(paths, config, **lintargs) or []
IndexError: list index out of range
  File "c:\Users\mhowell\source\repos\mozilla-central\python/mozlint\mozlint\types.py", line 54, in __call__
    return self._lint(paths, config, **lintargs)
  File "c:\Users\mhowell\source\repos\mozilla-central\python/mozlint\mozlint\types.py", line 139, in _lint
    return func(files, config, **lintargs)
  File "c:\Users\mhowell\source\repos\mozilla-central\tools\lint\rust\__init__.py", line 144, in lint
    actual_version = get_rustfmt_version(binary)
  File "c:\Users\mhowell\source\repos\mozilla-central\tools\lint\rust\__init__.py", line 127, in get_rustfmt_version
    version = re.findall(r'\d.\d+.\d+', output)[0]
IndexError: list index out of range
A failure occurred in the rust linter.
✖ 1 problem (0 errors, 0 warnings, 1 failure)

which does not exactly lead one to the source of the problem. Running rustup component add rustfmt did fix it, but ideally the linter would be able to run that for me, or at least produce a more helpful error.

Regressed by: 1551078
Has Regression Range: --- → yes
Keywords: regression

Bugbug thinks this bug is a defect, but please change it back in case of error.

Type: enhancement → defect
Severity: -- → S3
Priority: -- → P3
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.