Add clang style check as part of the sanity check.
This fix is an effort to add clang style check as part of the sanity check. In `CONTRIBUTING.md` it has been advised to run `clang-format --style=google file.cc` so that Google coding style is conformed. However, there is no sanity check in the current Jenkins build so current .cc and .h files in the repo are not really conforming to the coding style. This actually causes issues. In case a PR is submitted with `clang-format --style=google file.cc`, the reviewer may see additional unrelated changes which might be a distraction. The developer may also spent additional time to manually check for any discrepancies manually with additional unrelated style changes. This fix adds the clang-format check to the ci build so that when `ci_sanity.sh` is running, it will use clang-format to make sure the code is conforming to the coding style as specified in `CONTRIBUTING.md`. One thing that might need to take notice is the header order of the Eigen library. See https://github.com/tensorflow/tensorflow/pull/13907#issuecomment-338718110 for further details. Basically, if Eigen headers could be placed in any order, then no additional steps are needed. Otherwise, it is always possible to place the Eigen headers at the top, then leave one empty line like: ```cpp ``` In this way, even a run of `clang-format -i --style=google file.cc` will still respect the order and leave Eigen header at the top. This PR is experimeal so it only checks `tensorflow/core/ops` directory. Other files could be added if this PR is OK. This PR also sanitizes all files in `tensorflow/core/ops` directory so that it conforms to coding style requirement. Signed-off-by:Yong Tang <yong.tang.github@outlook.com>
Loading
Please sign in to comment