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

feat(config/validation): add validation for negative numbers #29178

Merged

Conversation

RahulGautamSingh
Copy link
Collaborator

Changes

  • Validate negative numbers when they are set for integer types.

Context

Ref this discussion: #29137 (comment)

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@rarkins
Copy link
Collaborator

rarkins commented May 21, 2024

Are you sure we never use a negative number like -1 intentionally?

@RahulGautamSingh
Copy link
Collaborator Author

RahulGautamSingh commented May 21, 2024

Are you sure we never use a negative number like -1 intentionally?

We do but only for prPriority. I am still to add that change here, after figuring out how it works. It is a config option which should always have a parent but we do not validate it like one. I think one more PR before this one is needed to validate it like fileMatch.

@RahulGautamSingh RahulGautamSingh changed the title feat(config/validation): add validation for negative numbers feat(config/validation): add validation for negative numbers [WIP] May 21, 2024
@rarkins
Copy link
Collaborator

rarkins commented May 21, 2024

I think that this PR is maybe oversimplifying things. Not all numbers need to be positive, even if most are. A broad rule doesn't work.

Also yes, prPriority should always be part of packageRules

@RahulGautamSingh
Copy link
Collaborator Author

We can add allowNegative field for config options of type: integer. That will help differentiate them better.

@RahulGautamSingh RahulGautamSingh changed the title feat(config/validation): add validation for negative numbers [WIP] feat(config/validation): add validation for negative numbers May 24, 2024
lib/config/types.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@rarkins rarkins left a comment

Choose a reason for hiding this comment

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

Please test against a real repo and show us the results.

@RahulGautamSingh
Copy link
Collaborator Author

@rarkins rarkins added this pull request to the merge queue Jun 3, 2024
Merged via the queue into renovatebot:main with commit dcab567 Jun 3, 2024
37 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 37.387.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

None yet

4 participants