Skip to content

Commit 873d74e

Browse files
Copilotdmichon-msft
andcommitted
Improve documentation and add clarifying comments
Co-authored-by: dmichon-msft <[email protected]>
1 parent 065ef10 commit 873d74e

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

libraries/rush-lib/src/logic/operations/ShellOperationRunnerPlugin.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,26 +183,26 @@ export function getCustomParameterValuesForOperation(): (
183183
function getCustomParameterValuesForOp(operation: Operation): ICustomParameterValuesForOperation {
184184
const { associatedPhase: phase, settings } = operation;
185185

186-
// Get or compute the set of all custom parameters for this phase
187-
let customParameterSet: Set<string> | undefined = customParametersByPhase.get(phase);
188-
if (!customParameterSet) {
189-
customParameterSet = collectPhaseParameterArguments(phase);
190-
customParametersByPhase.set(phase, customParameterSet);
191-
}
192-
193-
// If there are no parameters to ignore, return early with all parameters
186+
// Check if there are any parameters to ignore
194187
const parameterNamesToIgnore: string[] | undefined = settings?.parameterNamesToIgnore;
195188
if (!parameterNamesToIgnore || parameterNamesToIgnore.length === 0) {
189+
// No filtering needed - use the cached parameter set for efficiency
190+
let customParameterSet: Set<string> | undefined = customParametersByPhase.get(phase);
191+
if (!customParameterSet) {
192+
customParameterSet = collectPhaseParameterArguments(phase);
193+
customParametersByPhase.set(phase, customParameterSet);
194+
}
195+
196196
return {
197197
parameterValues: Array.from(customParameterSet),
198198
ignoredParameterNames: []
199199
};
200200
}
201201

202-
// Create a set of parameter long names to ignore for fast lookup
202+
// Filtering is needed - we must iterate through parameter objects to check longName
203+
// Note: We cannot use the cached parameter set here because we need access to
204+
// the parameter objects to get their longName property for filtering
203205
const ignoreSet: Set<string> = new Set(parameterNamesToIgnore);
204-
205-
// Filter out ignored parameters and track which ones were ignored
206206
const filteredParameterValues: string[] = [];
207207
const ignoredParameterNames: string[] = [];
208208

libraries/rush-lib/src/schemas/rush-project.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
},
114114
"parameterNamesToIgnore": {
115115
"type": "array",
116-
"description": "An optional list of custom command-line parameter names (their parameterLongName values from command-line.json) that should be ignored when invoking the command for this operation. This allows a project to opt out of parameters that don't affect its operation, preventing unnecessary cache invalidation for this operation and its consumers.",
116+
"description": "An optional list of custom command-line parameter names that should be ignored when invoking the command for this operation. The parameter names should match the exact longName field values from the command-line.json parameters array (e.g., '--production', '--verbose'). This allows a project to opt out of parameters that don't affect its operation, preventing unnecessary cache invalidation for this operation and its consumers.",
117117
"items": {
118118
"type": "string"
119119
},

0 commit comments

Comments
 (0)