google / styleguide

Style guides for Google-originated open-source projects
https://google.github.io/styleguide/
Apache License 2.0
37.57k stars 13.3k forks source link

cpplint.py requires a particular python version and fails silently with a different version #132

Open bhaller opened 8 years ago

bhaller commented 8 years ago

Hi. This is my first time trying to use cpplint, so my problems are likely to be clueless noob problems, sorry.

I've downloaded the whole styleguide-ghpages branch, and am now trying to run cpplint.py. If I run just the command itself (in my case, since I haven't moved it somewhere sensible yet, by typing /Users/bhaller/Desktop/styleguide-gh-pages/cpplint/cpplint.py), I get the dump of the command syntax etc., so it seems like my python install is OK, and the cpplint.py file is OK, and so forth. However, if I try to actually lint a .cpp file, I get no output at all:

darwin:~/DocumentsSynced/Research/Messer lab/SLiM project/SLiM/core bhaller $ /Users/bhaller/Desktop/styleguide-gh-pages/cpplint/cpplint.py ./slim_sim.cpp darwin:~/DocumentsSynced/Research/Messer lab/SLiM project/SLiM/core bhaller $ ls -l ./slim_sim.cpp -rw-r--r--@ 1 bhaller staff 132287 May 6 11:46 ./slim_sim.cpp

As you can see, the .cpp in question does exist. I would expect a river of error reports, since I make no effort to follow Google's C++ style. (All I want to use cpplint for is its build/include_what_you_use check.)

This is on Mac OS X. I'm using python 3.4.4, since that is what I happen to have installed:

darwin:~/DocumentsSynced/Research/Messer lab/SLiM project/SLiM/core bhaller $ which python /opt/local/bin/python darwin:~/DocumentsSynced/Research/Messer lab/SLiM project/SLiM/core bhaller $ python --version Python 3.4.4

I don't know python at all, so I'm at a loss at to how to proceed with diagnosing the problem. Thanks for any help.

bhaller commented 8 years ago

Well, I figured out how to switch my macports install of python to version 2.7.11, and cpplint.py runs fine and produces output given that. So, progress! I guess the bug here, then, is either that (a) cpplint.py should work with later versions of python such as 3.4.4, or that (b) cpplint.py should detect emit an error message and terminate when run with versions of python with which it is not compatible.

DronMDF commented 7 years ago

I have this problem too...

$ find ./ -name "*.cpp" | xargs python2 ./cpplint.py 
[SKIPPED]
Done processing ./2out/2out/Success.cpp
Done processing ./2out/2out/CountError.cpp
Done processing ./2out/2out/Failure.cpp
Done processing ./2out/2out/TestSuite.cpp
Total errors found: 0
$ find ./ -name "*.cpp" | xargs python ./cpplint.py 
[NO OUTPUT]
$ python
Python 3.6.3 (default, Oct  3 2017, 21:45:48) 
[GCC 7.2.0] on linux

This python is default for ubuntu 17.10.

GeorgeAtKistler commented 1 year ago

Wow, 6 years passed and nobody cared to get it ready for Python 3, what a disappointment :( The readme does not even give a hint, but it got updated a year ago...

JaphyFan commented 1 year ago

你好,你的邮件已收到,我会尽快回复。祝你工作顺利,生活愉快!

aaronliu0130 commented 10 months ago

@GeorgeAtKistler You can use the https://github.com/cpplint/cpplint fork.