Skip to content

Commit db15104

Browse files
wesmromainfrancois
authored andcommitted
Also run cpplint and clang-format on .cpp files
1 parent d2dbf1e commit db15104

5 files changed

Lines changed: 309 additions & 280 deletions

File tree

cpp/build-support/lintutils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,15 @@ def run_parallel(cmds, **kwargs):
6666
_source_extensions = '''
6767
.h
6868
.cc
69+
.cpp
6970
'''.split()
7071

7172

7273
def get_sources(source_dir, exclude_globs=[]):
7374
sources = []
7475
for directory, subdirs, basenames in os.walk(source_dir):
75-
for path in [os.path.join(directory, basename) for basename in basenames]:
76+
for path in [os.path.join(directory, basename)
77+
for basename in basenames]:
7678
# filter out non-source files
7779
if os.path.splitext(path)[1] not in _source_extensions:
7880
continue

cpp/build-support/run_cpplint.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ def _check_some_files(completed_processes, filenames):
110110
# distill a list of problematic files
111111
for problem_files, stdout in pool.imap(checker, chunks):
112112
if problem_files:
113-
msg = "{} had cpplint issues"
114-
print("\n".join(map(msg.format, problem_files)))
115113
if isinstance(stdout, bytes):
116114
stdout = stdout.decode('utf8')
117115
print(stdout, file=sys.stderr)

r/clang_format.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
20+
SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
21+
CPP_BUILD_SUPPORT=$SOURCE_DIR/../cpp/build-support
22+
23+
# Run clang-format
24+
CLANG_FORMAT=clang-format-7
25+
$CPP_BUILD_SUPPORT/run_clang_format.py \
26+
--clang_format_binary=$CLANG_FORMAT \
27+
--exclude_glob=$CPP_BUILD_SUPPORT/lint_exclusions.txt \
28+
--source_dir=$SOURCE_DIR/src --quiet --fix $1

r/src/array__to_vector.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,7 @@ class Converter_Decimal : public Converter {
468468
*p_data = bitmap_reader.IsSet() ? std::stod(decimals_arr.FormatValue(i).c_str())
469469
: NA_REAL;
470470
}
471-
}
472-
else {
471+
} else {
473472
for (size_t i = 0; i < n; i++, ++p_data) {
474473
*p_data = std::stod(decimals_arr.FormatValue(i).c_str());
475474
}

0 commit comments

Comments
 (0)