Skip to content

Commit 8b3ba38

Browse files
committed
changes based on review
1 parent 88f1d2a commit 8b3ba38

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

docs/query-metadata-style-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ The select clause of each alert query defines the alert message that is displaye
179179
* The message should factually describe the problem that is being highlighted–it should not contain recommendations about how to fix the problem or value judgements.
180180
* Program element references should be in 'single quotes' to distinguish them from ordinary words. Quotes are not needed around substitutions (`$@`).
181181
* Avoid constant alert message strings and include some context, if possible. For example, `The class 'Foo' is duplicated as 'Bar'.` is preferable to `This class is duplicated here.`
182-
* If a reference to the current location can't be avoided use "this location" instead of "here". For example, `Bad thing at this location.` is preferable to `Bad thing here.`.
182+
* If a reference to the current location can't be avoided use "this location" instead of "here". For example, `Bad thing at this location.` is preferable to `Bad thing here.`. This avoids the "click here" anti-pattern.
183183
* Where you reference another program element, link to it if possible using a substitution (`$@`). Links should be used inline in the sentence, rather than as parenthesised lists or appositions.
184184
* When a message contains multiple links, construct a sentence that has the most variable link (that is, the link with most targets) last. For further information, see [Defining the results of a query](https://codeql.github.com/docs/writing-codeql-queries/defining-the-results-of-a-query/).
185185
* Make link texts as concise and precise as possible. E.g. avoid starting a link text with an indefinite article (a, an). For example `Path construction depends on a [user-provided value]` is preferable to `Path construction depends on [a user-provided value]`. (Where the square brackets indicate a link.) See [the W3C guide on link texts](https://www.w3.org/WAI/WCAG22/Understanding/link-purpose-in-context.html) for further information.

ql/ql/src/queries/style/AlertMessage.ql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,11 @@ where
176176
or
177177
exists(string part | node = avoidHere(part) |
178178
part = "here" and
179-
msg = "Avoid using the phrase \"" + part + "\" in alert messages."
179+
msg =
180+
"Try to use a descriptive phrase instead of \"here\". Use \"this location\" if you can't get around mentioning the current location."
180181
or
181-
part != "here" and
182-
msg = "Try to avoid using the phrase \"" + part + "\" in alert messages if possible."
182+
part = "this location" and
183+
msg = "Try to more descriptive phrase instead of \"this location\" if possible."
183184
)
184185
or
185186
node = avoidArticleInLinkText(_) and

0 commit comments

Comments
 (0)