• Home
  • Raw
  • Download

Lines Matching +full:clang +full:- +full:format +full:- +full:diff

2 """A wrapper script around clang-format, suitable for linting multiple files
4 This is an alternative API for the clang-format command line.
6 A diff output is produced and a sensible exit code is returned.
8 NOTE: pulled from https://github.com/Sarcasm/run-clang-format, which is
39 DIFF = 1 variable in ExitStatus
56 # by modifying it in-place,
80 fromfile='{}\t(original)'.format(file),
81 tofile='{}\t(reformatted)'.format(file),
105 raise UnexpectedError('{}: {}: {}'.format(file, e.__class__.__name__,
111 with io.open(file, 'r', encoding='utf-8') as f:
117 # Use of utf-8 to decode the process output.
122 # - clang-format will returns the bytes read from the files as-is,
123 # without conversion, and it is already assumed that the files use utf-8.
124 # - if the diagnostics were internationalized, they would use utf-8:
125 # > Adding Translations to Clang
128 # > Diagnostic strings should be written in UTF-8,
130 # > Each translation completely replaces the format string
132 # > -- http://clang.llvm.org/docs/InternalsManual.html#internals-diag-translation
137 encoding_py3['encoding'] = 'utf-8'
148 "Command '{}' failed to start: {}".format(
157 encoding = 'utf-8'
166 "Command '{}' returned non-zero exit status {}".format(
192 if line[:4] in ['--- ', '+++ ']:
198 elif line.startswith('-'):
208 sys.stdout.writelines((l.encode('utf-8') for l in diff_lines))
217 print("{}: {} {}".format(prog, error_text, message), file=sys.stderr)
223 '--clang-format-executable',
225 help='path to the clang-format executable',
226 default='clang-format')
228 '--extensions',
229 help='comma separated list of file extensions (default: {})'.format(
233 '-r',
234 '--recursive',
239 '-q',
240 '--quiet',
243 '-j',
247 help='run N clang-format jobs in parallel'
250 '--color',
253 help='show colored diff (default: auto)')
255 '-e',
256 '--exclude',
260 help='exclude paths matching the given glob-like pattern(s)'
265 # use default signal handling, like diff return SIGINT value on ^C
285 version_invocation = [args.clang_format_executable, str("--version")]
294 "Command '{}' failed to start: {}".format(
351 retcode = ExitStatus.DIFF