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

CPPLintBear.py: Verify indentation and spaces #2105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

swapagarwal
Copy link
Member

cpplint only performs indentation checking using 2 spaces, according
to https://google.github.io/styleguide/cppguide.html#Spaces_vs._Tabs
Add check_invalid_configuration function to CPPLintBear.py.
Add tests for invalid configurations.

Fixes #896

For short term contributors: we understand that getting your commits well
defined like we require is a hard task and takes some learning. If you
look to help without wanting to contribute long term there's no need
for you to learn this. Just drop us a message and we'll take care of brushing
up your stuff for merge!

Checklist

  • I read the commit guidelines and I've followed
    them.
  • I ran coala over my code locally. (All commits have to pass
    individually.
    It is not sufficient to have "fixup commits" on your PR,
    our bot will still report the issues for the previous commit.) You will
    likely receive a lot of bot comments and build failures if coala does not
    pass on every single commit!

After you submit your pull request, DO NOT click the 'Update Branch' button.
When asked for a rebase, consult coala.io/rebase
instead.

Please consider helping us by reviewing other peoples pull requests as well:

The more you review, the more your score will grow at coala.io and we will
review your PRs faster!

`cpplint` only performs indentation checking using 2 spaces, according
to https://google.github.io/styleguide/cppguide.html#Spaces_vs._Tabs
Add check_invalid_configuration function to CPPLintBear.py.
Add tests for invalid configurations.

Fixes coala#896
@@ -26,12 +32,17 @@ class CPPLintBear:
def create_arguments(filename, file, config_file,
max_line_length: int=79,
cpplint_ignore: typed_list(str)=(),
cpplint_include: typed_list(str)=()):
cpplint_include: typed_list(str)=(),
indent_size: int=2,
Copy link
Member

Choose a reason for hiding this comment

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

Do we want these as defaults or do we want the user to fail without any given argument. With a default value, users might think 4 just works. But I guess they should read the docs and then they'd see.

Copy link
Member Author

Choose a reason for hiding this comment

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

Case A: Fails without any given argument. Then maybe they set this argument to 4, which fails again. Then they read the docs and set it to 2.
Case B: Works by default. If user wants to override, docs clearly call out the permitted value.
Thoughts?

cpplint_include: typed_list(str)=()):
cpplint_include: typed_list(str)=(),
indent_size: int=2,
use_spaces: bool=True):
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any other way to check what kind of indent_size the user is using than relying on the user himself to give that information? Also does this fix it in case the indent_size is not matching or the user is using tabs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

CPPLintBear should error when use_spaces is False or indent_size is not 2
5 participants