-
Notifications
You must be signed in to change notification settings - Fork 111
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
Added more robust comment format support. #82
Conversation
@@ -175,7 +175,7 @@ def search_copyright_information(content): | |||
year = '\d{4}' | |||
year_range = '%s-%s' % (year, year) | |||
year_or_year_range = '(?:%s|%s)' % (year, year_range) | |||
pattern = '^[^\n\r]?\s*Copyright(?:\s+\(c\))?\s+(%s(?:,\s*%s)*),?\s+([^\n\r]+)$' % \ | |||
pattern = '^[^\n\r]?[\s\*\w]*Copyright(?:\s+\(c\))?\s+(%s(?:,\s*%s)*),?\s+([^\n\r]+)$' % \ |
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'm very hesitant to allow for arbitrary alpha-numeric characters here... I don't know enough about licensing to state if this is valid.
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.
Why is this necessary? Is this aiming to allow newlines anywhere in the comment? Would it be sufficient to only make it flexible within the license?
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 is because of things like
/*
* My Amazing Project
* Copyright (c) 2017
I saw a lot of that in some old willow code (like GMapping).
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 don't think the \*
is needed, however.
@@ -248,6 +249,8 @@ def get_comment_block(content, index): | |||
comment_token = match.group(1) | |||
start_index = match.start(1) | |||
|
|||
if comment_token in ['/*', '/**']: | |||
comment_token = ' *' |
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 is rather unfortunate -- does anyone see a better way?
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 think the leading space should not be required. This should be valid:
/**
* text
*/
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.
Ok -- I can add that functionality.
/**
text
*/
is that also acceptable?
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'm thinking something like this:
if comment_token in ['/*', '/**']:
comment_token = '*'
"""
more code
"""
lines = [line[line.index(comment_token) + 1:] for line in lines]
That works for the existing copyright cases, but not for the new ones.
I've determined I don't have the time to make this as robust as I'd like, as it will require a very significant rewrite in the This PR only supports
because of the |
@allenh1 if you are not working on this anymore, can you reflect it in the labels? (by removing the 'in progress' label from this and the parent issue) |
@mikaelarguedas done |
@wjwwood FYI:
Current cases not covered:
|
@wjwwood @mikaelarguedas Are there any plans to merge this? |
It's not on my todo-list right now. I doubt I'll have time to address it in the short-term. |
Working around ament/ament_lint#82
Working around ament/ament_lint#82
Working around ament/ament_lint#82
Working around ament/ament_lint#82 Signed-off-by: Tully Foote <tfoote@osrfoundation.org>
Closing due to no activity. Recent related work: #160. |
I've tested this as-is with the following:
and got
which seems to be correct (since we don't have a BSD template).
I do not know enough to call this resolved, however.
connects to #75
This change is