Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Renovate Bot
renovate
Commits
f618b306
Commit
f618b306
authored
6 years ago
by
Rhys Arkins
Browse files
Options
Downloads
Patches
Plain Diff
refactor: sort errors and warnings alphabetically
parent
3257bf73
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/config/validation.js
+9
-0
9 additions, 0 deletions
lib/config/validation.js
test/config/__snapshots__/validation.spec.js.snap
+18
-18
18 additions, 18 deletions
test/config/__snapshots__/validation.spec.js.snap
with
27 additions
and
18 deletions
lib/config/validation.js
+
9
−
0
View file @
f618b306
...
@@ -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
};
}
}
This diff is collapsed.
Click to expand it.
test/config/__snapshots__/validation.spec.js.snap
+
18
−
18
View file @
f618b306
...
@@ -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",
},
},
]
]
`;
`;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment