File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -184,6 +184,16 @@ String doubleWhitespace(Select sel) {
184
184
result .getValue ( ) .regexpMatch ( ".*\\s\\s.*" )
185
185
}
186
186
187
+ /**
188
+ * Gets an expression that repeats the alert-loc as a link.
189
+ */
190
+ VarAccess getAlertLocLink ( Select sel ) {
191
+ result = sel .getExpr ( 0 ) .( VarAccess ) .getDeclaration ( ) .getAnAccess ( ) and
192
+ exists ( int msgIndex | sel .getExpr ( msgIndex ) = sel .getMessage ( ) |
193
+ result = sel .getExpr ( any ( int i | i > msgIndex ) )
194
+ )
195
+ }
196
+
187
197
from AstNode node , string msg , Select sel
188
198
where
189
199
not node .getLocation ( ) .getFile ( ) .getAbsolutePath ( ) .matches ( "%/test/%" ) and
@@ -218,5 +228,8 @@ where
218
228
or
219
229
node = doubleWhitespace ( sel ) and
220
230
msg = "Avoid using double whitespace in alert messages."
231
+ or
232
+ node = getAlertLocLink ( sel ) and
233
+ msg = "Don't repeat the alert location as a link."
221
234
)
222
235
select node , msg
You can’t perform that action at this time.
0 commit comments