Skip to content

Apache DataFusion SQL Query Engine

ARROW-3395: [C++/Python] Add docker container for linting

Korn, Uweb5499966abc3
diff --git a/dev/lint/Dockerfile b/dev/lint/Dockerfile
new file mode 100644
index 0000000000..9b9d2c564c
--- /dev/null
+++ b/dev/lint/Dockerfile
@@ -0,0 +1,48 @@
+# 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.
+
+FROM ubuntu:18.04
+
+RUN apt-get update && \
+ apt-get install -y \
+ gcc \
+ g++ \
+ git \
+ wget \
+ pkg-config \
+ ninja-build \
+ clang-format \
+ clang-tidy
+
+ENV CC=gcc \
+ CXX=g++ \
+ PATH=/opt/conda/bin:$PATH \
+ CONDA_PREFIX=/opt/conda
+
+ADD ci/docker_install_conda.sh \
+ ci/conda_env_cpp.yml \
+ /arrow/ci/
+RUN arrow/ci/docker_install_conda.sh && \
+ conda install -c conda-forge \
+ --file arrow/ci/conda_env_cpp.yml flake8 && \
+ conda clean --all -y
+
+ADD dev/lint/run_checks.sh /run_checks.sh
+ADD dev/lint/run_clang_format.sh /run_clang_format.sh
+
+WORKDIR /tmp
+CMD /run_checks.sh
diff --git a/dev/lint/run_checks.sh b/dev/lint/run_checks.sh
new file mode 100755
index 0000000000..6e7a63d8ee
--- /dev/null
+++ b/dev/lint/run_checks.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# 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.
+
+set -ex
+
+mkdir build_cpp
+pushd build_cpp
+cmake -GNinja /arrow/cpp
+ninja check-format
+ninja lint
+popd
+
+pushd /arrow/python
+flake8 --count pyarrow
+flake8 --count --config=.flake8.cython pyarrow
+popd
diff --git a/dev/lint/run_clang_format.sh b/dev/lint/run_clang_format.sh
new file mode 100755
index 0000000000..2f70836c28
--- /dev/null
+++ b/dev/lint/run_clang_format.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+# 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.
+
+set -ex
+
+mkdir build_cpp
+pushd build_cpp
+cmake -GNinja /arrow/cpp
+ninja format
+popd
diff --git a/docker-compose.yml b/docker-compose.yml
index a96d8ba67f..e407e6ef72 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -111,6 +111,25 @@ services:
context: .
dockerfile: integration/hdfs/Dockerfile
+ lint:
+ image: arrow:lint
+ shm_size: 2G
+ build:
+ context: .
+ dockerfile: dev/lint/Dockerfile
+ volumes:
+ - .:/arrow:delegated
+
+ clang-format:
+ image: arrow:lint
+ shm_size: 2G
+ command: '/run_clang_format.sh'
+ build:
+ context: .
+ dockerfile: dev/lint/Dockerfile
+ volumes:
+ - .:/arrow:delegated
+
# TODO(kszucs): dask-integration
# TODO(kszucs): hive-integration
# TODO(kszucs): spark-integration