Skip to content
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

Extend copyright checker to allow for doxygen-style copyright #108

Merged
merged 1 commit into from
Sep 12, 2018

Conversation

jpsamper2009
Copy link
Contributor

@jpsamper2009 jpsamper2009 commented Sep 10, 2018

Description

This MR extends the copyright checker's regex to allow doxygen-style copyright:

  • Add an optional, non-matching group for \copyright => (?:\\\copyright\s*)?
    • (?:<stuff>) -> Non-capturing group which means that later on in the code, the indexes for the matching groups won't have to change
    • \\\copyright -> \copyright with the \ escaped
    • \s* -> Any whitespace (or none) after \copyright
    • (<stuff>)? -> Optional match
  • Allow \\\ in comment blocks

For example, it allows you to (optionally) use:

/// \copyright Copyright 2015 Open Source Robotics Foundation, Inc.
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
///     http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.

How to test

  1. Copy paste the copyright header above into a file (test_copyright.c)
$ ament_copyright test_copyright.c
No errors, checked 1 files
  1. Files with the non-doxygen style copyright header should continue to pass the checks

@tfoote tfoote added the in review Waiting for review (Kanban column) label Sep 10, 2018
Copy link
Contributor

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me, though regex are not my strong suite, does anyone else on the ROS team have an issue with the changes to the regular expressions?

Copy link
Contributor

@dirk-thomas dirk-thomas left a comment

Choose a reason for hiding this comment

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

lgtm

@wjwwood
Copy link
Contributor

wjwwood commented Sep 11, 2018

CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@jpsamper2009
Copy link
Contributor Author

@wjwwood Re: regex are not my strong suite

I added a breakdown in the description for future reference

@wjwwood
Copy link
Contributor

wjwwood commented Sep 12, 2018

Thanks that's really helpful. Looks like the test failures on Linux are unrelated.

@wjwwood wjwwood merged commit 9f044f7 into ament:master Sep 12, 2018
@wjwwood wjwwood removed the in review Waiting for review (Kanban column) label Sep 12, 2018
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.

None yet

4 participants