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: modified regex to use RE2 #12025

Merged
merged 17 commits into from
Oct 19, 2021
Merged

fix: modified regex to use RE2 #12025

merged 17 commits into from
Oct 19, 2021

Conversation

RahulGautamSingh
Copy link
Collaborator

@RahulGautamSingh RahulGautamSingh commented Oct 5, 2021

Changes:

Updated regex of these sub-folders:
lib/config
lib/constants
lib/datasource
to use RE2 using regEx function from lib/util/regex

Context:

fixes #11875

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 tick 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

@RahulGautamSingh RahulGautamSingh changed the title modified regex to use RE2 fix: modified regex to use RE2 Oct 5, 2021
@RahulGautamSingh RahulGautamSingh marked this pull request as draft October 5, 2021 17:35
Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

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

Checked config folder

lib/config/migration.ts Show resolved Hide resolved
@RahulGautamSingh RahulGautamSingh marked this pull request as ready for review October 8, 2021 06:44
lib/datasource/npm/npmrc.ts Outdated Show resolved Hide resolved
@rarkins
Copy link
Collaborator

rarkins commented Oct 8, 2021

@viceice I think there are advantages to leaving the current regex positioning as-is - including inside for loops - for easier review and backwards compatibility. But then should we create an issue to elevate any regexes inside loops to be outside the loop?

@viceice
Copy link
Member

viceice commented Oct 8, 2021

@viceice I think there are advantages to leaving the current regex positioning as-is - including inside for loops - for easier review and backwards compatibility. But then should we create an issue to elevate any regexes inside loops to be outside the loop?

Yes, that was the idea. Sorry if it wasn't clear enough.

lib/datasource/go/goproxy.ts Outdated Show resolved Hide resolved
lib/util/regex.ts Show resolved Hide resolved
lib/util/regex.ts Show resolved Hide resolved
lib/logger/err-serializer.ts Outdated Show resolved Hide resolved
lib/logger/cmd-serializer.ts Outdated Show resolved Hide resolved
@rarkins
Copy link
Collaborator

rarkins commented Oct 8, 2021

@RahulGautamSingh please re-request a review once it's ready. The goals are:

  • all regex which can be converted to regEx have been
  • those which can't are marked with // TODO #12070
  • any which should be moved out of loops are marked with // TODO #12071 (some may have both..)

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.

I got through 15/36 files before finding a lot of TODO #12070 which I have doubts about

lib/config/decrypt.ts Outdated Show resolved Hide resolved
lib/datasource/artifactory/index.ts Outdated Show resolved Hide resolved
lib/datasource/maven/index.ts Show resolved Hide resolved
lib/datasource/maven/util.ts Outdated Show resolved Hide resolved
@rarkins
Copy link
Collaborator

rarkins commented Oct 11, 2021

Ok, I will try going through the rest soon. I hadn't expected #12070 to have so many

.vscode/settings.json 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.

Looks mostly good except vscode settings

rarkins
rarkins previously approved these changes Oct 11, 2021
@RahulGautamSingh
Copy link
Collaborator Author

RahulGautamSingh commented Oct 13, 2021

Hello @viceice @rarkins,
I have completed the work for the next PR, can you review & merge this one so that we can move next one OR should I create a new one?

@rarkins
Copy link
Collaborator

rarkins commented Oct 13, 2021

Needs deconflicting?

@RahulGautamSingh
Copy link
Collaborator Author

RahulGautamSingh commented Oct 14, 2021

Needs deconflicting?

Yes. I created the new branch using this one so, all the changes made to this branch are already present in the other one. Therefore, unless this branch gets merged the changes will appear in the new branch and then conflicts.

@rarkins
Copy link
Collaborator

rarkins commented Oct 14, 2021

I'm confused. Which PR do you need merged first?

@RahulGautamSingh
Copy link
Collaborator Author

I'm confused. Which PR do you need merged first?

This one needs to be merged first.

@RahulGautamSingh
Copy link
Collaborator Author

RahulGautamSingh commented Oct 15, 2021

Hey @rarkins @viceice ,
When I use RE2 syntax then in some cases while testing all the tests pass but the snapshots do not match. But when I delete the snaps and then test again then all the tests pass and the snaps (over-written) match.
I was wondering what to do in such cases, should I :-

  1. Change the snapshots and use new Regex.
  2. Deal with these in Refactor marked regex to be re2 compatible #12070.

@rarkins
Copy link
Collaborator

rarkins commented Oct 18, 2021

@RahulGautamSingh can you update this PR to include on such example where the snapshots need updating? Then it's easier for us to understand and decide

@RahulGautamSingh
Copy link
Collaborator Author

RahulGautamSingh commented Oct 19, 2021

@RahulGautamSingh can you update this PR to include on such example where the snapshots need updating? Then it's easier for us to understand and decide

@rarkins
When I was rechecking the file to show an example of the error I found that the snapshots were fine and the real problem was incompatible RE2. I misunderstood the error the first time and thought that it was the snapshots. Sorry for the lapse in judgement. Also the files in which I had this problem are to be merged in future PRs.

This PR is okay to be merged and needs no further changes.

@rarkins rarkins enabled auto-merge (squash) October 19, 2021 07:49
@RahulGautamSingh
Copy link
Collaborator Author

@rarkins It's been 4 hours since auto-merge but the PR hasn't been merged. Are there some requirements still to be met, I can't seem to find any?
Could the skipped test be causing this?

@rarkins
Copy link
Collaborator

rarkins commented Oct 19, 2021

Branches need to be up to date

@rarkins rarkins merged commit 4b16903 into renovatebot:main Oct 19, 2021
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 28.1.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider re2 use for all regex
4 participants