Npm.Scanner (LowEndInsight v0.13.1)

Copy Markdown View Source

Scanner scans for node dependencies to run analysis on.

Summary

Functions

query_npm: function that takes in a package and returns an analysis on that package's repository using analyser_module. If the package url cannot be reached, an error is returned.

repository_url: looks package up in the npm registry and returns {:ok, url} for its declared repository, or :none when the registry does not know it, it declares no repository, or the registry cannot be reached. get is the HTTP GET, replaceable in tests.

scan: called when node? is false, returning an empty list and 0

scan: takes in a path to node dependencies and returns the dependencies mapped to their analysis and the number of dependencies

Functions

query_npm(package)

query_npm: function that takes in a package and returns an analysis on that package's repository using analyser_module. If the package url cannot be reached, an error is returned.

repository_url(package, get \\ &HTTPoison.get/1)

repository_url: looks package up in the npm registry and returns {:ok, url} for its declared repository, or :none when the registry does not know it, it declares no repository, or the registry cannot be reached. get is the HTTP GET, replaceable in tests.

scan(node?, project_types)

scan: called when node? is false, returning an empty list and 0

scan(node?, map, option \\ ".")

scan: takes in a path to node dependencies and returns the dependencies mapped to their analysis and the number of dependencies