Alert: Too many erros. (XX% scanned).

edited March 2016 in p5.js

I have a sketch with 2 files: sketch.js and a second Javascript file for some object constructors and functions. At approximately 74% of length of the Javascript file (line 468 out of 625) the p5 editor gives the alert: Too many errors. (74% scanned)..

toomanyerros

If I try to keep all of the code at sketch.js it gives the same alert (Too many errors. (71% scanned).) at 71% of the file (line 481 out of 675 which isn't the same line of code).

toomanyerrors2

p5 editor doesn't give any other alert or error.

If I use "use strict" this alert disappears and it gives alerts on every line containing a p5.js function, variable or constant.

In any case, the sketch runs as expected.

The console only displays: Uncaught ReferenceError: require is not defined which is present any time I run a p5.js sketch.

I'm using p5 editor Version 0.5.10 on Windows 10.

Does anyone know what can cause this Too many errors. alert?

Tagged:

Answers

  • I've never installed that IDE. Nonetheless, it's worth checking out how well the web version works:
    http://p5ide.HerokuApp.com/editor

    Anyways, here's the repo for the editor: https://GitHub.com/processing/p5.js-editor

  • edited March 2016
  • edited March 2016

    Strange. I haven't seen any errors nor warnings.
    Actually it's run w/o any problems whatsoever! >-)

    Win 7 w/ 64-bit SlimJet browser v7.0.8.0 (based on Chromium 47.0.2526.73)

  • I got this on Chrome:

    toomanyerrorsweb

    And yes, the code runs without any problems on both editors.

    I'm just curious about what can be causing this too many errors.

  • edited March 2016 Answer ✓
    • Oh, forgot to load "delaunay.js" tab. After that I've got the same "warning" too. :^o
    • Perhaps it's some limit to its too strict lint parser.
    • It throws warnings even for missing ; semicolons for goodness' sake! 8-}
    • As we should know, JS doesn't need any semicolons. So I did some experiments.
    • I've removed some ; before line #468 and it triggered that semicolon warning.
    • Funnily, after line #468, no warnings are triggered for any kind of errors! :@)
  • Perhaps it's some limit to its too strict lint parser.

    Indeed, when I googled the error, what I have found was related to JSLint/JSHint stopping scanning the file after finding more than 50 errors.

    I've put all of the code of delaunay.js inside a self invoking function (obviously, the sketch doesn't run if I do that) to test for possible warnings about me polluting the global space and indeed, it scanned 93% of the file.

    Then I've tried to comment some parts of the code and each time it could scan a bigger portion of the file.

    I was expecting it to display the 50 or fewer errors once it reached 100% of the file, but when the warning disappeared it didn't show any other warning.

    I guess the lint parser is strict, but the editor doesn't show every warning it gets.

    I still find it weird that the warning disappears when I use strict mode though.

  • I guess the lint parser is strict, but the editor doesn't show every warning it gets.

    I've played with JSHint Options trying to find out what warnings p5.js is hiding.

    There may be others, but the only one that I've found was strict.

    • When I add //jshint strict: false on the beginning of the file it doesn't give any warning;
    • When I don't use it, the percentage of the file scanned increases each time I add "use strict"; to a function.

    So basically, I have too many errors, even though it isn't showing any error, because it's asking me to use Strict mode on every single scope, but these warnings are hidden.

    This explains why the warning disappears when I use Strict mode.

    So, the options for me to be able to have warnings on the entire file (not only until line 468) are:

    • Use Strict mode;
    • Disable warnings when I don't use strict mode with //jshint strict: false;
    • Increase the maximum amount of warnings (that seems to be 100 by default on p5.js) with //jshint maxerr: 200.
  • Perhaps it's some limit to its too strict lint parser.

    As you discovered: it's exactly this. This is a standard result when you run a JSLinter that you haven't configured yourself :)

    JS is a fairly forgiving language in principle; and linting errors are often as much about coding style as actual syntax errors - and even some of those the language tolerates - e.g. semi-colons are almost always inserted automatically in the right place...

    So basically you can:

    • (perhaps) configure the linter to what suits your coding style
    • configure and run JSLint elsewhere
    • fix the 'errors' - if you can find them
    • just ignore them...

    I will be very amused if the P5 editor linter is (correctly) reporting as a problem the dreadful scope issues in the p5js code... If so, using instance mode should solve this.

Sign In or Register to comment.