Chromium Code Reviews| Index: cpplint.py |
| diff --git a/cpplint.py b/cpplint.py |
| index ac19165b357d187d392ad7fb59f3f014c7ba3535..c59f55552faa8dcadee82f3733caafa69a8fcc8d 100755 |
| --- a/cpplint.py |
| +++ b/cpplint.py |
| @@ -524,6 +524,10 @@ _error_suppressions = {} |
| # This is set by --root flag. |
| _root = None |
| +# The project root directory. Used for deriving header guard CPP variable. |
| +# This is set by --project_root flag. |
| +_project_root = None |
|
iannucci
2016/06/03 19:23:09
I'm assuming that this is supposed to be an absolu
sdefresne
2016/06/04 11:42:35
Done.
|
| + |
| # The allowed line length of files. |
| # This is set by --linelength flag. |
| _line_length = 80 |
| @@ -1065,6 +1069,10 @@ class FileInfo(object): |
| if os.path.exists(fullname): |
| project_dir = os.path.dirname(fullname) |
| + if _project_root: |
| + prefix = os.path.commonprefix([_project_root, project_dir]) |
| + return fullname[len(prefix) + 1:] |
| + |
| if os.path.exists(os.path.join(project_dir, ".svn")): |
| # If there's a .svn file in the current directory, we recursively look |
| # up the directory tree for the top of the SVN checkout |
| @@ -6017,7 +6025,8 @@ def ParseArguments(args): |
| 'filter=', |
| 'root=', |
| 'linelength=', |
| - 'extensions=']) |
| + 'extensions=', |
| + 'project_root=']) |
| except getopt.GetoptError: |
| PrintUsage('Invalid arguments.') |
| @@ -6046,6 +6055,9 @@ def ParseArguments(args): |
| elif opt == '--root': |
| global _root |
| _root = val |
| + elif opt == '--project_root': |
| + global _project_root |
| + _project_root = val |
| elif opt == '--linelength': |
| global _line_length |
| try: |