Skip to content

Commit

Permalink
feat: updating docs for gremlin capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan Bowe committed Dec 26, 2022
1 parent 80c90eb commit 7de9070
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Configuration is via a `.sasjslint` file with the following structure (these are
"lowerCaseFileNames": true,
"maxLineLength": 80,
"noNestedMacros": true,
"noGremlins": true,
"noSpacesInFileNames": true,
"noTabs": true,
"noTrailingSpaces": true,
Expand Down Expand Up @@ -125,6 +126,15 @@ We strongly recommend a line length limit, and set the bar at 80. To turn this f
- Default: 80
- Severity: WARNING

### noGremlins

Capture zero-width whitespace and other non-standard characters. The logic is borrowed from the [VSCode Gremlins Extension](https://github.com/nhoizey/vscode-gremlins) - if you are looking for more advanced gremlin zapping capabilities, we highly recommend to use their extension instead.

The list of characters can be found in this file: [https://github.com/sasjs/lint/blob/main/src/rules/line/noGremlins.ts](https://github.com/sasjs/lint/blob/main/src/rules/line/noGremlins.ts)

- Default: true
- Severity: WARNING

### noNestedMacros

Where macros are defined inside other macros, they are recompiled every time the outer macro is invoked. Hence, it is widely considered inefficient, and bad practice, to nest macro definitions.
Expand Down
4 changes: 3 additions & 1 deletion sasjslint-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"indentationMultiple": 2,
"lowerCaseFileNames": true,
"maxLineLength": 80,
"noGremlins": true,
"noNestedMacros": true,
"noSpacesInFileNames": true,
"noTabs": true,
Expand All @@ -29,6 +30,7 @@
"noSpacesInFileNames": true,
"lowerCaseFileNames": true,
"maxLineLength": 80,
"noGremlins": true,
"noTabs": true,
"indentationMultiple": 4,
"hasMacroNameInMend": true,
Expand Down Expand Up @@ -68,7 +70,7 @@
"$id": "#/properties/noGremlins",
"type": "array",
"title": "noGremlins",
"description": "",
"description": "Captures problematic characters such as zero-width whitespace and others that look valid but usually are not (such as the en dash)",
"default": [true],
"examples": [true, false]
},
Expand Down
6 changes: 3 additions & 3 deletions src/rules/line/noGremlins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { LintRuleType } from '../../types/LintRuleType'
import { Severity } from '../../types/Severity'

const name = 'noGremlins'
const description = 'Disallow characters specified in grimlins array'
const message = 'Line contains a grimlin'
const description = 'Disallow characters specified in gremlins array'
const message = 'Line contains a gremlin'

const test = (value: string, lineNumber: number, config?: LintConfig) => {
const severity = config?.severityLevel[name] || Severity.Warning
Expand Down Expand Up @@ -45,7 +45,7 @@ const test = (value: string, lineNumber: number, config?: LintConfig) => {
}

/**
* Lint rule that checks if a given line of text contains any grimlin.
* Lint rule that checks if a given line of text contains any gremlins.
*/
export const noGremlins: LineLintRule = {
type: LintRuleType.Line,
Expand Down

0 comments on commit 7de9070

Please sign in to comment.