mirror of
https://github.com/sasjs/lint.git
synced 2026-01-16 08:40:05 +00:00
feat: updating docs for gremlin capabilities
This commit is contained in:
10
README.md
10
README.md
@@ -29,6 +29,7 @@ Configuration is via a `.sasjslint` file with the following structure (these are
|
|||||||
"lowerCaseFileNames": true,
|
"lowerCaseFileNames": true,
|
||||||
"maxLineLength": 80,
|
"maxLineLength": 80,
|
||||||
"noNestedMacros": true,
|
"noNestedMacros": true,
|
||||||
|
"noGremlins": true,
|
||||||
"noSpacesInFileNames": true,
|
"noSpacesInFileNames": true,
|
||||||
"noTabs": true,
|
"noTabs": true,
|
||||||
"noTrailingSpaces": true,
|
"noTrailingSpaces": true,
|
||||||
@@ -125,6 +126,15 @@ We strongly recommend a line length limit, and set the bar at 80. To turn this f
|
|||||||
- Default: 80
|
- Default: 80
|
||||||
- Severity: WARNING
|
- 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
|
### 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.
|
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.
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
"indentationMultiple": 2,
|
"indentationMultiple": 2,
|
||||||
"lowerCaseFileNames": true,
|
"lowerCaseFileNames": true,
|
||||||
"maxLineLength": 80,
|
"maxLineLength": 80,
|
||||||
|
"noGremlins": true,
|
||||||
"noNestedMacros": true,
|
"noNestedMacros": true,
|
||||||
"noSpacesInFileNames": true,
|
"noSpacesInFileNames": true,
|
||||||
"noTabs": true,
|
"noTabs": true,
|
||||||
@@ -29,6 +30,7 @@
|
|||||||
"noSpacesInFileNames": true,
|
"noSpacesInFileNames": true,
|
||||||
"lowerCaseFileNames": true,
|
"lowerCaseFileNames": true,
|
||||||
"maxLineLength": 80,
|
"maxLineLength": 80,
|
||||||
|
"noGremlins": true,
|
||||||
"noTabs": true,
|
"noTabs": true,
|
||||||
"indentationMultiple": 4,
|
"indentationMultiple": 4,
|
||||||
"hasMacroNameInMend": true,
|
"hasMacroNameInMend": true,
|
||||||
@@ -68,7 +70,7 @@
|
|||||||
"$id": "#/properties/noGremlins",
|
"$id": "#/properties/noGremlins",
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"title": "noGremlins",
|
"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],
|
"default": [true],
|
||||||
"examples": [true, false]
|
"examples": [true, false]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import { LintRuleType } from '../../types/LintRuleType'
|
|||||||
import { Severity } from '../../types/Severity'
|
import { Severity } from '../../types/Severity'
|
||||||
|
|
||||||
const name = 'noGremlins'
|
const name = 'noGremlins'
|
||||||
const description = 'Disallow characters specified in grimlins array'
|
const description = 'Disallow characters specified in gremlins array'
|
||||||
const message = 'Line contains a grimlin'
|
const message = 'Line contains a gremlin'
|
||||||
|
|
||||||
const test = (value: string, lineNumber: number, config?: LintConfig) => {
|
const test = (value: string, lineNumber: number, config?: LintConfig) => {
|
||||||
const severity = config?.severityLevel[name] || Severity.Warning
|
const severity = config?.severityLevel[name] || Severity.Warning
|
||||||
@@ -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 = {
|
export const noGremlins: LineLintRule = {
|
||||||
type: LintRuleType.Line,
|
type: LintRuleType.Line,
|
||||||
|
|||||||
Reference in New Issue
Block a user