- Notifications
You must be signed in to change notification settings - Fork196
New linter#299
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
nilnor wants to merge5 commits intoleafo:masterChoose a base branch fromnilnor:moonpick-linter
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Open
New linter#299
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
The new linter is capable of detecting a lot more possible issues withMoonscript compared to the current one. Similarly to the old linter, itdetects unused variables and undeclared global usages. It does howeverdetect unused declarations in a lot more contexts, such as import lists,destructuring statements, for loops, parameter lists, etc.The new linter also warns for shadowing declarations, i.e. a declarationof a variable where a previous declaration already exists higher up in ascope.
ContributorAuthor
nilnor commentedJun 13, 2017
Just a note: This is now out of date with the standalone moonpick implementation, which has had more checks added since the opening of this PR. |
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This replace the current linter with the newmoonpick linter. The new linter works against the parse tree instead of piggybacking on the compile process. Similarly to the old linter it detects global accesses and declared but unused variables. When it comes to unused variables it handles a lot more constructs, detecting unused variables resulting from destructuring statements, imports, etc. It also detects unused variables resulting from unused parameter declarations as well loop variable declarations. Another form of detection lacking altogether in the current linter is shadowing declarations, where a variable declaration of some sort shadows an existing declaration in an outer scope.
This PR removes the current
cmd.lintmodule, replacing it with a newlintmodule. It also adds alint_config.moonand updates the current code to be lint clean for the new linter (two separate commits).Things to consider / be aware of are:
cmd.lintmodule is removed. This was never advertised as a public API (AFAIK), but nonetheless it might have been used by other downstream projects.