Skip to content

Commit

Permalink
integrate autopep8 to presubmit
Browse files Browse the repository at this point in the history
  • Loading branch information
yalcinmelihyasin committed Jun 29, 2022
1 parent 5d07b24 commit 3c66572
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions kokoro/presubmit/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@ sudo apt-get install -y clang-format-6.0
# Get recent Android build tools.
echo y | $ANDROID_HOME/tools/bin/sdkmanager --install 'build-tools;30.0.3'

# Python Format tool
python3 -m pip install autopep8==1.6.0 --user

# Setup environment.
export ANDROID_NDK_HOME=/opt/android-ndk-r16b
export BAZEL=$BUILD_ROOT/bazel/bin/bazel
export BUILDIFIER=$BUILD_ROOT/tools/bin/buildifier
export BUILDOZER=$BUILD_ROOT/tools/bin/buildozer
export CLANG_FORMAT=clang-format-6.0
export AUTOPEP8=autopep8

cd $SRC

Expand Down
8 changes: 8 additions & 0 deletions kokoro/presubmit/presubmit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ BAZEL=${BAZEL:-bazel}
BUILDIFIER=${BUILDIFIER:-buildifier}
BUILDOZER=${BUILDOZER:-buildozer}
CLANG_FORMAT=${CLANG_FORMAT:-clang-format}
AUTOPEP8=${AUTOPEP8:-autopep8}

if test -t 1; then
ncolors=$(tput colors)
Expand Down Expand Up @@ -102,6 +103,10 @@ function run_gofmt() {
find . -name "*.go" | xargs $GOFMT -w
}

function run_autopep8() {
$AUTOPEP8 --global-config=tools/build/python/pep8 -r --in-place vulkan_generator
}

# Ensure we are clean to start out with.
check "git workspace must be clean" true

Expand All @@ -127,5 +132,8 @@ check "gazelle" run_gazelle
# installed its Go SDK (as a dependency to run Gazelle).
check gofmt run_gofmt

# Check python Formatter(autopep8)
check autopep8 run_autopep8

echo
echo "${green}All check completed successfully.$normal"
8 changes: 2 additions & 6 deletions vulkan_generator/vulkan_parser/spirv_capabilities_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,5 @@ def parse(spirv_element: ET.Element) -> types.SpirvCapability:
else:
raise SyntaxError(f"Unknown Spirv capability type: {ET.tostring(spirv_element, 'utf-8')}")

return types.SpirvCapability(
name=name,
version=version,
feature=feature,
property=vulkan_property,
extension=extension)
# Break this lines format intentionally to test presubmit(autopep8)
return types.SpirvCapability(name=name, version=version, feature=feature, property=vulkan_property, extension=extension)

0 comments on commit 3c66572

Please sign in to comment.