Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues while using Google Closure Compiler on plotly-cartesian-1.57.1.js #5289

Closed
COLLINETTEBastien opened this issue Nov 17, 2020 · 3 comments
Labels
bug something broken

Comments

@COLLINETTEBastien
Copy link

Hello !

I didn't know if I had to post this in the forum or here, but since I think that what I found could result in fixes, I have chosen to post this here.
I am using plotly-cartesian-1.57.1.js (which is currently the latest version of Plotly Cartesian) not minified and I tried Google's Closure Compiler on it.
It resulted what might be some issues in the code :

-line 584: unreachable code
return false;
That return may be unnecessary since it's just after an if-else condition that both throw an error.

-line 3807: Suspicious code. The result of the 'not' operator is not being used.
!function() {
Is the ! necessary?

-line 69736: Suspicious code. This code lacks side-effects. Is there a bug?
if(!locale) locale === 'en-US';
-line 69736: Suspicious code. The result of the 'sheq' operator is not being used.
if(!locale) locale === 'en-US';
Shouldn't it be if(!locale) locale = 'en-US'; instead?

-line 87184: unreachable code
for(i = 0; i < traces.length; i++) {
Since this for loop contains a break; that cannot be avoided, is it relevant to use a for loop to only do things with i==0 while i < traces.length?

Is it me that (surely) didn't understand what the code does at these lines or these are real issues / oversights?

As always, thank you very much for your hard work!

@archmoj
Copy link
Contributor

archmoj commented Nov 19, 2020

-line 584: unreachable code
return false;
That return may be unnecessary since it's just after an if-else condition that both throw an error.

Thanks for the analysis.
For this one we should possibly open a PR to glslify-deps to bump the version of events.
├─┬ [email protected]
│ └─┬ [email protected]
│ └── [email protected]

@archmoj
Copy link
Contributor

archmoj commented Nov 19, 2020

-line 3807: Suspicious code. The result of the 'not' operator is not being used.
!function() {
Is the ! necessary?

This one related to d3 (v3).
See https://github.com/d3/d3/blob/9cc9a875e636a1dcf36cc1e07bdf77e1ad6e2c74/src/start.js

@archmoj
Copy link
Contributor

archmoj commented Nov 19, 2020

-line 3807: Suspicious code. The result of the 'not' operator is not being used.
!function() {
Is the ! necessary?

This one related to d3 (v3).
See https://github.com/d3/d3/blob/9cc9a875e636a1dcf36cc1e07bdf77e1ad6e2c74/src/start.js

And I don't see that used in d3 v5 or v6 until we could bump d3. cc: #424

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
Development

No branches or pull requests

3 participants