If nested functions had return, they were counted in the parent function too. This is because a simple regexp on the body of the function was done, therefore counting the child too. Now, the function parser, instead of just checking whether there is at least one return, counts them.
This reverts commit ad497c4.
Trying to fix issue #43 Not sure if what is done makes sense because I have no test scripts to run a use cases. For now, just testing if the line contains a long string which is at least MAX - 10, if yes then no error is returned.
When visiting functions, we now keep track correctly of the nesting (was inverted until now), so that we can report variable declaration in the right function as we go. Also, now, when reporting an identifier usage, we go up the nesting hierarchy to report the usage up to the right function were it was first declared
Now, the reviewer takes an optional argument which is the working dir. When running cleanjs from the command line, or when running the unit tests, then this argument is not set, because the normal getcwd() returns what is needed. In the case of sublime and appengine website, then this argument is set to the proper value so that the file can be found.
Also fixed small problem when syntax error
First of all, when a function accesses its `lines`, they now get filtered correctly. `lines.all_lines` used to return all lines of the file the function was in. Now that's working fine. Also, the start/end position of the functions was not calculated correctly. Fixed this too.
Now reviewers don't have hard-coded messages in them, they get passed a config_reader in the constructor and must use it to retrieve message strings and (in the future) other configuration. This is based on the ConfigReader module found in python
It now outputs less warnings. It was warning the user starting at 2 of these words only.
Fixes #31 var fs = require("fs") In the above case, it's fine that variable is named fs because this is a pattern in nodejs (and other common module implementations) The parser will check that A/ it's a require function call, and B/ that the name of the module corresponds to the name of the var
Issue #33 is partially fixed with this, although a far better solution would be to count the number of vars per function at parsing time rather than regexping the content
Works the same as for arguments and variables inside functions. Fixes #12
The parser now extract the list of this.... class properties And then, the 'unused' reviewer checks all lines to see whether these properties are used or not. This will typically fail if there are 2 classes in the same file that have a property named the same. But hey, that's the first implementation. It will require true class parsing to be perfect. And the thing is, true class parsing is hard to achieve knowing all those frameworks out there that have their own way of declaring classes. Anyway, this is the first step for #12