Skip to content

Commit

Permalink
refactor: Don't use static set for matchedPatterns
Browse files Browse the repository at this point in the history
The matchedPatterns are only relevant for the current lint run and
should not be stored in a static set that won't be cleared between
multiple lint runs in the same process. There doesn't seem to be a need
to have the set statically available.
  • Loading branch information
matz3 committed Nov 7, 2024
1 parent fa3574c commit d2b97ac
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/linter/linter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ import type {AbstractReader, Resource} from "@ui5/fs";
import ConfigManager, {UI5LintConfigType} from "../utils/ConfigManager.js";
import {Minimatch} from "minimatch";

// Internal analytical variable that will store matchers' count.
// We cannot predict the outcome of the matchers, so stash usage statistics
// and later analyze the results from it.
const matchedPatterns = new Set<string>();

export async function lintProject({
rootDir, filePatterns, ignorePattern, reportCoverage, includeMessageDetails, configPath, ui5ConfigPath,
}: LinterOptions): Promise<LintResult[]> {
Expand Down Expand Up @@ -128,6 +123,11 @@ async function lint(
// Resolve files to include
filePatterns = filePatterns ?? config.files ?? [];

// We cannot predict the outcome of the matchers, so we remember the used patterns
// and later compare them against the provided filePatterns to find patterns
// that didn't match any file
const matchedPatterns = new Set<string>();

// Resolve ignores
ignorePattern = [
...(config.ignores ?? []),
Expand Down

0 comments on commit d2b97ac

Please sign in to comment.