Is there anyway to automatically find I18N violations in a Grails project? For example,
<td valign="top" class="name"><label for="enabled">Enabled:</label></td>
should be flagged because it's not using <g:message>
to get the label value.
It would be nice if codenarc had a rule for this, but I don't think it does.
I have also looked for such a code quality test and have yet to find one.
Implementing this should be fairly trivial - if all text content in a GSP is required to be applied via tags, your GSP should consist entirely of element nodes and no text nodes.
This crux of the problem is predominantly an XML issue: how do you check a set of XML documents and flag those that contain text nodes?
Assuming you can import org.codehaus.groovy.grails.commons.GrailsResourceUtils
in a codenarc rule you can use the VIEWS_DIR_PATH
property to determine where all the GSP files live.
From there, the high level process you would need is:
I appreciate that this is a very high level solution but conceptually it should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With