Skip to content

Commit 12c304f

Browse files
committed
chore: revert
1 parent e6aa931 commit 12c304f

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

lib/inputs/file-pattern/static.ts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,20 @@ 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+
*/
812
function generatePathMatcher(
913
globsInclude: string[],
1014
globsExclude: string[],
1115
): (filePath: string) => boolean {
1216
return (filePath: string): boolean => {
13-
let exclude = false;
14-
for (const g of globsExclude) {
15-
if (!exclude && minimatch(filePath, g)) {
16-
exclude = true;
17-
}
18-
}
19-
if (!exclude) {
20-
for (const g of globsInclude) {
21-
if (minimatch(filePath, g)) {
22-
return true;
23-
}
24-
}
17+
if (globsExclude.some((glob) => minimatch(filePath, glob))) {
18+
return false;
2519
}
26-
return false;
20+
21+
return globsInclude.some((glob) => minimatch(filePath, glob));
2722
};
2823
}
2924

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-
if (line.length === 0) {
18+
// there's no point in calling the regex if the line is a comment
19+
if (line.length === 0 || line.startsWith("#")) {
1920
return null;
2021
}
2122
const parsedLine = VERSION_PARSE_REGEX.exec(line);
2223
if (!parsedLine?.groups) {
2324
return null;
2425
}
2526
const { name, extras, specifier, version } = parsedLine.groups;
26-
const correctedSpecifier = specifierValidRange(specifier, version);
2727
return {
2828
name: name.toLowerCase(),
29-
specifier: correctedSpecifier,
29+
specifier: specifierValidRange(specifier, version),
3030
version,
3131
extras: parseExtraNames(extras),
3232
} as PythonRequirement;

0 commit comments

Comments
 (0)