Greg Sheremeta has posted comments on this change.

Change subject: engine: create tool to scan source code for help tags
......................................................................


Patch Set 3:

(2 comments)

....................................................
File build/doctag.py
Line 85:                                 helpTag = m.group("helpTag")
Line 86:                             helpComment = m.group("helpComment")
Line 87:                             if helpTag in tags:
Line 88:                                 if tags[helpTag] != helpComment:
Line 89:                                     sys.stderr.write("Warning: 
detected help tag with multiple uses and different comments: %s ['%s' != 
'%s'])\n" \
Never heard of pep8 before. Anyway, fixed.
Line 90:                                                      % (helpTag, 
helpComment, tags[helpTag]));
Line 91:                             else:
Line 92:                                 tags[helpTag] = helpComment
Line 93:                         prev_line = line


Line 89:                                     sys.stderr.write("Warning: 
detected help tag with multiple uses and different comments: %s ['%s' != 
'%s'])\n" \
Line 90:                                                      % (helpTag, 
helpComment, tags[helpTag]));
Line 91:                             else:
Line 92:                                 tags[helpTag] = helpComment
Line 93:                         prev_line = line
Relying on the previous line is the best we can do. Hardcoding the token on 
both lines is wrong from a Java perspective. If I try to match tokens, I could 
grab the wrong token. Example


   setHashName("xxx")


   setHelpTag()


   setHelpTag(something(), "la la la")


With using tokens, that second helpTag would grab "xxx", and that's wrong.

Yes, humans are writing the code, but having the match look at the previous 
line works. You'll see that if the previous line fails, it falls back to using 
what it sees on the current line. I believe this is the best solution. When I 
run the doctag.py and generate the template, I will see the places where the 
previous line check failed, and I can always go update the code.

It's a helper tool. It doesn't have to be 100% perfect, and I don't think it 
can be.
Line 94:     return tags
Line 95: 
Line 96: 
Line 97: def produceTemplate(tags, out, format=FORMAT_JSON):


-- 
To view, visit http://gerrit.ovirt.org/21390
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I70a92fd49a00fe7c235d7bc201218a7119dfa425
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Greg Sheremeta <gsher...@redhat.com>
Gerrit-Reviewer: Alexander Wels <aw...@redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com>
Gerrit-Reviewer: Einav Cohen <eco...@redhat.com>
Gerrit-Reviewer: Greg Sheremeta <gsher...@redhat.com>
Gerrit-Reviewer: Vojtech Szocs <vsz...@redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to