<div dir="ltr"><div class="gmail_extra">On Fri, Jul 7, 2017 at 12:15 PM, Ehsan Akhgari <span dir="ltr"><<a href="mailto:ehsan.akhgari@gmail.com" target="_blank">ehsan.akhgari@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">FWIW years ago I decided to act on trying to detect some of the patterns indicated on that page automatically, see <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=649012" rel="noreferrer" target="_blank">https://bugzilla.mozilla.org/s<wbr>how_bug.cgi?id=649012</a>.  It didn't use linting (because we didn't really have any linting support back then) but the idea is the same, just with a different syntax.  That project never really received much (well, any!) traction since I always was hoping that people would triage the initial set of "opt-out" annotations that it landed with, and do something about those tests, but that never happened.  But hopefully this helped a bit by plugging one of the holes in terms of the unintended sources of intermittent oranges.<br>
<br>In this case the way to opt out was adding a single line to the test.  This wasn't hard per se, but if my memory serves it used to trip people for quite a while, even though the failure message you would get if you forgot to do it would indicate how to opt out of the extra check.  In hindsight, I think some people may have found the check more annoying than helpful, because in the cases where it helps, you'd get green tests, so nobody would consciously know that this is helping and in the cases where it would get in your way, people would be rightfully unhappy since their workflow got disturbed.<br></blockquote><div><br></div><div>I forgot mochitest already checks for flaky timeouts! Maybe people would
 be less opposed to a lint rule as many teams (especially frontend) have
 already ingrained eslint into their workflows and know how to deal with
 enabling/disabling rules. I guess in the setTimeout
 case we'd need to 
choose one or the other, either eslint or requestFlakyTimeout. Doing 
both at once would be a pain for developers. Fwiw, the eslint rule for 
no-arbitrary-setTimeout turned out to be pretty easy to implement.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
 1. Do any of the other patterns on that page look feasible to<br>
    implement as linters?<br>
<br>
</blockquote>
I always struggled with this one.  Not many of them are, in my opinion.  The example of using Date()s is, for example, but in my experience that is a super rare cause of intermittent failures...  A lot of these require some kind of dynamic check at runtime, and aren't easily detectible by just looking at the code of the test without running it.<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
 1. Are there additional things not listed on that page that we could<br>
    lint for?<br>
<br>
</blockquote>
Almost certainly.  Ideally when people fix an intermittent orange, they would think about whether this was a pattern that could reappear in other places, and whether it could be detected using a linter.  It is unclear to me how many of these new unique patterns we encounter though.  (For example, *many* intermittent oranges boil down to code expecting the wrong ordering of events, and that's not easily detectible using a linter....  But there may be a long tail of super rare error cases that are detectible using linters.)<br>
<br>
Hope this helps,<br>
Ehsan<br></blockquote><div><br></div><div>Thanks for the insight. If we can block maybe 1 or 2 major causes of intermittents with this, I'd be pretty happy. Maybe the bigger benefit of this would be laying a foundation for adding new such linters in the future, even if they only avoid minor causes of intermittents.</div><div><br></div><div>-Andrew<br></div></div></div><div class="gmail_extra"><br></div></div>