Skip to content

Conversation

@vbatts
Copy link
Member

@vbatts vbatts commented Sep 9, 2015

Initially only a DCO validation for travis

#90

Signed-off-by: Vincent Batts [email protected]

Copy link
Contributor

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.

@vbatts
Copy link
Member Author

vbatts commented Sep 9, 2015

yay. updated, and now that travis is enabled you can see that it also validated the DCO in this PR. :-)

@vbatts vbatts mentioned this pull request Sep 9, 2015
5 tasks
@vbatts
Copy link
Member Author

vbatts commented Sep 9, 2015

@tianon review?

@tianon
Copy link
Member

tianon commented Sep 9, 2015

Adorbs. 👍

@tianon
Copy link
Member

tianon commented Sep 9, 2015

(LGTM)

Copy link
Contributor

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)

Copy link
Member Author

Choose a reason for hiding this comment

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

fair...

@vbatts vbatts force-pushed the validate-dco branch 2 times, most recently from 9fdb70e to cc8a89d Compare September 9, 2015 22:01
Copy link
Contributor

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)

Copy link
Member Author

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.

Copy link
Contributor

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 ;).

Copy link
Contributor

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.

@vbatts
Copy link
Member Author

vbatts commented Sep 9, 2015

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]>
@wking
Copy link
Contributor

wking commented Sep 9, 2015

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:

updated ... PTAL!

8b55acf looks good enough to me. I'd still recommend the --format
updates suggested in 1, but if you'd rather maintain it the way it
is, then I'm happy enough ;).

@vbatts
Copy link
Member Author

vbatts commented Sep 9, 2015

@wking i'm not going to worry about depending on their git version.

@philips
Copy link
Contributor

philips commented Sep 10, 2015

nit: not a huge fan of hiding code. tools without the .tools would be better IMHO

@philips
Copy link
Contributor

philips commented Sep 10, 2015

good start, better than the nothing we have now. LGTM for merge.

@vbatts
Copy link
Member Author

vbatts commented Sep 10, 2015

@philips i only hid it because it's like project housekeeping. If it were in ./tools/ or just ignored but sitting with a name like validate.go it may be expected for specs tools or validation. right?

@vbatts
Copy link
Member Author

vbatts commented Sep 10, 2015

we can move it out later, or just have that kind of git validation be go getable for travis use. For now, I'm going to merge this for DCO enforcement of PRs

vbatts added a commit that referenced this pull request Sep 10, 2015
.tools: repo validation tool
@vbatts vbatts merged commit 2d9842b into opencontainers:master Sep 10, 2015
@vbatts
Copy link
Member Author

vbatts commented Sep 10, 2015

lol. feature needed!

@wking
Copy link
Contributor

wking commented Sep 10, 2015

On Wed, Sep 09, 2015 at 08:17:27PM -0700, Vincent Batts wrote:

we can move it out later, or just have that kind of git validation
be go getable for travis use…

This sounds good to me, especially since “I want to validate PRs
against our project's commit policy” seems like something that other
repositories might want to use too.

@vbatts
Copy link
Member Author

vbatts commented Sep 10, 2015

Yup
On Sep 9, 2015 23:39, "W. Trevor King" [email protected] wrote:

On Wed, Sep 09, 2015 at 08:17:27PM -0700, Vincent Batts wrote:

we can move it out later, or just have that kind of git validation
be go getable for travis use…

This sounds good to me, especially since “I want to validate PRs
against our project's commit policy” seems like something that other
repositories might want to use too.


Reply to this email directly or view it on GitHub
#167 (comment).

@vbatts vbatts deleted the validate-dco branch September 10, 2015 14:49
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.

5 participants