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

refactor: split search and fitting to status functionality #127

Merged
merged 10 commits into from
Dec 9, 2024

Conversation

pawelkoniecznybh
Copy link
Collaborator

No description provided.

@pawelkoniecznybh pawelkoniecznybh marked this pull request as draft December 4, 2024 07:25
@Lukasz-pluszczewski Lukasz-pluszczewski marked this pull request as ready for review December 6, 2024 14:33
# Conflicts:
#	README.md
#	package-lock.json
#	packages/cli/src/components/audit-licenses/audit-licenses.tsx
#	packages/core/src/audit-licenses.ts
#	test/test/npm.test.ts
#	test/testProjects/monorepo/package-lock.json
#	test/testProjects/monorepo/package.json
@Lukasz-pluszczewski Lukasz-pluszczewski changed the title Draft: feat: split search and fitting to status functionality feat: split search and fitting to status functionality Dec 6, 2024
@Lukasz-pluszczewski Lukasz-pluszczewski changed the title feat: split search and fitting to status functionality refactor: split search and fitting to status functionality Dec 6, 2024
Comment on lines +83 to +90
if (!packageJsonResult.success) {
//To code reviewer: Should we handle in in this or different way?
errorResults.set(packageNameFromPath, {
packagePath,
errorMessage: packageJsonResult.errorMessage,
});
continue;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current solution looks ok, what other way do you have in mind?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was curious here, if we should add this error to the new errorResults map here.

Comment on lines +55 to +67
// it("should return the correct license when file name matches a license name", () => {
// const filePath = "LICENSE-Apache-2.0";
// const expectedLicense = LicenseSchema.parse(licenseMap.get("Apache-2.0"));
// const result = retrieveLicenseFromLicenseFileName(filePath);
// expect(result.licenses).toEqual([expectedLicense]);
// });

it("should return an empty array when file name does not match any known license pattern", () => {
const filePath = "LICENSE-UNKNOWN";
const result = retrieveLicenseFromLicenseFileName(filePath);
expect(result.licenses).toEqual([]);
});
});
// it("should return an empty array when file name does not match any known license pattern", () => {
// const filePath = "LICENSE-UNKNOWN";
// const result = retrieveLicenseFromLicenseFileName(filePath);
// expect(result.licenses).toEqual([]);
// });
// });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the situation with these tests? Should they be removed, uncommented, refactored?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove the tests related to file names, as this functionality is removed in this PR.

@@ -66,6 +66,7 @@ export default function AuditResult({
warning,
overrides,
}: AuditResultProps) {
//TODO handle errorResults here
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should implement this in this PR.

overrides: overrides,
warning: warning,
needsUserVerification: needsUserVerification,
errorResults: errorResults,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be written like this:

return {
    groupedByStatus,
    notFound,
    overrides,
    warning,
    needsUserVerification,
    errorResults,
  };


if (!packageJsonResult.success) {
//To code reviewer: Should we handle in in this or different way?
errorResults.set(packageNameFromPath, {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also set process.exitCode = 1; in this case here?

@Lukasz-pluszczewski Lukasz-pluszczewski merged commit 869d917 into development Dec 9, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants