Ignore single and multiline comments for RegexChecker

15 views
Skip to first unread message

indu

unread,
May 15, 2017, 12:39:28 PM5/15/17
to Scalastyle users
Hi,
I am using RegexChecker for checking hard coding of url in my code with level="error". The RegexChecker gives error for urls in comments also. Is there any property like ignoreComments to ignore regex checking in comments. It would be really helpful if there is any way to ignore comments when using RegexChecker.

Thanks

Matthew Farwell

unread,
May 17, 2017, 3:56:59 AM5/17/17
to scalasty...@googlegroups.com
Hi,

No, there isn't an option like that. RegexChecker is a bit of a catch-all. To do what you asked in a checker, you would need to parse the file (to remove the comments) and then recreate the file, in order to do the regex matching.

What you could do is have a more sophisticated regex, which only matches items which don't start with //

Any ou can use scalastyle:ignore as well of course

Matthew Farwell.


--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes Scalastyle users.
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse scalastyle-users+unsubscribe@googlegroups.com.
Pour envoyer un message à ce groupe, adressez un e-mail à scalastyle-users@googlegroups.com.
Visitez ce groupe à l'adresse https://groups.google.com/group/scalastyle-users .
Pour plus d'options, visitez le site https://groups.google.com/d/optout .

Reply all
Reply to author
Forward
0 new messages