Skip to content

Commit

Permalink
Remove pylint check (#985)
Browse files Browse the repository at this point in the history
* Remove pylint check

This PR removes pylint check, as was discussed in 980.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Also remove pylint in .github/workflows/build.yml

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>

* Add empty commit to push GitHub CI

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
  • Loading branch information
yongtang committed May 26, 2020
1 parent 0a6dff9 commit bb98a38
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 453 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Expand Up @@ -25,7 +25,7 @@ jobs:
BAZEL_OS=$(uname | tr '[:upper:]' '[:lower:]')
curl -sSOL https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-${BAZEL_OS}-x86_64.sh
sudo bash -e bazel-${BAZEL_VERSION}-installer-${BAZEL_OS}-x86_64.sh
bazel run -s --verbose_failures //tools/lint:check -- bazel pylint pyupgrade black
bazel run -s --verbose_failures //tools/lint:check -- bazel pyupgrade black
macos:
name: macOS
Expand Down
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -114,7 +114,7 @@ version of TensorFlow I/O according to the table below:

### Lint

TensorFlow I/O's code conforms through Pylint, Bazel Buildifier, Clang Format, Black, and Pyupgrade. The following will check the source code and report any lint issues:
TensorFlow I/O's code conforms through Bazel Buildifier, Clang Format, Black, and Pyupgrade. The following will check the source code and report any lint issues:
```sh
bazel run //tools/lint:check
```
Expand All @@ -124,11 +124,11 @@ For Bazel Buildifier and Clang Format, the following will automatically fix and
bazel run //tools/lint:lint
```

Alternatively, if you only want to perform lint check on one aespect, then you can selectively pass `pylint`, `bazel`, or `clang` from the above commands.
Alternatively, if you only want to perform one lint check individually, then you can selectively pass `black`, `pyupgrade`, `bazel`, or `clang` from the above commands.

For example, check with Pylint only could be done with:
For example, check with `black` only could be done with:
```
bazel run //tools/lint:check -- pylint
bazel run //tools/lint:check -- black
```

Fix with Bazel Buildifier or Clang Format could be done with:
Expand Down
32 changes: 0 additions & 32 deletions tools/lint/BUILD
Expand Up @@ -62,38 +62,6 @@ genrule(
],
)

py_binary(
name = "pylint_py",
srcs = ["pylint_python.py"],
main = "pylint_python.py",
deps = [
requirement("pylint"),
requirement("wrapt"),
requirement("astroid"),
requirement("isort"),
requirement("lazy_object_proxy"),
],
)

filegroup(
name = "pylint_rc",
srcs = [
"pylint_python.rc",
],
)

genrule(
name = "pylint",
srcs = [],
outs = ["pylint"],
cmd = "echo '$(location :pylint_py) --rcfile=$(location :pylint_rc) \"$$@\"' > $@",
executable = True,
tools = [
":pylint_py",
":pylint_rc",
],
)

genrule(
name = "clang_format",
srcs = ["@llvm_toolchain//:bin/clang-format"],
Expand Down
8 changes: 1 addition & 7 deletions tools/lint/defs.bzl
Expand Up @@ -5,7 +5,6 @@ def _lint_impl(ctx):
substitutions = {
"@@MODE@@": shell.quote(ctx.attr.mode),
"@@BLACK_PATH@@": shell.quote(ctx.executable._black.short_path),
"@@PYLINT_PATH@@": shell.quote(ctx.executable._pylint.short_path),
"@@BUILDIFIER_PATH@@": shell.quote(ctx.executable._buildifier.short_path),
"@@CLANG_FORMAT_PATH@@": shell.quote(ctx.executable._clang_format.short_path),
"@@PYUPGRADE_PATH@@": shell.quote(ctx.executable._pyupgrade.short_path),
Expand All @@ -16,7 +15,7 @@ def _lint_impl(ctx):
substitutions = substitutions,
is_executable = True,
)
runfiles = ctx.runfiles(files = [ctx.executable._buildifier, ctx.executable._clang_format, ctx.executable._pylint, ctx.executable._black, ctx.executable._pyupgrade])
runfiles = ctx.runfiles(files = [ctx.executable._buildifier, ctx.executable._clang_format, ctx.executable._black, ctx.executable._pyupgrade])
return [DefaultInfo(
files = depset([bash_file]),
runfiles = runfiles,
Expand All @@ -36,11 +35,6 @@ _lint = rule(
cfg = "host",
executable = True,
),
"_pylint": attr.label(
default = "//tools/lint:pylint",
cfg = "host",
executable = True,
),
"_buildifier": attr.label(
default = "@com_github_bazelbuild_buildtools//buildifier",
cfg = "host",
Expand Down
55 changes: 1 addition & 54 deletions tools/lint/lint.tpl
Expand Up @@ -8,14 +8,12 @@ echo "$MODE: " $@
RUN_BAZEL=no
RUN_BLACK=no
RUN_CLANG=no
RUN_PYLINT=no
RUN_PYUPGRADE=no
RUN_ENTRIES=all
if [[ $# -eq 0 ]]; then
RUN_BAZEL=true
RUN_BLACK=true
RUN_CLANG=true
RUN_PYLINT=true
RUN_PYUPGRADE=true
else
while [[ $# -gt 0 ]]; do
Expand All @@ -31,10 +29,6 @@ else
shift
echo "$MODE: " clang
RUN_CLANG=true
elif [[ "$1" == "pylint" ]]; then
shift
echo "$MODE: " pylint
RUN_PYLINT=true
elif [[ "$1" == "pyupgrade" ]]; then
shift
echo "$MODE: " pyupgrade
Expand All @@ -51,38 +45,26 @@ else
done
fi

echo "Selected: Bazel=$RUN_BAZEL Black=$RUN_BLACK Clang=$RUN_CLANG Pylint=$RUN_PYLINT Pyupgrade=$RUN_PYUPGRADE [Entries]: $RUN_ENTRIES"
echo "Selected: Bazel=$RUN_BAZEL Black=$RUN_BLACK Clang=$RUN_CLANG Pyupgrade=$RUN_PYUPGRADE [Entries]: $RUN_ENTRIES"

BLACK_PATH=@@BLACK_PATH@@
PYLINT_PATH=@@PYLINT_PATH@@
BUILDIFIER_PATH=@@BUILDIFIER_PATH@@
CLANG_FORMAT_PATH=@@CLANG_FORMAT_PATH@@
PYUPGRADE_PATH=@@PYUPGRADE_PATH@@

mode="$MODE"

black_path=$(readlink "$BLACK_PATH")
pylint_path=$(readlink "$PYLINT_PATH")
buildifier_path=$(readlink "$BUILDIFIER_PATH")
clang_format_path=$(readlink "$CLANG_FORMAT_PATH")
pyupgrade_path=$(readlink "$PYUPGRADE_PATH")

echo "mode:" $mode
echo "black:" $black_path
echo "pylint:" $pylint_path
echo "buildifier:" $buildifier_path
echo "clang-format:" $clang_format_path
echo "pyupgrade:" $pyupgrade_path

if [[ "$mode" == "lint" ]]; then
if [[ "$RUN_PYLINT" == "true" ]]; then
echo
echo "WARN: pylint does not have lint mode, use check instead"
echo
fi
fi


black_func() {
echo $1 $2
if [[ "$1" == "lint" ]]; then
Expand All @@ -92,16 +74,6 @@ black_func() {
fi
}

pylint_func() {
echo $1 $2
# Note: --indent-string=' ' to override google 2 spaces and match black
# Note: --max-line-length=88 to override default and match black
# Note: --disable=bad-continuation to avoid conflict with black
# TODO: --disable=abstract-method should be removed eventually
# TODO: --disable=abstract-class-instantiated should be removed eventually
$pylint_path --indent-string=' ' --max-line-length=88 --disable=bad-continuation --disable=abstract-method --disable=abstract-class-instantiated $2
}

buildifier_func() {
echo $1 $2
if [[ "$1" == "lint" ]]; then
Expand Down Expand Up @@ -157,31 +129,6 @@ fi
fi


if [[ "$RUN_PYLINT" == "true" ]]; then
echo "Run Pylint"

if [[ "$RUN_ENTRIES" == "--" ]]; then
( \
cd "$BUILD_WORKSPACE_DIRECTORY" && \
for i in $@ ; do \
pylint_func $mode "$i" ; \
done \
)
else
( \
cd "$BUILD_WORKSPACE_DIRECTORY" && \
for i in \
$( \
find tensorflow_io tests -type f \
\( -name '*.py' \) \
) ; do \
pylint_func $mode "$i" ; \
done \
)
fi

fi

if [[ "$RUN_BAZEL" == "true" ]]; then
echo "Run Bazel Buildifier"

Expand Down
19 changes: 0 additions & 19 deletions tools/lint/pylint_python.py

This file was deleted.

0 comments on commit bb98a38

Please sign in to comment.