-
Notifications
You must be signed in to change notification settings - Fork 595
.tools: repo validation tool #167
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
Conversation
.tools/validate.go
Outdated
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.
We should probably either drop this debugging comment or uncomment it and put it behind a flag before landing this PR.
|
yay. updated, and now that travis is enabled you can see that it also validated the DCO in this PR. :-) |
|
@tianon review? |
|
Adorbs. 👍 |
|
(LGTM) |
.tools/validate.go
Outdated
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.
If we never return anything other than nil for err, I'd just make the signature:
func(c CommitEntry) (vr ValidateResult)
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.
fair...
9fdb70e to
cc8a89d
Compare
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.
Does Go not have an equivalent of Python's setattr? In Python, I'd make this:
for format, keys in [
('%s', ['subject']),
…
('%cE', ['committer', 'email']),
]:
value = …
obj = commit
for key in keys[:-1]:
obj = getattr(obj, key)
setattr(obj, keys[-1], value)
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.
Not without reflect, which is overkill for doing a simple loop.
On Sep 9, 2015 6:02 PM, "W. Trevor King" [email protected] wrote:
In .tools/validate.go
#167 (comment):
- if err != nil {
return nil, err- }
- c.Author.Email = strings.TrimSpace(string(output))
- output, err = exec.Command("git", "log", "-1", prettyLogCommiterName, commit).Output()
- if err != nil {
return nil, err- }
- c.Commiter.Name = strings.TrimSpace(string(output))
- output, err = exec.Command("git", "log", "-1", prettyLogCommiterEmail, commit).Output()
- if err != nil {
return nil, err- }
- c.Commiter.Email = strings.TrimSpace(string(output))
Does Go not have an equivalent of Python's setattr? In Python, I'd make
this:for format, keys in [
('%s', ['subject']),
…
('%cE', ['committer', 'email']),
]:
value = …
obj = commit
for key in keys[:-1]:
obj = getattr(obj, key)
setattr(obj, keys[-1], value)—
Reply to this email directly or view it on GitHub
https://github.com/opencontainers/specs/pull/167/files#r39102627.
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.
On Wed, Sep 09, 2015 at 03:08:43PM -0700, Vincent Batts wrote:
Not without reflect, which is overkill for doing a simple loop.
Ah bummer. And I have a friend who would be waving his Lisp-y
parenthesis at this too ;).
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.
Using the map instead of the structure can avoid reflect. Even using reflect, it is much simpler than current code IMO.
|
updated ... PTAL! |
Initially only a DCO validation for travis, but is set up for further validation on commits as well. opencontainers#90 Signed-off-by: Vincent Batts <[email protected]>
|
GitHub seems to have eaten my emailed response, so I'll repeat it here: On Wed, Sep 09, 2015 at 03:15:53PM -0700, Vincent Batts wrote:
8b55acf looks good enough to me. I'd still recommend the --format |
|
@wking i'm not going to worry about depending on their git version. |
|
nit: not a huge fan of hiding code. tools without the .tools would be better IMHO |
|
good start, better than the nothing we have now. LGTM for merge. |
|
@philips i only hid it because it's like project housekeeping. If it were in |
|
we can move it out later, or just have that kind of git validation be |
|
lol. feature needed! |
|
On Wed, Sep 09, 2015 at 08:17:27PM -0700, Vincent Batts wrote:
This sounds good to me, especially since “I want to validate PRs |
|
Yup
|
Initially only a DCO validation for travis
#90
Signed-off-by: Vincent Batts [email protected]