Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node: Represent workspace submodules as Projects #9247

Merged
merged 6 commits into from
Oct 9, 2024

Commits on Oct 8, 2024

  1. refactor(npm): Reduce the amount of filterTo()s

    Keep `searchDirs` as a `Sequence`.
    
    Signed-off-by: Frank Viernau <[email protected]>
    fviernau committed Oct 8, 2024
    Configuration menu
    Copy the full SHA
    81bab93 View commit details
    Browse the repository at this point in the history
  2. refactor(node): Use Set<File> as the type for submodule directories

    There can be no duplicate files in the same file system location. A
    `Set` better reflects those semantics.
    
    Signed-off-by: Frank Viernau <[email protected]>
    fviernau committed Oct 8, 2024
    Configuration menu
    Copy the full SHA
    7afd6c9 View commit details
    Browse the repository at this point in the history
  3. refactor(npm): Use named arguments in a constructor call

    Reduce the diff of an upcoming change.
    
    Signed-off-by: Frank Viernau <[email protected]>
    fviernau committed Oct 8, 2024
    Configuration menu
    Copy the full SHA
    9aca612 View commit details
    Browse the repository at this point in the history
  4. chore(npm): Move a TODO comment above the function signature

    Remove the need to worry about a good location within the function
    in upcoming changes of the function.
    
    Signed-off-by: Frank Viernau <[email protected]>
    fviernau committed Oct 8, 2024
    Configuration menu
    Copy the full SHA
    42ca16b View commit details
    Browse the repository at this point in the history
  5. refactor(npm): Replace two !! with checkNotNull()

    Prepare for a following change.
    
    Signed-off-by: Frank Viernau <[email protected]>
    fviernau committed Oct 8, 2024
    Configuration menu
    Copy the full SHA
    7c516d4 View commit details
    Browse the repository at this point in the history
  6. fix(node): Represent workspace submodules as Projects

    Previously, the submodules of any `Yarn` or `Pnpm` workspaces were
    represented as packages. This was inconsistent, because ORT normally
    represents any definition files found in the analyzed sources as a
    `Project`, not as a `Package`. Besides being inconsistent, the `Package`
    representation renders the `ort.yml` features unusable. For example,
    workspace submodules could not be excluded via path excludes.
    Furthermore, the previous implementation represented the workspace root
    project (in case of Pnpm) as both, as a `Package` and as a `Project`.
    Finally, the previous Package representation of a submodule did not have
    any reference from any project scope. As a consequnce, any (license)
    policy rules which operates only on non-excluded dependencies would have
    disregarded the submodules and their transitive dependencies,
    potentially leading to an incorrect underreporting of rule violations.
    
    Extend the `NpmModuleInfo` class by the flag `isProject` and make use of
    it in the `NpmDependencyHandler` for creating the packages and
    determining the linkage type. This change guarantees that
    `parsePackage()` is no more called for `Project`s, but only for
    `Package`s which is why the project-specific logic is dropped from
    `parsePackage()`. For projects the dedicated `parseProjects()` is now
    consistently used instead.
    
    As in the new representation there are no more unreferenced packages,
    the dependency handler does take care of creating all packages. So, the
    logic which calls `graph.addPackage()` for each module returned by
    `parseInstalledModules()` became unnecessary and is dropped.
    
    Note: This commit fixes multiple things at once, because it seemed too
    complicated to fix each issue separately due to various chicken-egg
    like problems.
    
    Fixes #9196, fixes #8940.
    
    Signed-off-by: Frank Viernau <[email protected]>
    fviernau committed Oct 8, 2024
    Configuration menu
    Copy the full SHA
    510909b View commit details
    Browse the repository at this point in the history