Skip to content

Commit

Permalink
Removing SCM warnings (#1354)
Browse files Browse the repository at this point in the history
* Removing SCM warnings
  • Loading branch information
JeffreyHuynh1 committed Jan 4, 2024
1 parent 54af2da commit 50e3007
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# FOSSA CLI Changelog

## Unreleased
## v3.8.29
- Prevents showing SCM warnings in fossa analyze, test, and report [#1354](https://github.com/fossas/fossa-cli/pull/1354)
- Pathfinder: Pathfinder has been deprecated and removed. ([#1350](https://github.com/fossas/fossa-cli/pull/1350))

## v3.8.28
Expand Down
29 changes: 27 additions & 2 deletions src/App/Fossa/Config/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import App.Fossa.Config.ConfigFile (
)
import App.Fossa.Config.EnvironmentVars (EnvVars (..))
import App.Fossa.ProjectInference (
InferredProject,
inferProjectCached,
inferProjectDefault,
inferProjectFromVCS,
Expand All @@ -81,9 +82,11 @@ import Control.Effect.Diagnostics (
Diagnostics,
Has,
errCtx,
errorBoundary,
fatalText,
fromMaybeText,
recover,
rethrow,
(<||>),
)
import Control.Effect.Lift (Lift, sendIO)
Expand All @@ -95,8 +98,10 @@ import Data.Maybe (fromMaybe)
import Data.String (IsString)
import Data.String.Conversion (ToText (toText))
import Data.Text (Text, null, strip, toLower)
import Diag.Result (Result (Failure, Success), renderFailure)
import Discovery.Filters (AllFilters (AllFilters), MavenScopeFilters (..), comboExclude, comboInclude, setExclude, setInclude, targetFilterParser)
import Effect.Exec (Exec)
import Effect.Logger (Logger, logDebug, logInfo)
import Effect.ReadFS (ReadFS, doesDirExist, doesFileExist)
import Fossa.API.Types (ApiKey (ApiKey), ApiOpts (ApiOpts), defaultApiPollDelay)
import GHC.Generics (Generic)
Expand Down Expand Up @@ -290,6 +295,7 @@ collectRevisionOverride maybeConfig OverrideProject{..} = override
collectRevisionData ::
( Has Diagnostics sig m
, Has Exec sig m
, Has Logger sig m
, Has (Lift IO) sig m
, Has ReadFS sig m
) =>
Expand All @@ -302,17 +308,36 @@ collectRevisionData (BaseDir basedir) maybeConfig cacheStrategy cliOverride = do
let override = collectRevisionOverride maybeConfig cliOverride
case cacheStrategy of
ReadOnly -> do
inferred <- inferProjectFromVCS basedir <||> inferProjectCached basedir <||> inferProjectDefault basedir
inferred <- inferVCSInfo $ inferProjectCached basedir <||> inferProjectDefault basedir
pure $ mergeOverride override inferred
WriteOnly -> do
inferred <- inferProjectFromVCS basedir <||> inferProjectDefault basedir
inferred <- inferVCSInfo $ inferProjectDefault basedir
let revision = mergeOverride override inferred
saveRevision revision
pure revision
where
inferVCSInfo ::
( Has Diagnostics sig m
, Has Logger sig m
, Has ReadFS sig m
, Has Exec sig m
) =>
m InferredProject ->
m InferredProject
inferVCSInfo nextStep = do
vcsInfo <- errorBoundary $ inferProjectFromVCS basedir
case vcsInfo of
Failure emittedWarns errGroup ->
do
logDebug (renderFailure emittedWarns errGroup "Unable to infer project revision from VCS")
logInfo "Unable to infer project revision from VCS, using current timestamp as the revision."
nextStep
Success _ _ -> rethrow vcsInfo

collectRevisionData' ::
( Has Diagnostics sig m
, Has Exec sig m
, Has Logger sig m
, Has (Lift IO) sig m
, Has ReadFS sig m
) =>
Expand Down
1 change: 1 addition & 0 deletions src/App/Fossa/Config/Report.hs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ loadConfig = resolveLocalConfigFile . optConfig . commons
mergeOpts ::
( Has (Lift IO) sig m
, Has ReadFS sig m
, Has Logger sig m
, Has Diagnostics sig m
, Has Exec sig m
) =>
Expand Down

0 comments on commit 50e3007

Please sign in to comment.