Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: JAVASCRIPT-1.2
-
Component/s: JavaScript
-
Labels:None
-
Number of attachments :
Description
It's useless to put a break to default: and also a rule should exist that said that default: should be last. Right now the rule trigger on default due to no break statement.
Code example:
switch (this.weekCount) { case 0: case 1: this.viewStart = this.dayCount < 7 ? start: Dt.add(start, {days: -offset, clearTime: true}); return; case - 1: this.viewEnd = Dt.add(end, {days: 6 - end.getDay()}); return; default: this.viewStart = Dt.add(start, {days: -offset, clearTime: }
The rule to check that switch statement ends with the default clause already exists : javascript:SwitchWithoutDefault. So indeed we should just update the rule implementation to prevent firing a violation when the last clause doesn't contain the break statement.