Skip to content

Commit

Permalink
Fixing lint and update to changeLog
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreyHuynh1 committed Dec 6, 2023
1 parent ee25b87 commit d5a1107
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Unreleased
- Maven: add support for maven scope filtering ([#1331](https://github.com/fossas/fossa-cli/pull/1331))
- `fossa init`: adds new `fossa init` command which creates `.fossa.yml.example`, and `fossa-deps.yml.example` file. ([#1323](https://github.com/fossas/fossa-cli/pull/1323))
- Maven: add support for maven submodule filtering
- Maven: add support for maven submodule filtering [#1339](https://github.com/fossas/fossa-cli/pull/1339)

## v3.8.24

Expand Down
4 changes: 0 additions & 4 deletions integration-test/Analysis/FixtureUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,8 @@ testRunnerWithLogger f env =
& withDefaultLogger SevWarn
& runReader (mempty :: OverrideDynamicAnalysisBinary)
& runReader (mempty :: AllFilters)
<<<<<<< HEAD
& runReader (mempty :: MavenScopeFilters)
& runReader (ExperimentalAnalyzeConfig Nothing GoModulesBasedTactic)
=======
& runReader (ExperimentalAnalyzeConfig Nothing GoModulesBasedTactic False)
>>>>>>> origin/master
& runFinally
& runStack
& withoutTelemetry
Expand Down
10 changes: 6 additions & 4 deletions src/App/Fossa/Config/Analyze.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ import Discovery.Filters (AllFilters (AllFilters), MavenScopeFilters (MavenScope
import Effect.Exec (
Exec,
)
import Effect.Logger (Logger, Severity (SevDebug, SevInfo), logWarn, vsep)
import Effect.Logger (
Logger,
Severity (SevDebug, SevInfo),
logWarn,
vsep,
)
import Effect.ReadFS (ReadFS, getCurrentDir, resolveDir)
import GHC.Generics (Generic)
import Options.Applicative (
Expand All @@ -111,11 +116,8 @@ import Path (Abs, Dir, Path, Rel)
import Path.Extra (SomePath)
import Prettyprinter (Doc, annotate, defaultLayoutOptions, layoutPretty)
import Prettyprinter.Render.Terminal (AnsiStyle, Color (Red), color, renderStrict)
import Text.Pretty.Simple (pShow)
import Types (ArchiveUploadType (..), LicenseScanPathFilters (..), TargetFilter)

import Effect.Logger (Logger, Pretty (pretty), logDebug, runLogger)

-- Utility functions
coloredText :: Color -> Doc AnsiStyle -> String
coloredText clr str = toString . renderStrict . layoutPretty defaultLayoutOptions $ annotate (color clr) str
Expand Down
2 changes: 1 addition & 1 deletion src/Strategy/Maven.hs
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,4 @@ submoduleTargetSet foundTargets = case foundTargets of
_ -> Set.empty

completeSubmoduleSet :: MavenProjectClosure -> Set Text
completeSubmoduleSet MavenProjectClosure{..} = closureSubmodules
completeSubmoduleSet MavenProjectClosure{..} = closureSubmodules
2 changes: 0 additions & 2 deletions src/Strategy/Maven/DepTree.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE RecordWildCards #-}

module Strategy.Maven.DepTree (
analyze,
parseDotGraphs,
Expand Down
2 changes: 0 additions & 2 deletions src/Strategy/Maven/Pom.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# LANGUAGE RecordWildCards #-}

module Strategy.Maven.Pom (
analyze',
getLicenses,
Expand Down
18 changes: 5 additions & 13 deletions test/Maven/CommonSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ createDepFromScopes scopes = do
MavenDependency dep (Set.fromList scopes)

createDepFromName :: Text -> MavenDependency
createDepFromName depName = do
createDepFromName depName = do
let dep =
Dependency
{ dependencyType = MavenType
, dependencyName = depName
, dependencyVersion = Just (CEq "1.0.0")
, dependencyLocations = []
, dependencyEnvironments = Set.fromList []
, dependencyTags = Map.fromList []
, dependencyTags = Map.empty
}
MavenDependency dep (Set.fromList [])

Expand Down Expand Up @@ -189,7 +189,6 @@ scopeFilters = do
expectDeps [compileDep, runtimeDep] graph'
expectEdges [(compileDep, runtimeDep)] graph'


submoduleFilters :: Spec
submoduleFilters = do
describe "Filter maven deps by submodule" $ do
Expand All @@ -206,12 +205,10 @@ submoduleFilters = do
let sharedDep = createDepFromName "com.fossa:sharedDep"
let sharedDepTransitive = createDepFromName "com.fossa:sharedDepTransitive"
let filteredDep = createDepFromName "com.fossa:filteredDep"

let includedSubmodules = Set.fromList ["com.fossa:submodule1"]
let allSubmodules = Set.fromList ["com.fossa:submodule1", "com.fossa:submodule2"]

let graph = Graphing.directs [submoduleDep1, submoduleDep2] <> Graphing.edges [(submoduleDep1, sharedDep), (submoduleDep2, sharedDep), (submoduleDep2, filteredDep), (sharedDep, sharedDepTransitive)]
let graph' = filterMavenSubmodules includedSubmodules allSubmodules graph
let graph' = filterMavenSubmodules includedSubmodules allSubmodules graph

expectDirect [submoduleDep1] graph'
expectDeps [submoduleDep1, sharedDep, sharedDepTransitive] graph'
Expand All @@ -231,21 +228,16 @@ submoduleFilters = do
let sharedDepTransitive = createDepFromName "com.fossa:sharedDepTransitive"
let filteredDep = createDepFromName "com.fossa:filteredDep"
let filteredDepTransitive = createDepFromName "com.fossa:filteredDepTransitive"



let includedSubmodules = Set.fromList ["com.fossa:submodule1"]
let allSubmodules = Set.fromList ["com.fossa:submodule1", "com.fossa:submodule2"]

let graph = Graphing.directs [submoduleDep1, submoduleDep2] <> Graphing.edges [(submoduleDep1, sharedDep), (submoduleDep1, submoduleDep2), (submoduleDep2, sharedDep), (submoduleDep2, filteredDep), (sharedDep, sharedDepTransitive), (filteredDep, filteredDepTransitive)]
let graph' = filterMavenSubmodules includedSubmodules allSubmodules graph
let graph' = filterMavenSubmodules includedSubmodules allSubmodules graph

expectDirect [submoduleDep1] graph'
expectDeps [submoduleDep1, sharedDep, sharedDepTransitive] graph'
expectEdges [(submoduleDep1, sharedDep), (sharedDep, sharedDepTransitive)] graph'


spec :: Spec
spec = do
scopeFilters
submoduleFilters
submoduleFilters

0 comments on commit d5a1107

Please sign in to comment.