Skip to content

Commit 1e080f2

Browse files
committed
chore: revert out of scope files
1 parent f59fe4a commit 1e080f2

File tree

3 files changed

+24
-16
lines changed

3 files changed

+24
-16
lines changed

lib/analyzer/image-inspector.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ async function pullWithDockerBinary(
4848
password: string | undefined,
4949
platform: string | undefined,
5050
): Promise<boolean> {
51+
let pullAndSaveSuccessful = false;
5152
try {
5253
if (username || password) {
5354
debug(
@@ -56,12 +57,13 @@ async function pullWithDockerBinary(
5657
}
5758
await docker.pullCli(targetImage, { platform });
5859
await docker.save(targetImage, saveLocation);
59-
return true;
60+
return (pullAndSaveSuccessful = true);
6061
} catch (err) {
6162
debug(`couldn't pull ${targetImage} using docker binary: ${err.message}`);
63+
6264
handleDockerPullError(err.stderr, platform);
6365

64-
return false;
66+
return pullAndSaveSuccessful;
6567
}
6668
}
6769

@@ -79,9 +81,10 @@ function handleDockerPullError(err: string, platform?: string) {
7981
"manifest unknown",
8082
];
8183
if (unknownManifestConditions.some((value) => err.includes(value))) {
82-
throw new Error(
83-
`The image does not exist for ${platform ?? "the current platform"}`,
84-
);
84+
if (platform) {
85+
throw new Error(`The image does not exist for ${platform}`);
86+
}
87+
throw new Error(`The image does not exist for the current platform`);
8588
}
8689

8790
if (err.includes("invalid reference format")) {

lib/inputs/file-pattern/static.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,25 @@ import { ExtractAction, ExtractedLayers } from "../../extractor/types";
55
import { streamToString } from "../../stream-utils";
66
import { ManifestFile } from "../../types";
77

8-
/**
9-
* Return false if any exclusion pattern matches,
10-
* return true if any inclusion pattern matches
11-
*/
128
function generatePathMatcher(
139
globsInclude: string[],
1410
globsExclude: string[],
1511
): (filePath: string) => boolean {
1612
return (filePath: string): boolean => {
17-
if (globsExclude.some((glob) => minimatch(filePath, glob))) {
18-
return false;
13+
let exclude = false;
14+
for (const g of globsExclude) {
15+
if (!exclude && minimatch(filePath, g)) {
16+
exclude = true;
17+
}
1918
}
20-
21-
return globsInclude.some((glob) => minimatch(filePath, glob));
19+
if (!exclude) {
20+
for (const g of globsInclude) {
21+
if (minimatch(filePath, g)) {
22+
return true;
23+
}
24+
}
25+
}
26+
return false;
2227
};
2328
}
2429

lib/python-parser/requirements-parser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ export function getRequirements(fileContent: string): PythonRequirement[] {
1515

1616
function parseLine(line: string): PythonRequirement | null {
1717
line = line.trim();
18-
// there's no point in calling the regex if the line is a comment
19-
if (line.length === 0 || line.startsWith("#")) {
18+
if (line.length === 0) {
2019
return null;
2120
}
2221
const parsedLine = VERSION_PARSE_REGEX.exec(line);
2322
if (!parsedLine?.groups) {
2423
return null;
2524
}
2625
const { name, extras, specifier, version } = parsedLine.groups;
26+
const correctedSpecifier = specifierValidRange(specifier, version);
2727
return {
2828
name: name.toLowerCase(),
29-
specifier: specifierValidRange(specifier, version),
29+
specifier: correctedSpecifier,
3030
version,
3131
extras: parseExtraNames(extras),
3232
} as PythonRequirement;

0 commit comments

Comments
 (0)