MCPcopy Create free account
hub / github.com/BoomingTech/Piccolo / ProcessFile

Function ProcessFile

engine/3rdparty/tinyobjloader/deps/cpplint.py:6124–6209  ·  view source on GitHub ↗

Does google-lint on a single file. Args: filename: The name of the file to parse. vlevel: The level of errors to report. Every error of confidence >= verbose_level will be reported. 0 is a good default. extra_check_functions: An array of additional check functions that will be

(filename, vlevel, extra_check_functions=[])

Source from the content-addressed store, hash-verified

6122
6123
6124def ProcessFile(filename, vlevel, extra_check_functions=[]):
6125 """Does google-lint on a single file.
6126
6127 Args:
6128 filename: The name of the file to parse.
6129
6130 vlevel: The level of errors to report. Every error of confidence
6131 >= verbose_level will be reported. 0 is a good default.
6132
6133 extra_check_functions: An array of additional check functions that will be
6134 run on each source line. Each function takes 4
6135 arguments: filename, clean_lines, line, error
6136 """
6137
6138 _SetVerboseLevel(vlevel)
6139 _BackupFilters()
6140
6141 if not ProcessConfigOverrides(filename):
6142 _RestoreFilters()
6143 return
6144
6145 lf_lines = []
6146 crlf_lines = []
6147 try:
6148 # Support the UNIX convention of using "-" for stdin. Note that
6149 # we are not opening the file with universal newline support
6150 # (which codecs doesn't support anyway), so the resulting lines do
6151 # contain trailing '\r' characters if we are reading a file that
6152 # has CRLF endings.
6153 # If after the split a trailing '\r' is present, it is removed
6154 # below.
6155 if filename == '-':
6156 lines = codecs.StreamReaderWriter(sys.stdin,
6157 codecs.getreader('utf8'),
6158 codecs.getwriter('utf8'),
6159 'replace').read().split('\n')
6160 else:
6161 lines = codecs.open(filename, 'r', 'utf8', 'replace').read().split('\n')
6162
6163 # Remove trailing '\r'.
6164 # The -1 accounts for the extra trailing blank line we get from split()
6165 for linenum in range(len(lines) - 1):
6166 if lines[linenum].endswith('\r'):
6167 lines[linenum] = lines[linenum].rstrip('\r')
6168 crlf_lines.append(linenum + 1)
6169 else:
6170 lf_lines.append(linenum + 1)
6171
6172 except IOError:
6173 sys.stderr.write(
6174 "Skipping input '%s': Can't open for reading\n" % filename)
6175 _RestoreFilters()
6176 return
6177
6178 # Note, if no dot is found, this will give the entire filename as the ext.
6179 file_extension = filename[filename.rfind('.') + 1:]
6180
6181 # When reading from stdin, the extension is unknown, so no cpplint tests

Callers 1

mainFunction · 0.85

Calls 11

_SetVerboseLevelFunction · 0.85
_BackupFiltersFunction · 0.85
ProcessConfigOverridesFunction · 0.85
_RestoreFiltersFunction · 0.85
rangeFunction · 0.85
ProcessFileDataFunction · 0.85
ErrorFunction · 0.85
splitMethod · 0.80
openMethod · 0.45
appendMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected