Skip to content

Apache DataFusion SQL Query Engine

ARROW-3313: [R] Move .clang-format to top level. Add r/lint.sh script for linting R C++ files in Travis CI

Wes McKinney52b4b8faa952
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000000..06453dfbb2
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+---
+BasedOnStyle: Google
+DerivePointerAlignment: false
+ColumnLimit: 90
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 0000000000..b05faa4e62
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,29 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+---
+Checks: 'clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,google-*,modernize-*,readability-*'
+HeaderFilterRegex: 'arrow/.*'
+AnalyzeTemporaryDtors: true
+CheckOptions:
+ - key: google-readability-braces-around-statements.ShortStatementLines
+ value: '1'
+ - key: google-readability-function-size.StatementThreshold
+ value: '800'
+ - key: google-readability-namespace-comments.ShortNamespaceLines
+ value: '10'
+ - key: google-readability-namespace-comments.SpacesBeforeComments
+ value: '2'
diff --git a/.clang-tidy-ignore b/.clang-tidy-ignore
new file mode 100644
index 0000000000..3270b973f2
--- /dev/null
+++ b/.clang-tidy-ignore
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+ipc-adapter-test.cc
+memory-pool-test.cc
diff --git a/.travis.yml b/.travis.yml
index e37c926557..9e347c1a13 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -249,11 +249,14 @@ matrix:
- language: r
cache: packages
latex: false
+ before_script:
+ - if [ $ARROW_CI_R_AFFECTED != "1" ]; then exit; fi
before_install:
- $TRAVIS_BUILD_DIR/ci/travis_install_linux.sh
- $TRAVIS_BUILD_DIR/ci/travis_before_script_cpp.sh --only-library
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TRAVIS_BUILD_DIR/cpp-install/lib
- export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$TRAVIS_BUILD_DIR/cpp-install/lib/pkgconfig
+ - $TRAVIS_BUILD_DIR/ci/travis_lint.sh
- pushd ${TRAVIS_BUILD_DIR}/r
diff --git a/ci/detect-changes.py b/ci/detect-changes.py
index df041b921c..e9a647c5e6 100644
--- a/ci/detect-changes.py
+++ b/ci/detect-changes.py
@@ -26,7 +26,8 @@ import subprocess
perr = functools.partial(print, file=sys.stderr)
-LANGUAGE_TOPICS = ['c_glib', 'cpp', 'go', 'java', 'js', 'python', 'ruby', 'rust']
+LANGUAGE_TOPICS = ['c_glib', 'cpp', 'go', 'java', 'js', 'python',
+ 'r', 'ruby', 'rust']
ALL_TOPICS = LANGUAGE_TOPICS + ['integration', 'site', 'dev']
@@ -66,7 +67,8 @@ def get_travis_head_commit():
def get_travis_commit_range():
cr = os.environ['TRAVIS_COMMIT_RANGE']
- # See https://github.com/travis-ci/travis-ci/issues/4596#issuecomment-139811122
+ # See
+ # https://github.com/travis-ci/travis-ci/issues/4596#issuecomment-139811122
return cr.replace('...', '..')
@@ -136,7 +138,7 @@ def get_affected_topics(affected_files):
break
elif p in ('cpp', 'format'):
# Test C++ and bindings to the C++ library
- for k in ('cpp', 'python', 'c_glib', 'ruby', 'integration'):
+ for k in ('cpp', 'python', 'c_glib', 'r', 'ruby', 'integration'):
affected[k] = True
elif p in ('java', 'js'):
affected[p] = True
@@ -144,8 +146,8 @@ def get_affected_topics(affected_files):
elif p in ('c_glib'):
affected[p] = True
affected['ruby'] = True
- elif p in ('go', 'integration', 'python', 'ruby', 'rust', 'site',
- 'dev'):
+ elif p in ('go', 'integration', 'python', 'r', 'ruby', 'rust',
+ 'site', 'dev'):
affected[p] = True
return affected
@@ -174,8 +176,8 @@ def get_windows_shell_eval(env):
def run_from_travis():
if (os.environ['TRAVIS_REPO_SLUG'] == 'apache/arrow' and
- os.environ['TRAVIS_BRANCH'] == 'master' and
- os.environ['TRAVIS_EVENT_TYPE'] != 'pull_request'):
+ os.environ['TRAVIS_BRANCH'] == 'master' and
+ os.environ['TRAVIS_EVENT_TYPE'] != 'pull_request'):
# Never skip anything on master builds in the official repository
affected = dict.fromkeys(ALL_TOPICS, True)
else:
@@ -219,14 +221,14 @@ if __name__ == "__main__":
if os.environ.get('TRAVIS'):
try:
print(run_from_travis())
- except:
+ except Exception:
# Make sure the enclosing eval will return an error
print("exit 1")
raise
elif os.environ.get('APPVEYOR'):
try:
print(run_from_appveyor())
- except:
+ except Exception:
print("exit 1")
raise
else:
diff --git a/ci/travis_lint.sh b/ci/travis_lint.sh
index 8ebb58483f..b8059f07ae 100755
--- a/ci/travis_lint.sh
+++ b/ci/travis_lint.sh
@@ -65,3 +65,9 @@ if [ "$ARROW_CI_PYTHON_AFFECTED" != "0" ]; then
--config=$ARROW_PYTHON_DIR/.flake8.cython \
$ARROW_PYTHON_DIR
fi
+
+if [ "$ARROW_CI_R_AFFECTED" != "0" ]; then
+ pushd $ARROW_R_DIR
+ ./lint.sh
+ popd
+fi