-
Notifications
You must be signed in to change notification settings - Fork 38
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
Expand ameba's functionality with semantic information #513
Comments
Other rule ideas possible with top level semantic (not saying these should be done, but that they could be):
|
This will just need to be left up to an LSP using ameba, and not something we should worry about.
Any issues found in a file that's excluded should be ignored, like how it is currently (except for For another rule idea, I run into this issue a lot: class MessageHandler
def on_request(msg)
# generic message handling
end
def on_request(msg : SpecificRequestType)
# specific message handling
end
end If I accidentally mistype One of the biggest issues I see with Crystal currently is that no semantic analysis is done to code that isn't used. This means when developing library code, unless you write good specs (and know you have to write good specs), you can have semantic issues in your code and have no idea until someone else goes to use it. It would be useful to have some level of semantic analysis for methods, such that explicitly typed things can be checked to make sure their methods actually exist. For example: def hello(a : String)
a.method_doesnt_exist
# ^^^^^^^^^^^^^^^^^^^ error: `String` doesn't have method `method_doesnt_exist`
end If the rule runs into a method that isn't typed, we don't do anything beyond that. The only types this should infer is from literals or methods whose return types are specified. It should be fast, not exhaustive. |
Currently ameba uses only the stdlib parser in order to provide an AST for the rules to operate over. This is useful, but limits the kinds of things that ameba can be used for. This is an issue to discuss if semantic information to ameba, what that would look like, and what are the downsides / tradeoffs to different approaches. For instance, if we added a top level semantic pass:
Excluded
in.ameba.yml
?Typing/{Instance,Class}VarTypeRestriction
- currently running into potential issues where an instance var could be typed somewhere, but just not in the current file, leading to a failureLint/UnusedVariable
and othersThe text was updated successfully, but these errors were encountered: