Closed Bug 1392098 Opened 7 years ago Closed 7 years ago

Write a rule to remove cases of run_test that aren't needed

Categories

(Developer Infrastructure :: Lint and Formatting, enhancement)

3 Branch
enhancement
Not set
normal

Tracking

(firefox57 fixed)

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: standard8, Assigned: standard8)

Details

Attachments

(2 files)

Bug 982852 made run_test() in xpcshell tests optional. There's still quite a few cases where we do:

function run_test() {
  run_next_test();
}

despite the fact that xpcshell's head.js defines this for us. Hence this is just extra noise in test files.

I keep on coming across these (and cleaning them up), so I've decided it is time just to get a rule setup with fix capability and remove them completely.
Comment on attachment 8899277 [details]
Bug 1392098 - Enable the new ESLint no-useless-run-test rule across the tree.

https://reviewboard.mozilla.org/r/170516/#review176498
Attachment #8899277 - Flags: review?(dtownsend) → review+
Comment on attachment 8899276 [details]
Bug 1392098 - Add an ESLint rule to avoid unnecessary run_test() functions.

https://reviewboard.mozilla.org/r/170514/#review176500

Do you happen to know if eslint's test harness verifies that the fixer is producing valid code?
Attachment #8899276 - Flags: review?(dtownsend) → review+
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fde66058d330
Add an ESLint rule to avoid unnecessary run_test() functions. r=mossop
https://hg.mozilla.org/integration/autoland/rev/2dd4fb2e079a
Enable the new ESLint no-useless-run-test rule across the tree. r=mossop
Comment on attachment 8899276 [details]
Bug 1392098 - Add an ESLint rule to avoid unnecessary run_test() functions.

https://reviewboard.mozilla.org/r/170514/#review176500

I just did an experiment that left the closing brace of the function in the code - it correctly returned that there was a parsing error. I've also just seen in the documentation (https://eslint.org/docs/developer-guide/working-with-rules#applying-fixes):

```
After applying fixes, ESLint will run all of the enabled rules again on the fixed code, potentially applying more fixes. This process will repeat up to 10 times, or until no more fixable problems are found.
```
Product: Testing → Firefox Build System
Version: Version 3 → 3 Branch
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: