npm-groovy-lint
Advanced tools
Comparing version 4.5.0 to 4.5.1
# Changelog | ||
## [4.5.1] 2020-04-28 | ||
- Fixes | ||
- Take in account user overridden indentation space (and other rules) when using --format option [#31](https://github.com/nvuillam/npm-groovy-lint/issues/31) | ||
## [4.5.0] 2020-04-24 | ||
@@ -4,0 +9,0 @@ |
@@ -34,9 +34,10 @@ // Configuration file management | ||
// Load configuration from identified file, or find config file from a start path | ||
async function loadConfig(startPathOrFile, mode = "lint", sourcefilepath, fileNames = []) { | ||
async function loadConfig(startPathOrFile, mode = "lint", sourcefilepath, fileNamesIn = []) { | ||
let fileNames = [...fileNamesIn]; | ||
// Load config | ||
let configUser = {}; | ||
if (configExtensions.includes(startPathOrFile.split(".").pop())) { | ||
if (configExtensions.includes(startPathOrFile.split(".").pop()) && mode !== "format") { | ||
// Sent file name | ||
configUser = await loadConfigFromFile(startPathOrFile); | ||
} else if (startPathOrFile.match(/^[a-zA-Z\d-_]+$/)) { | ||
} else if (startPathOrFile.match(/^[a-zA-Z\d-_]+$/) && mode !== "format") { | ||
// Sent string: file a corresponding file name | ||
@@ -63,2 +64,11 @@ fileNames = configExtensions.map(ext => `.groovylintrc-${startPathOrFile}.${ext}`); | ||
configUser = await manageExtends(configUser); | ||
// If mode = "format", call user defined rules to apply them upon the default formatting rules | ||
if (mode === "format") { | ||
const customUserConfig = await loadConfig(startPathOrFile, "lint", sourcefilepath, fileNamesIn); | ||
for (const ruleKey of Object.keys(customUserConfig)) { | ||
if (configUser[ruleKey]) { | ||
configUser[ruleKey] = customUserConfig[ruleKey]; | ||
} | ||
} | ||
} | ||
return configUser; | ||
@@ -65,0 +75,0 @@ } |
@@ -11,2 +11,6 @@ { | ||
"IfStatementCouldBeTernary": "off", | ||
"Indentation": { | ||
"spacesPerIndentLevel": 2, | ||
"severity": "info" | ||
}, | ||
"InvertedCondition": "off", | ||
@@ -13,0 +17,0 @@ "InvertedIfElse": "off", |
@@ -200,3 +200,23 @@ /** | ||
["failonerror", "failonwarning", "failoninfo"], | ||
["codenarcargs", ["failonerror", "failonwarning", "failoninfo", "path", "files", "source", "fix", "fixrules", "config"]], | ||
[ | ||
"codenarcargs", | ||
[ | ||
"failonerror", | ||
"failonwarning", | ||
"failoninfo", | ||
"path", | ||
"files", | ||
"source", | ||
"format", | ||
"fix", | ||
"fixrules", | ||
"config", | ||
"returnrules", | ||
"killserver", | ||
"nolintafter", | ||
"noserver", | ||
"serverhost", | ||
"serverport" | ||
] | ||
], | ||
["noserver", ["serverhost", "serverport", "killserver"]], | ||
@@ -207,5 +227,4 @@ ["fix", "format"], | ||
["failonerror", "failonwarning", "failoninfo"] | ||
], | ||
["format", "config"] | ||
] | ||
] | ||
}); |
{ | ||
"name": "npm-groovy-lint", | ||
"version": "4.5.0", | ||
"version": "4.5.1", | ||
"description": "NPM CodeNarc wrapper to easily lint Groovy files", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16386343
4990