Custom Inspection Rule

I am writing an PHP MVC application, that is using Bootstrap 4. I would like to check if all my <a> tags with the class btn have the role="button" attribute.

 

Is there a way to create such an inspection?

2 comments
Comment actions Permalink

You can try the following template:

<a $class$=$value$ $role$=$button$>$text$</a>

where

text/regexp for $class$ is class, min and max counts are 1

text/regexp for $value$ is ^(.*?(\bbtn\b)[^$]*)$, min and max counts are 1

text/regexp for $role$ is role, min and max counts are 0

text/regexp for $button$ is button, min and max counts are 1

text/regexp for $text$ is empty, min and max counts are 0 and 1 respectively

 

0
Comment actions Permalink

WOW! You just blew my mind!

0

Please sign in to leave a comment.