mirror of
https://github.com/github/codeql.git
synced 2026-04-26 17:25:19 +02:00
Warn on use of old option
This commit is contained in:
@@ -28,7 +28,8 @@ type BaselineConfig struct {
|
||||
func GetConfigBaselineAsJSON(rootDir string) ([]byte, error) {
|
||||
vendorDirs := make([]string, 0)
|
||||
|
||||
if util.IsVendorDirExtractionEnabled() {
|
||||
extractVendorDirs, _ := util.IsVendorDirExtractionEnabled()
|
||||
if extractVendorDirs {
|
||||
// The user wants vendor directories scanned; emit an empty report.
|
||||
} else {
|
||||
filepath.WalkDir(rootDir, func(dirPath string, d fs.DirEntry, err error) error {
|
||||
|
||||
@@ -83,7 +83,11 @@ func ExtractWithFlags(buildFlags []string, patterns []string, extractTests bool)
|
||||
|
||||
// If CODEQL_EXTRACTOR_GO_[OPTION_]EXTRACT_VENDOR_DIRS is "true", we extract `vendor` directories;
|
||||
// otherwise (the default) is to exclude them from extraction
|
||||
includeVendor := util.IsVendorDirExtractionEnabled()
|
||||
includeVendor, oldOptionUsed := util.IsVendorDirExtractionEnabled()
|
||||
|
||||
if oldOptionUsed {
|
||||
log.Println("Warning: obsolete option \"CODEQL_EXTRACTOR_GO_EXTRACT_VENDOR_DIRS\" was set. Use \"CODEQL_EXTRACTOR_GO_OPTION_EXTRACT_VENDOR_DIRS\" or pass `--extractor-option extract_vendor_dirs=true` instead.")
|
||||
}
|
||||
|
||||
modeNotifications := make([]string, 0, 2)
|
||||
if extractTests {
|
||||
|
||||
@@ -4,7 +4,8 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
func IsVendorDirExtractionEnabled() bool {
|
||||
return os.Getenv("CODEQL_EXTRACTOR_GO_EXTRACT_VENDOR_DIRS") == "true" ||
|
||||
os.Getenv("CODEQL_EXTRACTOR_GO_OPTION_EXTRACT_VENDOR_DIRS") == "true"
|
||||
func IsVendorDirExtractionEnabled() (bool, bool) {
|
||||
oldOptionVal := os.Getenv("CODEQL_EXTRACTOR_GO_EXTRACT_VENDOR_DIRS")
|
||||
return (oldOptionVal == "true" ||
|
||||
os.Getenv("CODEQL_EXTRACTOR_GO_OPTION_EXTRACT_VENDOR_DIRS") == "true"), oldOptionVal != ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user