1
0
mirror of https://github.com/sasjs/lint.git synced 2026-01-10 05:50:05 +00:00

feat(lint): add rules for lowercase file names, max line length and no tab indentation

This commit is contained in:
Krishna Acondy
2021-03-26 09:09:42 +00:00
parent 1be358ca51
commit 3631f5c25c
15 changed files with 265 additions and 12 deletions

View File

@@ -1,4 +1,5 @@
import { lintText } from './lint'
import { lintFile, lintText } from './lint'
import path from 'path'
/**
* Example which tests a piece of text with all known violations.
@@ -30,8 +31,8 @@ const text = `/**
%macro mf_getuniquelibref(prefix=mclib,maxtries=1000);
%local x libref;
%let x={SAS002};
%local x libref;
%let x={SAS002};
%do x=0 %to &maxtries;
%if %sysfunc(libref(&prefix&x)) ne 0 %then %do;
%let libref=&prefix&x;
@@ -44,6 +45,15 @@ const text = `/**
%end;
%put unable to find available libref in range &prefix.0-&maxtries;
%mend;
`
lintText(text).then((diagnostics) => console.table(diagnostics))
lintText(text).then((diagnostics) => {
console.log('Text lint results:')
console.table(diagnostics)
})
lintFile(path.join(__dirname, 'Example File.sas')).then((diagnostics) => {
console.log('File lint results:')
console.table(diagnostics)
})