Skip to content

Commit

Permalink
Remove unused functions
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashoneyman committed Nov 17, 2023
1 parent ae621da commit 5c54103
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
9 changes: 0 additions & 9 deletions app/src/App/API.purs
Original file line number Diff line number Diff line change
Expand Up @@ -1224,15 +1224,6 @@ type AdjustManifest =
, resolutions :: Maybe (Map PackageName Version)
}

-- other TODOs:
-- - make sure that we're handling 'verified resolutions' appropriately
-- - if we changed the manifest then don't trust our initial compile,
-- do it over again with the new resolutions (maybe just always redo
-- it for simplicity's sake? like findAllCompilers just tries them all?)
-- - delete the validation 'unused dependencies' check since we have
-- this whole dedicated function?
-- - test this function (a bitch, i know)

-- | Check the given manifest to determine dependencies that are unused and can
-- | be removed, as well as dependencies that are used but not listed in the
-- | manifest dependencies.
Expand Down
17 changes: 0 additions & 17 deletions lib/src/Operation/Validation.purs
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,6 @@ getUnresolvedDependencies (Manifest { dependencies }) resolutions =
| not (Range.includes dependencyRange version) -> Just $ Right $ dependencyName /\ dependencyRange /\ version
| otherwise -> Nothing

-- | Discovers dependencies listed in the manifest that are not actually used
-- | by the solved dependencies. This should not produce an error, but it
-- | indicates an over-constrained manifest.
getUnusedDependencies :: Manifest -> Map PackageName Version -> Set PackageName -> Maybe (NonEmptySet PackageName)
getUnusedDependencies (Manifest { dependencies }) resolutions discovered = do
let
-- There may be too many resolved dependencies because the manifest includes
-- e.g. test dependencies, so we start by only considering resolved deps
-- that are actually used.
inUse = Set.filter (flip Set.member discovered) (Map.keys resolutions)

-- Next, we can determine which dependencies are unused by looking at the
-- difference between the manifest dependencies and the resolved packages
unused = Set.filter (not <<< flip Set.member inUse) (Map.keys dependencies)

NonEmptySet.fromSet unused

data TarballSizeResult
= ExceedsMaximum Number
| WarnPackageSize Number
Expand Down

0 comments on commit 5c54103

Please sign in to comment.