Skip to content

Commit effbc49

Browse files
committed
Add log message
1 parent 5be613f commit effbc49

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/App/Fossa/Config/Analyze.hs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ import Discovery.Filters (AllFilters (AllFilters), MavenScopeFilters (MavenScope
106106
import Effect.Exec (
107107
Exec,
108108
)
109-
import Effect.Logger (Logger, Severity (SevDebug, SevInfo), logWarn, pretty, vsep)
109+
import Effect.Logger (Logger, Severity (SevDebug, SevInfo), logInfo, logWarn, pretty, vsep)
110110
import Effect.ReadFS (ReadFS, getCurrentDir, resolveDir)
111111
import GHC.Generics (Generic)
112112
import Options.Applicative (
@@ -222,6 +222,7 @@ data AnalyzeCliOpts = AnalyzeCliOpts
222222
, analyzeExcludeTargets :: [TargetFilter]
223223
, analyzeOnlyPaths :: [Path Rel Dir]
224224
, analyzeExcludePaths :: [Path Rel Dir]
225+
, analyzeExcludeManifestStrategies :: Flag ExcludeManifestStrategies
225226
, analyzeVSIMode :: Flag VSIAnalysis
226227
, analyzeBinaryDiscoveryMode :: Flag BinaryDiscovery
227228
, analyzeAssertMode :: Maybe (FilePath)
@@ -238,7 +239,6 @@ data AnalyzeCliOpts = AnalyzeCliOpts
238239
, analyzeWithoutDefaultFilters :: Flag WithoutDefaultFilters
239240
, analyzeStrictMode :: Flag StrictMode
240241
, analyzeSnippetScan :: Bool
241-
, analyzeExcludeManifestStrategies :: Flag ExcludeManifestStrategies
242242
}
243243
deriving (Eq, Ord, Show)
244244

@@ -334,6 +334,7 @@ cliParser =
334334
<*> many (option (eitherReader targetOpt) (applyFossaStyle <> long "exclude-target" <> stringToHelpDoc "Exclude these targets from scanning. See `targets.exclude` in the fossa.yml spec." <> metavar "PATH"))
335335
<*> many (option (eitherReader pathOpt) (applyFossaStyle <> long "only-path" <> stringToHelpDoc "Only scan these paths. See `paths.only` in the fossa.yml spec." <> metavar "PATH"))
336336
<*> many (option (eitherReader pathOpt) (applyFossaStyle <> long "exclude-path" <> stringToHelpDoc "Exclude these paths from scanning. See `paths.exclude` in the fossa.yml spec." <> metavar "PATH"))
337+
<*> flagOpt ExcludeManifestStrategies (applyFossaStyle <> long "exclude-manifest-strategies" <> stringToHelpDoc "Exclude all manifest-based strategies for finding targets.")
337338
<*> vsiEnableOpt
338339
<*> flagOpt BinaryDiscovery (applyFossaStyle <> long "experimental-enable-binary-discovery" <> stringToHelpDoc "Reports binary files as unlicensed dependencies")
339340
<*> optional (strOption (applyFossaStyle <> long "experimental-link-project-binary" <> metavar "DIR" <> stringToHelpDoc "Links output binary files to this project in FOSSA"))
@@ -350,7 +351,6 @@ cliParser =
350351
<*> withoutDefaultFilterParser fossaAnalyzeDefaultFilterDocUrl
351352
<*> flagOpt StrictMode (applyFossaStyle <> long "strict" <> stringToHelpDoc "Enforces strict analysis to ensure the most accurate results by rejecting fallbacks.")
352353
<*> switch (applyFossaStyle <> long "x-snippet-scan" <> stringToHelpDoc "Experimental flag to enable snippet scanning to identify open source code snippets using fingerprinting.")
353-
<*> flagOpt ExcludeManifestStrategies (applyFossaStyle <> long "exclude-manifest-strategies" <> stringToHelpDoc "Ignore all manifest-based strategies for finding targets.")
354354
where
355355
fossaDepsFileHelp :: Maybe (Doc AnsiStyle)
356356
fossaDepsFileHelp =
@@ -582,8 +582,9 @@ collectFilters ::
582582
AnalyzeCliOpts ->
583583
m AllFilters
584584
collectFilters maybeConfig cliOpts = do
585-
let cliFilters = collectCLIFilters cliOpts
586-
cfgFileFilters = maybe mempty collectConfigFileFilters maybeConfig
585+
let cfgFileFilters = maybe mempty collectConfigFileFilters maybeConfig
586+
cliFilters <- collectCLIFilters cliOpts
587+
587588
case (isMempty cliFilters, isMempty cfgFileFilters) of
588589
(True, True) -> pure mempty
589590
(False, True) -> pure cliFilters
@@ -592,14 +593,15 @@ collectFilters maybeConfig cliOpts = do
592593
cliFilters
593594
<$ logWarn "Overriding config file filters with command-line filters"
594595

595-
collectCLIFilters :: AnalyzeCliOpts -> AllFilters
596+
collectCLIFilters :: (Has Logger sig m) => AnalyzeCliOpts -> m AllFilters
596597
collectCLIFilters AnalyzeCliOpts{..} =
597598
if fromFlag ExcludeManifestStrategies analyzeExcludeManifestStrategies
598-
then AllFilters (comboInclude [] []) (comboExclude allTargetFilters [])
599+
then AllFilters (comboInclude [] []) (comboExclude allTargetFilters []) <$ logInfo "Excluding manifest-based strategies in locating targets"
599600
else
600-
AllFilters
601-
(comboInclude analyzeOnlyTargets analyzeOnlyPaths)
602-
(comboExclude analyzeExcludeTargets analyzeExcludePaths)
601+
pure $
602+
AllFilters
603+
(comboInclude analyzeOnlyTargets analyzeOnlyPaths)
604+
(comboExclude analyzeExcludeTargets analyzeExcludePaths)
603605
where
604606
allProjectTypes :: [DiscoveredProjectType]
605607
allProjectTypes = enumFromTo minBound maxBound

0 commit comments

Comments
 (0)