-
-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat: add switch to add license text to BOM result #427
base: main
Are you sure you want to change the base?
Conversation
99f9dde
to
1d348e9
Compare
1d348e9
to
b27a3fe
Compare
❌ Please add proper tests. PS: this is already ongoing |
b27a3fe
to
b20daa5
Compare
Signed-off-by: Matthias Schiebel <[email protected]>
217a4c8
to
b53631e
Compare
tests/_data/dummy_projects/with-lockfile/node_modules/my-local-a/LICENSE
Outdated
Show resolved
Hide resolved
Based on the proposed implementation, the new switch The @CompartMSL, how do you see this? |
7627101
to
b53631e
Compare
You are right. |
Ignore the tests for a while, and just take care of the needed implementation details. |
src/licensetexts.ts
Outdated
if (pkgPath.length < 1) { | ||
return licenseFilenamesWType | ||
} | ||
const typicalFilenames = ['LICENSE', 'License', 'license', 'LICENCE', 'Licence', 'licence', 'NOTICE', 'Notice', 'notice'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the list/implementation to be case-insensitive.
I'd suggest having only lowercased entries in the list.
I'd suggest using a scandir
-like behavior where all files are lowercased before they are compared against the list of known files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose the other way first to get a list of all files and match case-insensitive. Maybe there is later an idea to handle multiple files
converted PR to "draft", since the implementation is not final, yet. |
d0c1d1c
to
2efa5b7
Compare
Signed-off-by: Matthias Schiebel <[email protected]>
2efa5b7
to
cf882a1
Compare
|
||
import { Enums, Models } from '@cyclonedx/cyclonedx-library' | ||
import * as fs from 'fs' | ||
import * as minimatch from 'minimatch' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ where does this come from?
@@ -226,6 +235,10 @@ export function run (process: NodeJS.Process): void { | |||
myConsole | |||
).buildFromProjectDir(projectDir, process) | |||
|
|||
if (options.addLicenseText) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do this after everything is set?
I'd suggest putting the code in the existing BomBuilder.makeComponent()
@CompartMSL I find the proposed current implementation disturbing, as it does not stick to chosen design principles and architecture of this project. my suggestion: write the needed function and usage in the
|
* @param {Models.DisjunctiveLicense} license | ||
* @param {string} installPath | ||
*/ | ||
function addLicTextBasedOnLicenseFiles (license: Models.DisjunctiveLicense, installPath: string): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
license text detection is not completely solved.
Therefore, the result shall be an evidence, rather than n license attachment.
fixes #256