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 bug that prevents lint diff code from running #1510

Merged

Conversation

cheemcheem
Copy link
Contributor

It seems that the intended functionality is that if modular lint is run without '--all', in a non-ci environment, and without any file regex parameters, then the 'diff' code will be executed and only the changed files between the default branch and the current branch will be linted.

Currently however, the check for these conditions is faulty and the diff code is never executed.

This is due to a bug on line 26 / line 19, where on line 19 regexes is set to an empty array by default and never has the opportunity to be falsy. Then on line 26, it checks whether regexes is falsy before proceeding with the diff code.

My proposed change is that instead of checking whether regexes is falsy, it should check that the regexes array is empty since it can never be falsy.

Further reading about default parameters: TypeScript Docs.

@changeset-bot
Copy link

changeset-bot bot commented Mar 25, 2022

🦋 Changeset detected

Latest commit: 32e7022

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
modular-scripts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cheemcheem cheemcheem marked this pull request as ready for review March 25, 2022 19:27
@coveralls
Copy link
Collaborator

coveralls commented Mar 28, 2022

Coverage Status

Coverage remained the same at 28.742% when pulling 32e7022 on cheemcheem:feature/fix-lint-diff into 985a2d7 on jpmorganchase:main.

@cristiano-belloni cristiano-belloni merged commit 4846d21 into jpmorganchase:main Mar 28, 2022
@cheemcheem cheemcheem deleted the feature/fix-lint-diff branch March 28, 2022 15:42
This was referenced Mar 28, 2022
This was referenced Apr 6, 2022
@github-actions github-actions bot mentioned this pull request Apr 13, 2022
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