...
- All source files should include the standard Apache license header.
- All lines should be limited to 90 characters in width
- Remove trailing whitespace. To automate this, install pre-commit.sh into .git/hooks/pre-commit and make it executable.
C++
...
- Currently undocumented - new code should follow existing style conventions. Note that you should use clang-format to automatically reformat Java code, as described in the C++ Style Guide
Thrift
We don't have a formal style guide, but we do adhere to a few conventions:
...
- We wrap lines at 90 characters (instead of 80)
- We use 2 spaces indent (instead of 4)
We
...
automatically run flake8-diff on jobs pre-commit to report style violations on lines that patches modify. It is configured using setup.cfg in the Impala repository.
You can run flake8 in several ways. Note that a lot of existing Python code in Impala doesn't meet our current style standards. We fix such issues incrementally when we modify the code.
Code Block | ||
---|---|---|
| ||
# Works in an Impala development environment. Lists all violations for a file or subdirectory.
impala-flake8 <path to file>
# Show newly introduced violations for your current HEAD commit in git.
# Requires you to install flake8-diff separately.
flake8-diff HEAD^ HEAD
# Generate the same violations as the Impala jenkins bot for your current HEAD commit in git.
./bin/jenkins/critique-gerrit-review.py --dryrun
|
The following tools have also been found useful by developers to scan and/or automatically fix formatting issues:
...