-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Validate origin format based on issue tracker #47
Conversation
I'm not sure how to validate the origin for Jira or Redmine, but this should validate the others properly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking the time to put together this PR!
Left some comments & suggestions for validating Jira and redmine.
I can help with testing the new validations for all supported issue trackers once you're ready.
Thanks for the comments. I fixed everything you mentioned, but I have a couple of questions. Why does |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few more comments left to make this fully compatible with what's currently supported & for adding more extensive test cases.
@@ -0,0 +1,2 @@ | |||
origin: https://github.com/user/project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also add valid configs for all supported issue trackers:
- Without a scheme provided - e.g.
github.com/user/project
- With
www
provided - e.g.www.github.com/user/project
andhttps://www.github.com/user/project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in defa509
config/config.go
Outdated
@@ -82,6 +90,14 @@ func (l *Local) Validate() []error { | |||
errors = append(errors, err) | |||
} | |||
|
|||
if 0 == len(errors) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is dependent on the order of validations. This shouldn't happen as this piece of validation might as well become first in line in the future.
Instead, change your condition to be independent from the errors
array by validating that the issue tracker is not empty:
if l.IssueTracker != "" {
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in f4977d0
Blocked by #54 |
Hey, the PR blocking this one is now merged. Please pull latest master & continue from there (to enable the CI checks). |
I figured out the testing issue on my end, added a bunch of tests for the regex, and fixed the regex according to your comments. LMK if there's anything else to add. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good this time around in terms of implementation, thanks!
I only have a single comment for the err message format used to report issues with invalid origins.
Solves #25