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

Infer system includes #110

Merged
merged 5 commits into from
Sep 7, 2017
Merged

Infer system includes #110

merged 5 commits into from
Sep 7, 2017

Conversation

esquires
Copy link
Contributor

@esquires esquires commented Sep 4, 2017

This resolves issue #109

Copy link
Owner

@myint myint left a comment

Choose a reason for hiding this comment

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

Thanks! Other than my comments, a test case would be useful to help me verify that this does what it intends to do. Perhaps add a test to https://github.com/myint/cppclean/blob/master/test.bash.

cppclean Outdated
@@ -88,6 +88,17 @@ def main():
help='add a header include path; '
'specify this multiple times for multiple '
'include paths')
parser.add_argument('--include-path-system', '-is', '-Is', action='append',
Copy link
Owner

Choose a reason for hiding this comment

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

These short options seem a bit at odds with normal POSIX options, where -is would be equivalent to -i and -s.

Could you either rename it or remove it?

cppclean Outdated
@@ -88,6 +88,17 @@ def main():
help='add a header include path; '
'specify this multiple times for multiple '
'include paths')
parser.add_argument('--include-path-system', '-is', '-Is', action='append',
dest='include_system_paths', default=[],
Copy link
Owner

Choose a reason for hiding this comment

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

Could you add a metavar='path' like in the --include-path option. Otherwise, the --help gets a bit messy:

  --include-path path, -i path, -I path
                        add a header include path; specify this multiple times
                        for multiple include paths
  --include-path-system INCLUDE_SYSTEM_PATHS, -is INCLUDE_SYSTEM_PATHS, -Is INCLUDE_SYSTEM_PATHS
                        same as --include-path but explicitly designates all
                        header files found in thesedirectories as "system"
                        includes
  --include-path-non-system INCLUDE_NONSYSTEM_PATHS, -in INCLUDE_NONSYSTEM_PATHS, -In INCLUDE_NONSYSTEM_PATHS
                        same as --include-path but explicitly designates all
                        header files found in thesedirectories as "non-system"
                        includes

@esquires
Copy link
Contributor Author

esquires commented Sep 5, 2017

No problem. I just pushed a change that does the following:

  1. Removes the -is and -in options
  2. Adds metavars
  3. Adds a test

test_ast.py Outdated
@@ -1060,6 +1061,35 @@ def test_system_include(self):
self.assertEqual(1, len(nodes), repr(nodes))
self.assertEqual(Include('vector', system=True), nodes[0])

def test_system_include(self):
Copy link
Owner

Choose a reason for hiding this comment

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

It looks like test_system_include() shadows the test_system_include() that is defined a few lines above.

cppclean Outdated
@@ -88,6 +88,19 @@ def main():
help='add a header include path; '
'specify this multiple times for multiple '
'include paths')
parser.add_argument('--include-path-system', '-Is', action='append',
Copy link
Owner

Choose a reason for hiding this comment

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

Could you also remove the -Is and -In for the same reasoning from my previous post. A single letter option (or nothing at all) would be fine.

@esquires
Copy link
Contributor Author

esquires commented Sep 6, 2017

Sure thing. I used "-S" and "-N" for system/non-system includes so there was a shortcut available. I also renamed the test function. Let me know if you need anything else.

@esquires esquires closed this Sep 6, 2017
@esquires esquires deleted the infer-system-includes branch September 6, 2017 17:41
@esquires esquires restored the infer-system-includes branch September 6, 2017 17:41
@esquires esquires reopened this Sep 6, 2017
@@ -88,6 +88,19 @@ def main():
help='add a header include path; '
'specify this multiple times for multiple '
'include paths')
parser.add_argument('--include-path-system', '-S', action='append',
Copy link
Owner

Choose a reason for hiding this comment

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

Let's just use lower case -s and -n. I'll merge it afterwards. Thanks for sticking with this!

Copy link
Owner

@myint myint Sep 7, 2017

Choose a reason for hiding this comment

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

Actually, I can just do that after merging. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem. Thanks for merging.

@myint myint merged commit c710f76 into myint:master Sep 7, 2017
@myint myint mentioned this pull request Sep 9, 2017
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

2 participants