You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2018/04/26 01:15:08 UTC

impala git commit: add impala-flake8

Repository: impala
Updated Branches:
  refs/heads/2.x c66096523 -> 8dc867561


add impala-flake8

Add flake8 and dependencies to impala-python. The versions are
compatible with Python 2.6.6. Add the impala-flake8 entry point, similar
to impala-python.

Add setup.cfg which defines flake8 special rules and exemptions. They
are added to support 2-space indents and a max line length of 90.

Contributors writing Python can use impala-flake8 to look for formatting
mistakes. The two most common uses would be:

impala-flake8 myfile.py
or
git diff HEAD^ myfile.py | impala-flake8 --diff

In the second usage, flake8 will only examine lines changed. This allows
a contributor to fix their own code and not be penalized by flake8
violations that may already be present (though they are encouraged to
fix them if they can!)

Change-Id: Ib4ce9eca6f8b55eaec1c96e7db1ff630ac016be0
Reviewed-on: http://gerrit.cloudera.org:8080/10182
Reviewed-by: Michael Brown <mi...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/impala/commit/8dc86756
Tree: http://git-wip-us.apache.org/repos/asf/impala/tree/8dc86756
Diff: http://git-wip-us.apache.org/repos/asf/impala/diff/8dc86756

Branch: refs/heads/2.x
Commit: 8dc867561872fe403dadd6e94fb1ca066028ec4b
Parents: c660965
Author: Michael Brown <mi...@cloudera.com>
Authored: Mon Apr 23 13:37:20 2018 -0700
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Wed Apr 25 21:10:16 2018 +0000

----------------------------------------------------------------------
 bin/impala-flake8                  | 21 +++++++++++++++++++++
 infra/python/deps/requirements.txt |  4 ++++
 setup.cfg                          | 22 ++++++++++++++++++++++
 3 files changed, 47 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/impala/blob/8dc86756/bin/impala-flake8
----------------------------------------------------------------------
diff --git a/bin/impala-flake8 b/bin/impala-flake8
new file mode 100755
index 0000000..f1e905e
--- /dev/null
+++ b/bin/impala-flake8
@@ -0,0 +1,21 @@
+#!/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.
+
+source "$(dirname "$0")/impala-python-common.sh"
+exec "$PY_DIR/env/bin/flake8" "$@"

http://git-wip-us.apache.org/repos/asf/impala/blob/8dc86756/infra/python/deps/requirements.txt
----------------------------------------------------------------------
diff --git a/infra/python/deps/requirements.txt b/infra/python/deps/requirements.txt
index 06868f8..b0b7f23 100644
--- a/infra/python/deps/requirements.txt
+++ b/infra/python/deps/requirements.txt
@@ -34,6 +34,10 @@ boto3 == 1.2.3
 cm-api == 10.0.0
   # Already available as part of python on Linux.
   readline == 6.2.4.1; sys_platform == 'darwin'
+flake8 == 2.6.2
+  mccabe == 0.3.1
+  pycodestyle == 2.0.0
+  pyflakes == 1.2.3
 Flask == 0.10.1
   Jinja2 == 2.8
   MarkupSafe == 0.23

http://git-wip-us.apache.org/repos/asf/impala/blob/8dc86756/setup.cfg
----------------------------------------------------------------------
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..a3178ba
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,22 @@
+# 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.
+[flake8]
+# These are ignored in order to support 2-space indents.
+# https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
+ignore = E111,E114
+# Change from default to conform to Apache Impala line length.
+max-line-length = 90