Skip to content
Snippets Groups Projects
Commit f618b306 authored by Rhys Arkins's avatar Rhys Arkins
Browse files

refactor: sort errors and warnings alphabetically

parent 3257bf73
No related merge requests found
...@@ -244,5 +244,14 @@ async function validateConfig(config, isPreset, parentPath) { ...@@ -244,5 +244,14 @@ async function validateConfig(config, isPreset, parentPath) {
} }
} }
} }
function sortAll(a, b) {
if (a.depName === b.depName) {
return a.message > b.message;
}
// istanbul ignore next
return a.depName > b.depName;
}
errors.sort(sortAll);
warnings.sort(sortAll);
return { errors, warnings }; return { errors, warnings };
} }
...@@ -4,11 +4,11 @@ exports[`config/validation validateConfig(config) errors for all types 1`] = ` ...@@ -4,11 +4,11 @@ exports[`config/validation validateConfig(config) errors for all types 1`] = `
Array [ Array [
Object { Object {
"depName": "Configuration Error", "depName": "Configuration Error",
"message": "Invalid semver range for allowedVersions: \`foo\`", "message": "Configuration option \`lockFileMaintenance\` should be a json object",
}, },
Object { Object {
"depName": "Configuration Error", "depName": "Configuration Error",
"message": "Configuration option \`enabled\` should be boolean. Found: 1 (number)", "message": "Invalid semver range for allowedVersions: \`foo\`",
}, },
Object { Object {
"depName": "Configuration Error", "depName": "Configuration Error",
...@@ -16,7 +16,7 @@ Array [ ...@@ -16,7 +16,7 @@ Array [
}, },
Object { Object {
"depName": "Configuration Error", "depName": "Configuration Error",
"message": "timezone: Invalid timezone: Asia", "message": "Invalid regExp for packageRules[3].excludePackagePatterns: \`abc ([a-z]+) ([a-z]+))\`",
}, },
Object { Object {
"depName": "Configuration Error", "depName": "Configuration Error",
...@@ -28,11 +28,11 @@ Array [ ...@@ -28,11 +28,11 @@ Array [
}, },
Object { Object {
"depName": "Configuration Error", "depName": "Configuration Error",
"message": "Configuration option \`lockFileMaintenance\` should be a json object", "message": "Configuration option \`enabled\` should be boolean. Found: 1 (number)",
}, },
Object { Object {
"depName": "Configuration Error", "depName": "Configuration Error",
"message": "extends: Invalid timezone: Europe/Brussel", "message": "Configuration option \`packageRules[3].packagePatterns\` should be a list (Array)",
}, },
Object { Object {
"depName": "Configuration Error", "depName": "Configuration Error",
...@@ -40,11 +40,11 @@ Array [ ...@@ -40,11 +40,11 @@ Array [
}, },
Object { Object {
"depName": "Configuration Error", "depName": "Configuration Error",
"message": "Configuration option \`packageRules[3].packagePatterns\` should be a list (Array)", "message": "extends: Invalid timezone: Europe/Brussel",
}, },
Object { Object {
"depName": "Configuration Error", "depName": "Configuration Error",
"message": "Invalid regExp for packageRules[3].excludePackagePatterns: \`abc ([a-z]+) ([a-z]+))\`", "message": "packageRules must contain JSON objects",
}, },
Object { Object {
"depName": "Configuration Error", "depName": "Configuration Error",
...@@ -52,27 +52,27 @@ Array [ ...@@ -52,27 +52,27 @@ Array [
}, },
Object { Object {
"depName": "Configuration Error", "depName": "Configuration Error",
"message": "packageRules must contain JSON objects", "message": "timezone: Invalid timezone: Asia",
}, },
] ]
`; `;
exports[`config/validation validateConfig(config) ignore packageRule nesting validation for presets 1`] = `Array []`; exports[`config/validation validateConfig(config) ignore packageRule nesting validation for presets 1`] = `Array []`;
exports[`config/validation validateConfig(config) returns deprecation warnings 1`] = ` exports[`config/validation validateConfig(config) invalid matchCurrentVersion triggers an error 1`] = `
Array [ Array [
Object { Object {
"depName": "Deprecation Warning", "depName": "Configuration Error",
"message": "Direct editing of prTitle is now deprecated. Please edit commitMessage subcomponents instead as they will be passed through to prTitle.", "message": "packageRules: >= 2.-1.4 isn't a valid semver",
}, },
] ]
`; `;
exports[`config/validation validateConfig(config) invalid matchCurrentVersion triggers an error 1`] = ` exports[`config/validation validateConfig(config) returns deprecation warnings 1`] = `
Array [ Array [
Object { Object {
"depName": "Configuration Error", "depName": "Deprecation Warning",
"message": "packageRules: >= 2.-1.4 isn't a valid semver", "message": "Direct editing of prTitle is now deprecated. Please edit commitMessage subcomponents instead as they will be passed through to prTitle.",
}, },
] ]
`; `;
...@@ -85,11 +85,11 @@ Array [ ...@@ -85,11 +85,11 @@ Array [
}, },
Object { Object {
"depName": "Configuration Error", "depName": "Configuration Error",
"message": "Unsafe regExp for packageRules[0].excludePackagePatterns: \`(x+x+)+y\`", "message": "Invalid configuration option: \`lockFileMaintenance.bar\`",
}, },
Object { Object {
"depName": "Configuration Error", "depName": "Configuration Error",
"message": "Invalid configuration option: \`lockFileMaintenance.bar\`", "message": "Unsafe regExp for packageRules[0].excludePackagePatterns: \`(x+x+)+y\`",
}, },
] ]
`; `;
...@@ -98,11 +98,11 @@ exports[`config/validation validateConfig(config) selectors outside packageRules ...@@ -98,11 +98,11 @@ exports[`config/validation validateConfig(config) selectors outside packageRules
Array [ Array [
Object { Object {
"depName": "Configuration Error", "depName": "Configuration Error",
"message": "packageNames: packageNames should be inside a \`packageRule\` only", "message": "docker.minor.packageNames: packageNames should be inside a \`packageRule\` only",
}, },
Object { Object {
"depName": "Configuration Error", "depName": "Configuration Error",
"message": "docker.minor.packageNames: packageNames should be inside a \`packageRule\` only", "message": "packageNames: packageNames should be inside a \`packageRule\` only",
}, },
] ]
`; `;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment