### _Why are the changes needed?_ to close #3828. Python code style checking support. 1. reuse Spotless maven plugin for Python style check 2. add style check to CI style workflow 3. add python linting support to `dev/reformat`. checks whether `black` installed in PATH. ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #3823 from bowenliang123/spotless-python. Closes #3828 4a4de885 [liangbowen] simplify empty tags 0bb9ec7c [liangbowen] simplify empty tag in pom 9dd39531 [liangbowen] lint python code with black via spotless f85020fa [liangbowen] typo 4c93bce0 [liangbowen] install python 3.9 first 23fc4b96 [liangbowen] ci install black version from added `spotless.python.black.version` property 73f746b0 [Bowen Liang] Update dev/reformat 46667a00 [liangbowen] update style.yml 9c20b434 [liangbowen] update style.yml 21017e5e [liangbowen] update style.yml 8272c0bc [liangbowen] add python style to style checking for CI e102726c [liangbowen] add profile spotless in dev/reformat if black found in path 062e9bf2 [liangbowen] add python scan for spotless. add new profile `spotless-python` for python file path. Lead-authored-by: liangbowen <liangbowen@gf.com.cn> Co-authored-by: Bowen Liang <bowen.liang.123@gmail.com> Signed-off-by: Cheng Pan <chengpan@apache.org>
34 lines
1.2 KiB
Bash
Executable File
34 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
# this work for additional information regarding copyright ownership.
|
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
# (the "License"); you may not use this file except in compliance with
|
|
# the License. You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
|
|
set -x
|
|
|
|
KYUUBI_HOME="$(cd "`dirname "$0"`/.."; pwd)"
|
|
|
|
PROFILES="-Pflink-provided,hive-provided,spark-provided,spark-block-cleaner,spark-3.3,spark-3.2,spark-3.1,tpcds"
|
|
|
|
# python style checks rely on `black` in path
|
|
if ! command -v black &> /dev/null
|
|
then
|
|
echo "Skip Python lint since 'black' is not available."
|
|
else
|
|
PROFILES="${PROFILES},spotless-python"
|
|
fi
|
|
|
|
${KYUUBI_HOME}/build/mvn spotless:apply $PROFILES
|