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

Fix: allow to combine excludePackages and excludePackagesStartingWith options #50

Merged
merged 1 commit into from
Jan 21, 2023

Conversation

eugene1g
Copy link
Contributor

@eugene1g eugene1g commented Jan 15, 2023

This PR makes it possible to combine the two different methods of excluding packages from evaluation (excludePackages and excludePackagesStartingWith).

Also fixes the incorrect behavior of excludePackagesStartingWith which resulted in the failed test at https://github.com/RSeidelsohn/license-checker-rseidelsohn/actions/runs/3924255813

Fixes #49

@eugene1g
Copy link
Contributor Author

@RSeidelsohn The recent patch-release doesn't quite resolve the issue of combining those two attributes. I think this PR is still relevant.

@eugene1g eugene1g reopened this Jan 16, 2023
@eugene1g
Copy link
Contributor Author

(rebased on the latest master)

@RSeidelsohn
Copy link
Owner

@RSeidelsohn The recent patch-release doesn't quite resolve the issue of combining those two attributes. I think this PR is still relevant.

Definitely, @eugene1g , I unfortunately only saw your PR after I did my patch. I want to have a deeper look, though (or discuss here with you), as I did not check whether the shallow copy you do from currentResult into resultJson has some side effects. But I just had a quick look again and see that we only use the return value and should not have any issues with possible side effects.

But please - if this is ok - give me some more time (which might mean even days) to handle this. If it is urgent for you, tell me so and I will approve and merge your PR and make a new release. And thank you so much for contributing to this repo!

@eugene1g
Copy link
Contributor Author

eugene1g commented Jan 16, 2023

@RSeidelsohn Sure thing - this is not urgent, and I'm happy to wait.

Refactoring excludePackagesStartingWith is not necessary for the fix to the issue. In fact, I probably should not have done it in the same PR. The reason why I did it is because it was doing two conflicting things - creating a new object to return, and mutating values in the global filtered object - and this behavior is a no-no for predictability. I changed it to not have any side-effects, and refactored the loop to be more readable, but neither is necessary for the main purpose of this PR, so you can restore the old function is you're more comfortable.

@RSeidelsohn RSeidelsohn merged commit 4735691 into RSeidelsohn:master Jan 21, 2023
@RSeidelsohn
Copy link
Owner

Thank you so much for your contribution! I really appreciate this, and you did an excellent work in also adding the tests (using a test framework I have never used before - I'd really like to switch to using Jest, but this would take quite some time).
I will prepare the new release now and also make it the last one guaranteed to be working with NodeJS v14, as v14 will run out of security support in 3 months.
So the next major version will upgrade NodeJS to v18, which can be seen as a breaking change, which is why I will start a new major version.

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.

excludePackagesStartingWith overrides excludePackages
2 participants