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 734569 - Add option to disable extra warnings
Add option to disable extra warnings
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
1.41.x
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2014-08-09 21:50 UTC by Lionel Landwerlin
Modified: 2014-08-13 07:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
console: add --no-extra-warnings option (5.61 KB, patch)
2014-08-09 21:51 UTC, Lionel Landwerlin
reviewed Details | Review
context: add GJS_DISABLE_EXTRA_WARNING env variable to disable mozjs' extra warnings (1.31 KB, patch)
2014-08-11 18:31 UTC, Lionel Landwerlin
committed Details | Review

Description Lionel Landwerlin 2014-08-09 21:50:24 UTC
Extra warnings are an optional flag you can set on the MozJs engine.
They generate a fair amount of warning with code generated from the CoffeeScript compiler like these :

'function anonymous does not always return a value'
'test for equality (==) mistyped as assignment (=)?'
'variable path redeclares argument'

All of these are important messages you want see if you're writing JavaScript code, but less so when you're writing code that gets compiled to JavaScript. In this case you probably rely on the compiler to do the right thing (tm).

Here is a patch to opt out of extra warnings.
Comment 1 Lionel Landwerlin 2014-08-09 21:51:07 UTC
Created attachment 283023 [details] [review]
console: add --no-extra-warnings option
Comment 2 Colin Walters 2014-08-11 14:22:19 UTC
Review of attachment 283023 [details] [review]:

I think in general an environment variable is better for this; easier to handle for developers locally.  Similar to G_DEBUG_MESSAGES=all etc.

Presumably though at least some of these are things the coffeescript people could easily fix.
Comment 3 Lionel Landwerlin 2014-08-11 16:10:03 UTC
I agree with you on fixing the CoffeeScript compiler, but that turns out to be a pretty tricky thing to do.
CoffeeScript tries to look like a functional language, return automatically the last expression/statement. As a result most developers don't really bother putting an empty "return" statement at the end of their functions.

I will rework the patch to make it a environment variable.
Comment 4 Lionel Landwerlin 2014-08-11 18:31:59 UTC
Created attachment 283129 [details] [review]
context: add GJS_DISABLE_EXTRA_WARNING env variable to disable mozjs' extra warnings
Comment 5 Colin Walters 2014-08-13 01:56:07 UTC
Review of attachment 283129 [details] [review]:

Looks fine to me.
Comment 6 Lionel Landwerlin 2014-08-13 07:10:18 UTC
Thanks!