-
Notifications
You must be signed in to change notification settings - Fork 6
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
MB-10168-custom-linter-doc #49
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks great, thanks for putting it together!
I added some comments and suggestions, but am happy to discuss any of them more in depth if you'd like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making those updates! I just have a few more comments
|
||
The linter is actually analyzing an abstract syntax tree, AST, that represents code in a file. | ||
When your linter gets to a position in a file, where it catches an error, bug, or issue, it will flag this for the user. | ||
Because the linter is analyzing an AST, your code must be able to search through a file and mark which position it is when an issue is caught. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it would be good or not to include an example of what it looks like to mark a position with a message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like showing an example like this:
https://github.com/transcom/mymove/blob/d8d2b3862a28b344a1afdbb1a781d6529f04feb8/pkg/appcontext-linter/appctx.go#L46
To show that you call the .Pos()
method on an AST object to get its position and pass that along with a message to pass.Reportf
to report an issue found in the code. Maybe this is getting to specific though and they should just get that from reading the linked article on how to write the run
function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for making those changes. The only comment left is the one about .Pos()
, but I'll leave it up to you whether you want to include that or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Description:
In this document I wrote a how-to guide for creating Custom Go linters in MyMove and linked to resources that helped us write our linters.
Note for reviewer:
-Please leave feedback on how readable this guide is. Are the instructions clear? Is there anything missing?