Remove trailing whitespace from all files

This commit is contained in:
Jan Niklas Hasse
2019-04-17 18:04:28 +02:00
parent b344c79978
commit 71b9648932
6 changed files with 47 additions and 5 deletions
+1
View File
@@ -8,6 +8,7 @@ matrix:
sudo: false
language: cpp
script:
- ./misc/ci.py
- ./configure.py --bootstrap
- ./ninja all
- ./ninja_test --gtest_filter=-SubprocessTest.SetWithLots
+1 -1
View File
@@ -508,7 +508,7 @@ for name in ['build',
'string_piece_util',
'util',
'version']:
objs += cxx(name, variables=cxxvariables)
objs += cxx(name, variables=cxxvariables)
if platform.is_windows():
for name in ['subprocess-win32',
'includes_normalize-win32',
Executable
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env python3
import os
ignores = [
'.git/',
'misc/afl-fuzz-tokens/',
'ninja_deps',
'src/depfile_parser.cc',
'src/lexer.cc',
]
error_count = 0
def error(path, msg):
global error_count
error_count += 1
print('\x1b[1;31m{}\x1b[0;31m{}\x1b[0m'.format(path, msg))
for root, directory, filenames in os.walk('.'):
for filename in filenames:
path = os.path.join(root, filename)[2:]
if any([path.startswith(x) for x in ignores]):
continue
with open(path, 'rb') as file:
line_nr = 1
try:
for line in [x.decode() for x in file.readlines()]:
if len(line) == 0 or line[-1] != '\n':
error(path, ' missing newline at end of file.')
if len(line) > 1:
if line[-2] == '\r':
error(path, ' has Windows line endings.')
break
if line[-2] == ' ' or line[-2] == '\t':
error(path, ':{} has trailing whitespace.'.format(line_nr))
line_nr += 1
except UnicodeError:
pass # binary file
exit(error_count)
+1 -1
View File
@@ -325,7 +325,7 @@ TEST_F(CleanTest, CleanRsp) {
Cleaner cleaner(&state_, config_, &fs_);
ASSERT_EQ(0, cleaner.cleaned_files_count());
ASSERT_EQ(0, cleaner.CleanTarget("out1"));
EXPECT_EQ(2, cleaner.cleaned_files_count());
EXPECT_EQ(2, cleaner.cleaned_files_count());
ASSERT_EQ(0, cleaner.CleanTarget("in2"));
EXPECT_EQ(2, cleaner.cleaned_files_count());
ASSERT_EQ(0, cleaner.CleanRule("cat_rsp"));
+2 -2
View File
@@ -48,7 +48,7 @@ bool DepsLog::OpenForWrite(const string& path, string* err) {
if (!Recompact(path, err))
return false;
}
file_ = fopen(path.c_str(), "ab");
if (!file_) {
*err = strerror(errno);
@@ -331,7 +331,7 @@ bool DepsLog::Recompact(const string& path, string* err) {
// will refer to the ordering in new_log, not in the current log.
for (vector<Node*>::iterator i = nodes_.begin(); i != nodes_.end(); ++i)
(*i)->set_id(-1);
// Write out all deps again.
for (int old_id = 0; old_id < (int)deps_.size(); ++old_id) {
Deps* deps = deps_[old_id];
+1 -1
View File
@@ -75,7 +75,7 @@ COPYRIGHT NOTICE AND DISCLAIMER:
Copyright (C) 1997 Gregory Pietsch
This file and the accompanying getopt.h header file are hereby placed in the
This file and the accompanying getopt.h header file are hereby placed in the
public domain without restrictions. Just give the author credit, don't
claim you wrote it or prevent anyone else from using it.