google / styleguide

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

cpplint.py conflict with Code Style Guide in repository #219

Open iyongliang opened 7 years ago

iyongliang commented 7 years ago

I found a question about this. the "repository" option can detect .git directory, and the default path is from second level directory. If I have follow files:

 Example
     - src/
         - hello.h
         - hello.cpp
      - .git/

and in hello.h file,

# ifndef EXAMPLE_SRC_HELLO_H_
# define EXAMPLE_SRC_HELLO_H_
...
# endif  // EXAMPLE_SRC_HELLO_H_

cpplint will waring as: header guard has wrong style.

this can fix by:

python cpplint.py --repository=`cd ..;pwd` src/hello.h

But, when I configure CPPLINT.cfg file, set repository, I found it's a invalid option. and set

root=`cd ..;pwd`

is not working.

So, can you fix it let root support cd ..;pwd or add repository to CPPLINT.cfg.

THX!

PhilipDeegan commented 6 years ago

I just ran into this

I have a git repo @ ~/ for dot files, and it is detected, I would imagine checking if the CD has a .git repo it should be used first