|
142 | 142 | filter=+filter1,-filter2,...
|
143 | 143 | exclude_files=regex
|
144 | 144 | linelength=80
|
| 145 | + root=subdir |
145 | 146 |
|
146 | 147 | "set noparent" option prevents cpplint from traversing directory tree
|
147 | 148 | upwards looking for more .cfg files in parent directories. This option
|
|
157 | 158 |
|
158 | 159 | "linelength" allows to specify the allowed line length for the project.
|
159 | 160 |
|
| 161 | + The "root" option is similar in function to the --root flag (see example |
| 162 | + above). |
| 163 | +
|
160 | 164 | CPPLINT.cfg has an effect on files in the same directory and all
|
161 | 165 | sub-directories, unless overridden by a nested configuration file.
|
162 | 166 |
|
@@ -1666,7 +1670,7 @@ def GetHeaderGuardCPPVariable(filename):
|
1666 | 1670 | filename = re.sub(r'/\.flymake/([^/]*)$', r'/\1', filename)
|
1667 | 1671 | # Replace 'c++' with 'cpp'.
|
1668 | 1672 | filename = filename.replace('C++', 'cpp').replace('c++', 'cpp')
|
1669 |
| - |
| 1673 | + |
1670 | 1674 | fileinfo = FileInfo(filename)
|
1671 | 1675 | file_path_from_root = fileinfo.RepositoryName()
|
1672 | 1676 | if _root:
|
@@ -4794,7 +4798,7 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension,
|
4794 | 4798 |
|
4795 | 4799 | # Make Windows paths like Unix.
|
4796 | 4800 | fullname = os.path.abspath(filename).replace('\\', '/')
|
4797 |
| - |
| 4801 | + |
4798 | 4802 | # Perform other checks now that we are sure that this is not an include line
|
4799 | 4803 | CheckCasts(filename, clean_lines, linenum, error)
|
4800 | 4804 | CheckGlobalStatic(filename, clean_lines, linenum, error)
|
@@ -6034,7 +6038,7 @@ def ProcessFileData(filename, file_extension, lines, error,
|
6034 | 6038 | nesting_state.CheckCompletedBlocks(filename, error)
|
6035 | 6039 |
|
6036 | 6040 | CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error)
|
6037 |
| - |
| 6041 | + |
6038 | 6042 | # Check that the .cc file has included its header if it exists.
|
6039 | 6043 | if file_extension == 'cc':
|
6040 | 6044 | CheckHeaderFileIncluded(filename, include_state, error)
|
@@ -6103,6 +6107,9 @@ def ProcessConfigOverrides(filename):
|
6103 | 6107 | _line_length = int(val)
|
6104 | 6108 | except ValueError:
|
6105 | 6109 | sys.stderr.write('Line length must be numeric.')
|
| 6110 | + elif name == 'root': |
| 6111 | + global _root |
| 6112 | + _root = val |
6106 | 6113 | else:
|
6107 | 6114 | sys.stderr.write(
|
6108 | 6115 | 'Invalid configuration option (%s) in file %s\n' %
|
|
0 commit comments