-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
adjusting content of rubocop messages for educational purposes #2028
Comments
Unfortunately, there's no such way. This was discussed in the past, but no progress was made. See #799 |
thanks @bbatsov - when you say there is no such way, you mean the current code doesn't support it rather than impossible right? I notice that if I modify the StyleGuide parameter in enabled.yml I can adjust which URL gets associated with the report:
So I can point to an alternate article if I want to:
Clearly the description can be modified in the config file as well - can that also be printed out somehow? I don't care so much about being able to change the error messages per se, just being able to add some "more details text", like so:
Might this be easier, more practical to support? We've got a very strong use case for this with students developers. I read the previous discussion and it seemed to fizzle out on not having a good reason to proceed rather than a technical challenge. We have a great reason (novices often need slightly more verbose messages than experts), and the rubocop config seems set up to all this sort of parameter configuration. Is there more documentation on what other parameters can be used in the cops? I've read https://github.com/bbatsov/rubocop#generic-configuration-parameters but it doesn't mention the StyleGuide or Description parameters and I can't find any other reference to those two in the README. I'm trying to get something similar working with the reek project troessner/reek#589 where we are considering using internationalization features to support custom messages, but I'm guessing there's actually less work to support similar in rubocop, since it's already set up to make the contents of the config available to the cop ... |
It's possible, but all the messages for every cop have to be extracted in the config, which is a lot of work. And, of course, people should be careful when they edit them, as many of those messages are used as templates for the final messages that you'll see. |
right, so adding an optional details parameter might be simpler then? |
Yeah, something like this would be simpler for sure. |
thanks @bbatsov so what would the process be to get some kind of optional details parameter into rubocop? |
would it be okay to re-open this issue for discussion @bbatsov ? |
Or you can cook some PR and we can discuss it. |
sure - any tips on where to start in the code? Do you guys have anything other than the general pull request guidelines? https://github.com/bbatsov/rubocop/blob/master/CONTRIBUTING.md#pull-requests anything about how the codebase is laid out? tips for starting on working on it? |
@tansaku I would recommend you start looking at Cop#annotate_message where URLs are added to messages under certain conditions. Do something similar for a new |
thanks @jonas054 that was really helpful - rough draft pull request submitted ... |
apologies for random question, but using reek in an educational context, is there a way to configure differences to the content of the rubocop mesages?
For example, say that for education purposes we wanted to be able to modify:
to
would there be a simple way to do this without modifying source code?
The text was updated successfully, but these errors were encountered: