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

add flags to set custom issue and pr regex #8

Closed
wants to merge 3 commits into from
Closed

add flags to set custom issue and pr regex #8

wants to merge 3 commits into from

Conversation

xoxys
Copy link

@xoxys xoxys commented Oct 6, 2020

Addressing #5

@xoxys
Copy link
Author

xoxys commented Oct 6, 2020

@fd0 Unfortunately it took a bit longer to get back to it, sorry. Not sure what is the best way to test multiple regex variations, so tests for e.g. Gitea regex are currently missing.

main.go Outdated Show resolved Hide resolved
@xoxys xoxys requested a review from rawtaz October 6, 2020 20:47
main.go Outdated Show resolved Hide resolved
@rawtaz
Copy link
Contributor

rawtaz commented Oct 6, 2020

I haven't checked the code but here's a question: Is there any chance that the regex matching will be performed on anything else than the very last set of lines with URLs? Or is it written in such a way that the last part in a changelog file is what's looked through using these regexs, and not all of it?

@xoxys
Copy link
Author

xoxys commented Oct 6, 2020

I have also thought about it, and I am still not sure. There might be cases where the git server is run as a subfolder (though unlikely). Then the URL would be e.g. example.com/git/user/reponame/issues/1234 and you would need to use a regex like this /.*/.*/.*/issues/(\d+).

@rawtaz
Copy link
Contributor

rawtaz commented Oct 6, 2020

In that case I think the current regex, .*/.*/issues/(\d+) would match just fine, it would disregard the first /foo part and match on the rest.

Regardless, I think my former question is moot, considering Calens has been working just fine with the current format of regex.

@xoxys
Copy link
Author

xoxys commented Oct 6, 2020

The current regex starts with a / so I guess this will not work. But maybe I'm wrong.

@rawtaz
Copy link
Contributor

rawtaz commented Oct 6, 2020

In line https://github.com/restic/calens/blob/master/main.go#L365 it looks like the code finds the match it can find, and since there are no anchors in the regex this should match even if there's some stuff before the pattern you target. But to be sure, I suggest you try it with a subfolder URL like you mentioned earlier.

I think https://github.com/restic/calens/blob/master/main.go#L322 shows that links are only processed in the very last set of lines (the last paragraph, if you will).

@xoxys xoxys closed this Apr 6, 2021
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.

2 participants