Skip to content
This repository has been archived by the owner on Apr 1, 2022. It is now read-only.

Commit

Permalink
Don't let errors escape from nodeJS discovery (#424)
Browse files Browse the repository at this point in the history
* Don't let errors escape from nodeJS discovery

* Use return early method instead

* update changelog
  • Loading branch information
Wesley Van Melle authored Oct 29, 2021
1 parent 2eed03b commit 0d521f4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
6 changes: 5 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# Spectrometer Changelog

## v2.19.1

- Fixes an issue where nodeJS errors were reported when no NodeJS project were discovered. ([#424](https://github.com/fossas/spectrometer/pull/424))

## v2.19.0

- Adds support for `fossa analyze --include-unused-deps`, which prevents filtering out non-production dependencies. ([#412](https://github.com/fossas/spectrometer/pull/412))
- Yarn: Adds support for workspaces. ([#374](https://github.com/fossas/spectrometer/pull/374))
- Npm: Adds support for workspaces. ([#374](https://github.com/fossas/spectrometer/pull/374))
- Npm: Removes unreliable `npm ls`-based analysis tactic. ([#374](https://github.com/fossas/spectrometer/pull/374))
- `fossa-deps`: Adds support for `bower`-type in `referenced-dependencies`. ([#406](https://github.com/fossas/spectrometer/pull/406))
- Monorepo: Chunk AOSP files when uploading ([#421](https://github.com/fossas/spectrometer/pull/421)).
- Monorepo: Chunk AOSP files when uploading ([#421](https://github.com/fossas/spectrometer/pull/421)).
- Monorepo: Don't fail on files that are filtered during expansion ([#421](https://github.com/fossas/spectrometer/pull/421)).

## v2.18.1
Expand Down
1 change: 0 additions & 1 deletion src/App/Fossa/Analyze.hs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ analyze (BaseDir basedir) destination override unpackArchives jsonOutput include
Diag.withResult SevError res (const (pure ()))

let filteredProjects = filterProjects (BaseDir basedir) projectResults
logInfo ("Include-all option is set to: " <> pretty (fromFlag IncludeAll includeAll))

-- Need to check if vendored is empty as well, even if its a boolean that vendoredDeps exist
case checkForEmptyUpload includeAll projectResults filteredProjects additionalSourceUnits of
Expand Down
10 changes: 7 additions & 3 deletions src/Strategy/Node.hs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,13 @@ discover ::
discover dir = context "NodeJS" $ do
manifestList <- context "Finding nodejs projects" $ collectManifests dir
manifestMap <- context "Reading package.json files" $ (Map.fromList . catMaybes) <$> traverse loadPackage manifestList
globalGraph <- context "Building global workspace graph" $ pure $ buildManifestGraph manifestMap
graphs <- context "Splitting global graph into chunks" $ fromMaybeText "" $ splitGraph globalGraph
context "Converting graphs to analysis targets" $ traverse (mkProject <=< identifyProjectType) graphs
if Map.null manifestMap
then -- If the map is empty, we found no JS projects, we return early.
pure []
else do
globalGraph <- context "Building global workspace graph" $ pure $ buildManifestGraph manifestMap
graphs <- context "Splitting global graph into chunks" $ fromMaybeText "" $ splitGraph globalGraph
context "Converting graphs to analysis targets" $ traverse (mkProject <=< identifyProjectType) graphs

collectManifests :: (Has ReadFS sig m, Has Diagnostics sig m) => Path Abs Dir -> m [Manifest]
collectManifests = walk' $ \_ _ files ->
Expand Down

0 comments on commit 0d521f4

Please sign in to comment.