Skip to content

Commit 0249f19

Browse files
romainfrancoiswesm
authored andcommitted
ARROW-4710: [C++][R] New linting script skip files with "cpp" extension
This replaces/finishes @wesm apache#3776, I did not know how to not open my own branch/pr. Author: Romain Francois <romain@purrple.cat> Author: Wes McKinney <wesm+git@apache.org> Closes apache#3835 from romainfrancois/check-cpp-files and squashes the following commits: fc1af04 <Romain Francois> linting 4723913 <Romain Francois> Do not use namespace using-directives 71f11f0 <Romain Francois> linting on feather.cpp e7dfd8e <Romain Francois> #include "./arrow_types.h" db15104 <Wes McKinney> Also run cpplint and clang-format on .cpp files
1 parent d2dbf1e commit 0249f19

26 files changed

Lines changed: 456 additions & 425 deletions

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/RcppExports.cpp

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

r/src/array.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
#include "arrow_types.h"
18+
#include "./arrow_types.h"
1919

20-
using namespace Rcpp;
21-
using namespace arrow;
20+
using Rcpp::LogicalVector;
21+
using Rcpp::no_init;
2222

2323
// [[Rcpp::export]]
2424
std::shared_ptr<arrow::Array> Array__Slice1(const std::shared_ptr<arrow::Array>& array,

0 commit comments

Comments
 (0)