Skip to content

Commit 1978e10

Browse files
committed
PS: Remove extractor option to skip psmodule extraction.
1 parent 61796da commit 1978e10

File tree

3 files changed

+4
-34
lines changed

3 files changed

+4
-34
lines changed

powershell/codeql-extractor.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,4 @@ file_types:
1010
display_name: powershellscripts
1111
extensions:
1212
- .ps1
13-
- .psd1
14-
options:
15-
skip_psmodulepath_files:
16-
title: Skip PSModulePath files.
17-
description: Whether to avoid extracting source files in paths specified by the PSModulePath environment variable.
18-
type: string
19-
pattern: "^(false|true)$"
13+
- .psd1

powershell/extractor/Semmle.Extraction.PowerShell.Standalone/Options.cs

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Collections.Generic;
32
using System.IO;
43
using System.Linq;
@@ -121,24 +120,6 @@ private static FileInfo[] GetDefaultFiles()
121120
}
122121
}
123122

124-
/// <summary>
125-
/// Returns true if the extractor should skip files in the PSModulePath because the
126-
/// environment variable CODEQL_EXTRACTOR_POWERSHELL_OPTION_SKIP_PSMODULEPATH_FILES
127-
/// is set to a truthy value.
128-
/// </summary>
129-
private static bool GetDefaultSkipPSModulePathFiles()
130-
{
131-
var skip = System.Environment.GetEnvironmentVariable(
132-
"CODEQL_EXTRACTOR_POWERSHELL_OPTION_SKIP_PSMODULEPATH_FILES"
133-
);
134-
bool b = skip != null && skip.ToLower() != "false";
135-
if (b)
136-
{
137-
System.Console.WriteLine("Skipping files in PSModulePath");
138-
}
139-
return b;
140-
}
141-
142123
/// <summary>
143124
/// The directory or file containing the source code;
144125
/// </summary>
@@ -153,7 +134,7 @@ private static bool GetDefaultSkipPSModulePathFiles()
153134
/// Whether to extract files in the paths found in the `PSModulePath`
154135
/// environment variable.
155136
/// </summary>
156-
public bool SkipPSModulePathFiles { get; private set; } = GetDefaultSkipPSModulePathFiles();
137+
public bool SkipPSModulePathFiles { get; private set; } = false;
157138

158139
/// <summary>
159140
/// Whether errors were encountered parsing the arguments.
@@ -191,13 +172,9 @@ public static void ShowHelp(System.IO.TextWriter output)
191172
" --exclude:xxx Exclude a file or directory (can be specified multiple times)"
192173
);
193174
output.WriteLine(" --dry-run Stop before extraction");
194-
output.WriteLine(
195-
" --threads:nnn Specify number of threads (default=CPU cores)"
196-
);
175+
output.WriteLine(" --threads:nnn Specify number of threads (default=CPU cores)");
197176
output.WriteLine(" --verbose Produce more output");
198-
output.WriteLine(
199-
" --skip-psmodulepath-files Avoid extracting source files in paths specified by the PSModulePath environment variable."
200-
);
177+
output.WriteLine(" --skip-psmodulepath-files Avoid extracting source files in paths specified by the PSModulePath environment variable.");
201178
}
202179

203180
private Options() { }

powershell/tools/qltest.cmd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ type NUL && "%CODEQL_DIST%\codeql.exe" database index-files ^
66
--size-limit=5m ^
77
--language=powershell ^
88
--working-dir=. ^
9-
--extractor-option="powershell.skip_psmodulepath_files=true" ^
109
"%CODEQL_EXTRACTOR_POWERSHELL_WIP_DATABASE%"
1110

1211
exit /b %ERRORLEVEL%

0 commit comments

Comments
 (0)