ownwell / google-styleguide

Automatically exported from code.google.com/p/google-styleguide
84 stars 192 forks source link

Project prefix directory not calculated correctly with Mercurial repository #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. mkdir test
2. cd test
3. hg init
4. touch file.h
5. cpplint.py file.h

What is the expected output?
The #ifndef header guard should be relative to project home directory.

stomic@dell07-desktop:~/tmp/test$ python ~/bin/cpplint.py file.h 
file.h:0:  No copyright message found.  You should have a line: "Copyright 
[year] <Copyright Owner>"  [legal/copyright] [5]
file.h:0:  No #ifndef header guard found, suggested CPP variable is: FILE_H_  
[build/header_guard] [5]
Done processing file.h
Total errors found: 2

What do you see instead?

The #ifndef header guard has an absolute path.

file.h:0:  No copyright message found.  You should have a line: "Copyright 
[year] <Copyright Owner>"  [legal/copyright] [5]
file.h:0:  No #ifndef header guard found, suggested CPP variable is: 
_HOME_STOMIC_TMP_TEST_FILE_H_  [build/header_guard] [5]
Done processing file.h
Total errors found: 2

What version of the product are you using? On what operating system?
trunk of cpplint.py

Please provide any additional information below.
Indenting problem of Python code.
Solved easily by un-indenting path generating code. Please check the patch.

stomic@dell07-desktop:~/tmp$ diff ../bin/cpplint.py cpplint.py 
722c722
<       if (os.path.exists(os.path.join(root_dir, ".git")) or

---
>         if (os.path.exists(os.path.join(root_dir, ".git")) or
724,725c724,725
<         prefix = os.path.commonprefix([root_dir, project_dir])
<         return fullname[len(prefix) + 1:]

---
>           prefix = os.path.commonprefix([root_dir, project_dir])
>           return fullname[len(prefix) + 1:]

Original issue reported on code.google.com by tomi...@gmail.com on 3 Sep 2010 at 2:55

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by mmento...@gmail.com on 4 Oct 2010 at 4:29

GoogleCodeExporter commented 9 years ago

Original comment by mmento...@gmail.com on 4 Oct 2010 at 10:10

GoogleCodeExporter commented 9 years ago
Fixed in r59.

Original comment by erg@google.com on 4 Oct 2010 at 10:19