mirror of
https://github.com/appium/appium.git
synced 2026-02-24 12:20:05 -06:00
refactor: change if in else to else if (#21353)
This commit is contained in:
committed by
GitHub
parent
88e3a3cbe2
commit
0d59bf81cf
@@ -84,20 +84,18 @@ export class DriverConfig extends ExtensionConfig {
|
||||
err: 'Missing or incorrect supported platformNames list.',
|
||||
val: platformNames,
|
||||
});
|
||||
} else if (_.isEmpty(platformNames)) {
|
||||
problems.push({
|
||||
err: 'Empty platformNames list.',
|
||||
val: platformNames,
|
||||
});
|
||||
} else {
|
||||
if (_.isEmpty(platformNames)) {
|
||||
problems.push({
|
||||
err: 'Empty platformNames list.',
|
||||
val: platformNames,
|
||||
});
|
||||
} else {
|
||||
for (const pName of platformNames) {
|
||||
if (!_.isString(pName)) {
|
||||
problems.push({
|
||||
err: 'Incorrectly formatted platformName.',
|
||||
val: pName,
|
||||
});
|
||||
}
|
||||
for (const pName of platformNames) {
|
||||
if (!_.isString(pName)) {
|
||||
problems.push({
|
||||
err: 'Incorrectly formatted platformName.',
|
||||
val: pName,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,20 +240,17 @@ export class ExtensionConfig {
|
||||
for (const summary of errorSummaries) {
|
||||
log.error(summary);
|
||||
}
|
||||
} else {
|
||||
} else if (!_.isEmpty(warningSummaries)) {
|
||||
// only display warnings if there are no errors!
|
||||
|
||||
if (!_.isEmpty(warningSummaries)) {
|
||||
log.warn(
|
||||
`Appium encountered ${util.pluralize(
|
||||
'warning',
|
||||
warningMap.size,
|
||||
true
|
||||
)} while validating ${this.extensionType}s found in manifest ${this.manifestPath}`
|
||||
);
|
||||
for (const summary of warningSummaries) {
|
||||
log.warn(summary);
|
||||
}
|
||||
log.warn(
|
||||
`Appium encountered ${util.pluralize(
|
||||
'warning',
|
||||
warningMap.size,
|
||||
true
|
||||
)} while validating ${this.extensionType}s found in manifest ${this.manifestPath}`
|
||||
);
|
||||
for (const summary of warningSummaries) {
|
||||
log.warn(summary);
|
||||
}
|
||||
}
|
||||
return exts;
|
||||
|
||||
@@ -390,19 +390,17 @@ export class Manifest {
|
||||
if (err.code === 'ENOENT') {
|
||||
data = _.cloneDeep(INITIAL_MANIFEST_DATA);
|
||||
shouldWrite = true;
|
||||
} else if (this.#manifestPath) {
|
||||
throw new Error(
|
||||
`Appium had trouble loading the extension installation ` +
|
||||
`cache file (${this.#manifestPath}). It may be invalid YAML. Specific error: ${
|
||||
err.message
|
||||
}`
|
||||
);
|
||||
} else {
|
||||
if (this.#manifestPath) {
|
||||
throw new Error(
|
||||
`Appium had trouble loading the extension installation ` +
|
||||
`cache file (${this.#manifestPath}). It may be invalid YAML. Specific error: ${
|
||||
err.message
|
||||
}`
|
||||
);
|
||||
} else {
|
||||
throw new Error(
|
||||
`Appium encountered an unknown problem. Specific error: ${err.message}`
|
||||
);
|
||||
}
|
||||
throw new Error(
|
||||
`Appium encountered an unknown problem. Specific error: ${err.message}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -296,12 +296,10 @@ async function getImagesMatches(img1Data, img2Data, options = {}) {
|
||||
matches = matches.filter((match) =>
|
||||
goodMatchesFactor(match.distance, minDistance, maxDistance)
|
||||
);
|
||||
} else {
|
||||
if (matches.length > goodMatchesFactor) {
|
||||
matches = matches
|
||||
.sort((match1, match2) => match1.distance - match2.distance)
|
||||
.slice(0, goodMatchesFactor);
|
||||
}
|
||||
} else if (matches.length > goodMatchesFactor) {
|
||||
matches = matches
|
||||
.sort((match1, match2) => match1.distance - match2.distance)
|
||||
.slice(0, goodMatchesFactor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user