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

Support c extension for cpplint.py #29

Open
groegeorg opened this issue Dec 19, 2017 · 3 comments
Open

Support c extension for cpplint.py #29

groegeorg opened this issue Dec 19, 2017 · 3 comments

Comments

@groegeorg
Copy link

It doesn't seem to be possible to run cpplint.py on *.c files with this plugin. On the command line I can run cpplint.py --extensions=c,h foo.c, but I can't give an argument to cpplint.py in the CppStyle settings dialog.

I even tried to make cpplint.py natively support the c extension, by amending the variable _valid_extensions in the Python code. Then it works on the command line even without the --extensions= argument. But strangely, CppStyle still doesn't work with *.c files.

Are there any plans to support this, or is there any possible workaround?

@wangzw
Copy link
Owner

wangzw commented Dec 21, 2017

screen shot 2017-12-21 at 13 54 44

As a workaround you can set *.c in project settings.

cpplint.py is a tool for c++, so *.c is not in the scope, correct me if I'm wrong.

@groegeorg
Copy link
Author

I didn't know this option, thanks for the hint! However, even with adding *.c to the list or removing all entries from the list, cppstyle.py doesn't output anything for .c files :-(

Also, having to modify this list of file extensions manually for every single checker (there are around 60!) is more than cumbersome...

You are right, cpplint.py is meant for C++, as is the Google C++ Style Guide. We use the Google Style Guide for our C++ projects, but we also have a fair amount of C projects and don't want to introduce a new coding style for those. Since C is (more or less) a subset of C++, the rules of the Google Style Guide can also be applied fairly well to C code. All we need is a style checker tool, because without it any rule is useless. It would be a pity if we can't use cpplint.py, just because of the file extension...

@Krozark
Copy link

Krozark commented Sep 14, 2018

The same is true for .hpp file. cpplint is not called.
If I understand the pluggin, the trouble is here :

There is some hard codded extension restriction, even if the documentation say that EVERY file save is pass to cpplint. The correct way is to remove any existing restriction, has cpplint olready have a configurations file for this.

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

No branches or pull requests

3 participants