In Impala we use 2 spaces for indentation, however for continuation
lines we use 4 spaces (or more if it makes the code look nicer).
This violates Flake8's rule E126 which generates noise during
code reviews.
This patch adds E126 to the list of ignored rules.
Change-Id: I1beb76feed90ee524d5c2c27487561891958e54c
Reviewed-on: http://gerrit.cloudera.org:8080/18836
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Reviewed-by: Michael Smith <michael.smith@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Updates flake8 to the latest Python 2-compatible version so we can use
indent-size=2. Our code uses 2-space indents and we have previously
worked around or disabled flake8 checks that rely on 4-space indenting.
Change-Id: Ia701f6e3d86be451ae86d041b799c8a10aee2d93
Reviewed-on: http://gerrit.cloudera.org:8080/18669
Reviewed-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
PEP8 now reads that breaking before or after binary operators is fine,
and gives the rationale:
But this can hurt readability in two ways: the operators tend to
get scattered across different columns on the screen, and each
operator is moved away from its operand and onto the previous
line.
Change-Id: Ieedde356f613ce57caf3fe190fb44e0404337f97
Reviewed-on: http://gerrit.cloudera.org:8080/11196
Reviewed-by: Jim Apple <jbapple-impala@apache.org>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
I got feedback that the flake8 rules are a little too strict, so based
on the dev@impala.apache.org discussion am disabling some of them.
I left E302 "expected 2 blank lines, found 1" enabled since I think it
would force our formatting to be more consistent, but I'm open to
changing that.
I used the following command to get a sense of the number of existing
violations:
EXCLUDES=ext-py,shell/build,gerrit_critic_venv,infra/python/env
EXCLUDES+=,shell/pkg_resources.py,shell/thrift_sasl.py,gen-py
EXCLUDES+=,TPC-DS-master,toolchain
./bin/impala-flake8 --exclude=${EXCLUDES}
Change-Id: Iaaa8377025e732231ac0f1f1f2db67298a171997
Reviewed-on: http://gerrit.cloudera.org:8080/11102
Reviewed-by: Tim Armstrong <tarmstrong@cloudera.com>
Tested-by: Tim Armstrong <tarmstrong@cloudera.com>
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 <mikeb@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>