Skip to content

[Linting Rule] Non Ascii Code

github-actions[bot] edited this page Nov 1, 2026 · 1 revision

Generated from 'wiki-linter.ts' on 2026-10-25, 09:29:25 UTC (v2.16.6), do not edit directly.

Non-ASCII Code [overview]

smell cmd-check 36, 44 quickfix

This rule ports the following steps of R CMD check (see the conformance table for the legend):

# Step Coverage Note
36 code files for non-ASCII characters (book) 🟩⭐ ⭐ also reports each token instead of each file, escapes strings as a quick fix
44 package namespace information (book) 🔶

This rule is a best-effort rule.

Finds non-ASCII characters in R code and the NAMESPACE outside of comments. Offers \u escapes for strings as a quick fix.
This linting rule is implemented in src/linter/rules/cmd-check/non-ascii-code.ts.

Configuration

Linting rules can be configured by passing a configuration object to the linter query as shown in the example below. The non-ascii-code rule accepts the following configuration options:

  • checkStrings
    report string literals holding non-ASCII characters (default true, as R CMD check does)
    R CMD check #36
  • checkSymbols
    report symbols holding non-ASCII characters (default true, as R CMD check does)
    R CMD check #36

Examples

escaped <- function() message("Gr\u00fc\u00dfe")
literal <- function() message("Grüße")

The linting query can be used to run this rule on the above example:

[ { "type": "linter",   "rules": [ { "name": "non-ascii-code",     "config": {} } ] } ]

Results (prettified and summarized):

Query: linter (2 ms)
   ╰ Non-ASCII Code (non-ascii-code):
       ╰ certain:
           ╰ non-ASCII string ["ü","ß"] at 2.31-37 (1 quick fix(es) available)

More examples are the test cases in test/functionality/linter/cmd-check/lint-non-ascii-code.test.ts.

Clone this wiki locally