forked from camaraproject/QualityOnDemand
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e89865b
commit 3b9b50e
Showing
1 changed file
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
const reservedWords = [ | ||
'abstract', | ||
'apiclient', | ||
'apiexception', | ||
'apiresponse', | ||
'assert', | ||
'boolean', | ||
'break', | ||
'byte', | ||
'case', | ||
'catch', | ||
'char', | ||
'class', | ||
'configuration', | ||
'const', | ||
'continue', | ||
'default', | ||
'do', | ||
'double', | ||
'else', | ||
'enum', | ||
'extends', | ||
'file', | ||
'final', | ||
'finally', | ||
'float', | ||
'for', | ||
'goto', | ||
'if', | ||
'implements', | ||
'import', | ||
'instanceof', | ||
'int', | ||
'interface', | ||
'list', | ||
'localdate', | ||
'localreturntype', | ||
'localtime', | ||
'localvaraccept', | ||
'localvaraccepts', | ||
'localvarauthnames', | ||
'localvarcollectionqueryparams', | ||
'localvarcontenttype', | ||
'localvarcontenttypes', | ||
'localvarcookieparams', | ||
'localvarformparams', | ||
'localvarheaderparams', | ||
'localvarpath', | ||
'localvarpostbody', | ||
'localvarqueryparams', | ||
'long', | ||
'native', | ||
'new', | ||
'null', | ||
'object', | ||
'offsetdatetime', | ||
'package', | ||
'private', | ||
'protected', | ||
'public', | ||
'return', | ||
'short', | ||
'static', | ||
'strictfp', | ||
'stringutil', | ||
'super', | ||
'switch', | ||
'synchronized', | ||
'this', | ||
'throw', | ||
'throws', | ||
'transient', | ||
'try', | ||
'void', | ||
'volatile', | ||
'while' | ||
]; | ||
|
||
export default async function (input) { | ||
|
||
// Iterate over properties of the input object | ||
for (const path in input) { | ||
|
||
if (typeof path === 'string') { | ||
for (const word of reservedWords) { | ||
const regex = new RegExp(`\\b${word}\\b`, 'g'); // Use a regular expression to match 'word' as a standalone word | ||
|
||
if (regex.test(path)) { | ||
console.log(`Warn: Reserved words found in input: '${path}' Consider avoiding the use of reserved word '${word}'. `); | ||
} | ||
} | ||
} | ||
} | ||
} |