Closed Bug 1391699 Opened 7 years ago Closed 7 years ago

Add eslint rule to catch missing breaks in switches

Categories

(Remote Protocol :: Marionette, enhancement)

Version 3
enhancement
Not set
normal

Tracking

(firefox57 fixed)

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: ato, Assigned: ato)

Details

Attachments

(1 file)

As a follow-up to https://bugzilla.mozilla.org/show_bug.cgi?id=1254136, we want to eslint to catch missing break statements in switches to avoid similar future bugs.
Assignee: nobody → ato
Status: NEW → ASSIGNED
Comment on attachment 8898922 [details]
Bug 1391699 - Disallow fallthrough case statements.

https://reviewboard.mozilla.org/r/170288/#review175776

::: testing/marionette/.eslintrc.js:16
(Diff revision 1)
>      }],
>      "max-len": ["error", 78, {
>        "ignoreStrings": true,
>        "ignoreUrls": true,
>      }],
> +    "no-fallthrough": "error",

So this only applies when you have at least one line of code for a case? I see a couple of instances when we have fall-throughs but case lines are right after each other.
Comment on attachment 8898922 [details]
Bug 1391699 - Disallow fallthrough case statements.

https://reviewboard.mozilla.org/r/170288/#review175822
Attachment #8898922 - Flags: review?(dburns) → review+
(In reply to Henrik Skupin (:whimboo) from comment #2)

> So this only applies when you have at least one line of code for a
> case? I see a couple of instances when we have fall-throughs but
> case lines are right after each other.

Yes, it assumes this is intentional use of fall through.
Pushed by atolfsen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a5add563d059
Disallow fallthrough case statements. r=automatedtester
https://hg.mozilla.org/mozilla-central/rev/a5add563d059
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: