After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 751146 - coverage: Don't warn about executing odd lines by default anymore
coverage: Don't warn about executing odd lines by default anymore
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
1.43.x
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2015-06-18 10:40 UTC by Sam Spilsbury
Modified: 2017-01-06 07:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
coverage: Suppress warnings about executing odd lines by default. (6.39 KB, patch)
2015-06-18 10:40 UTC, Sam Spilsbury
committed Details | Review
coverage: Add a testcase to be sure that strings inside case statements don't change the default executing behavior (1.68 KB, patch)
2015-06-18 10:41 UTC, Sam Spilsbury
committed Details | Review

Description Sam Spilsbury 2015-06-18 10:40:50 UTC
Created attachment 305538 [details] [review]
coverage: Suppress warnings about executing odd lines by default.

We use some internal Reflect machinery in order to detect executable lines in a file. This agrees with the JS engine most of the time, but there will be times when it won't quite align.

In most testing, I've found that the remaining cases where it doesn't aren't really cases that matter. For instance, we don't mark lines like the following as executable:

function f(a, b) {

There are some cases where execution might start on the line afterwards and some cases where execution might start on the function definition itself.

In any case, we don't care - we only care about the code inside the function.

The default behavior so far has been to warn when this happens and just count the line as executed. Now that we've caught most of the legitimately bad cases, I propose turning the warning off, as the rest is just noise. The code for the warnings is still there and can be turned on with GJS_DEBUG_COVERAGE_UNEXECUTED_LINES
Comment 1 Sam Spilsbury 2015-06-18 10:41:27 UTC
Created attachment 305539 [details] [review]
coverage: Add a testcase to be sure that strings inside case statements don't change the default executing behavior
Comment 2 Cosimo Cecchi 2015-06-18 19:15:17 UTC
Review of attachment 305539 [details] [review]:

OK
Comment 3 Cosimo Cecchi 2015-06-18 19:16:57 UTC
Review of attachment 305538 [details] [review]:

::: modules/coverage.js
@@ +742,3 @@
  * It isn't poissible to unit test this class because it depends on running
  * Debugger which in turn depends on objects injected in from another compartment */
+function CoverageStatistics(prefixes, cache, suppress_warnings) {

I think this parameter is called the wrong way, as it will have the effect of not suppressing the warnings.
Comment 4 Philip Chimento 2017-01-06 07:29:28 UTC
Comment on attachment 305539 [details] [review]
coverage: Add a testcase to be sure that strings inside case statements don't change the default executing behavior

This was already committed as part of some other patch, apparently.
Comment 5 Philip Chimento 2017-01-06 07:32:32 UTC
Fixed up the parameter name and pushed.