You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/03/03 19:32:36 UTC

[GitHub] [airflow] jbampton opened a new pull request #14587: Add pre-commit check to sort alpha and uniquify hooks in STATIC_CODE_…

jbampton opened a new pull request #14587:
URL: https://github.com/apache/airflow/pull/14587


   …CHECKS.rst
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #14587: [WIP] - Add pre-commit check to sort and uniquify the static code check hooks

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #14587:
URL: https://github.com/apache/airflow/pull/14587#issuecomment-808824117


   [The Workflow run](https://github.com/apache/airflow/actions/runs/693965330) is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on a change in pull request #14587: Add pre-commit check to sort and uniquify the static code check hooks

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #14587:
URL: https://github.com/apache/airflow/pull/14587#discussion_r627503534



##########
File path: scripts/ci/pre_commit/pre_commit_sort_static_code_check_hooks.sh
##########
@@ -0,0 +1,78 @@
+#!/usr/bin/env 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.
+
+# shellcheck source=scripts/ci/libraries/_script_init.sh
+. "$( dirname "${BASH_SOURCE[0]}" )/../libraries/_script_init.sh"
+
+BREEZE_COMPLETE="${AIRFLOW_SOURCES}/breeze-complete"
+BREEZE_RST="${AIRFLOW_SOURCES}/BREEZE.rst"
+STATIC_CODE_CHECKS="${AIRFLOW_SOURCES}/STATIC_CODE_CHECKS.rst"
+readonly BREEZE_COMPLETE
+readonly BREEZE_RST
+readonly STATIC_CODE_CHECKS
+export LC_ALL=C
+temp_file=$(mktemp)
+temp_hooks_file=$(mktemp)
+temp_holder_file=$(mktemp)
+
+< "${BREEZE_COMPLETE}" sed '/^all$/q' | sed '$d' > "${temp_file}"
+temp_string=$(< "${BREEZE_COMPLETE}" awk '/^all$/,/^EOF$/' | sed '$d')
+scc_array=$(IFS=$'\n'; echo "${temp_string}"; unset IFS)
+# shellcheck disable=SC2206
+a=(${scc_array[0]})
+all_checks+=("${a[@]:0:2}")
+sort_array+=("${a[@]:2}")
+IFS=$'\n' sorted=("$(sort <<<"${sort_array[*]}" | uniq)")
+unset IFS
+all_checks+=("${sorted[@]:0}")
+sorted_string=$(IFS=$'\n'; echo "${all_checks[*]}"; unset IFS)
+printf '%s\nEOF\n)\n\n' "${sorted_string}" >> "${temp_file}"
+< "${BREEZE_COMPLETE}" awk '/_breeze_default_dockerhub_user="apache"/,0' >> "${temp_file}"
+cat "${temp_file}" > "${BREEZE_COMPLETE}"
+
+< "${BREEZE_RST}" sed '/all all-but-pylint/q' | sed '$d' > "${temp_file}"
+temp_string=$(< "${BREEZE_RST}" awk 'f && !NF{exit} /all all-but-pylint/ {f=1} f')
+IFS=$'\n ' read -r -a scc_array <<< "$temp_string"
+# shellcheck disable=SC2178
+a="${scc_array[0]}"
+all+=("${a[@]:0:2}")
+sort_arr=("${a[@]:2}")
+IFS=$' ' sorted=("$(sort <<<"${sort_arr[@]:0}")")
+unset IFS
+all+=("${sorted[@]}")
+sorted_string=$(IFS=$' '; echo "${all[*]}"; unset IFS)
+printf '%s\n\n' "${sorted_string}" | fold -w 83 -s | sed -e 's/^/                 /' | sed 's/ *$//g' >> "${temp_file}"
+< "${BREEZE_RST}" awk '/You can pass extra arguments/,0' >> "${temp_file}"
+cat "${temp_file}" > "${BREEZE_RST}"
+
+awk '/^===================================/{i++}i==2; f; /^===================================/ && i==3{print; exit}' "${STATIC_CODE_CHECKS}" | grep '^``' | sort -k1,1 | uniq > "${temp_hooks_file}"
+awk '/^.*/{f=1} f; /^===================================/ && ++c==2{exit}' "${STATIC_CODE_CHECKS}" > "${temp_file}"
+: > "${temp_holder_file}"
+while IFS= read -r line; do
+    echo "${line}" >> "${temp_holder_file}"
+    echo "----------------------------------- ---------------------------------------------------------------- ------------" >> "${temp_holder_file}"
+done < "${temp_hooks_file}"
+# shellcheck disable=SC2129
+< "${temp_holder_file}" sed '$d' >> "${temp_file}"
+printf "=================================== ================================================================ ============\n\n" >> "${temp_file}"
+< "${STATIC_CODE_CHECKS}" awk '/The pre-commit hooks only check/,0' >> "${temp_file}"

Review comment:
       This is a lot of gnarly bash -- I think it might be time to write some of this in python rather than adding yet more bash scripts to the project.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] jbampton commented on pull request #14587: Add pre-commit check to sort and uniquify the static code check hooks

Posted by GitBox <gi...@apache.org>.
jbampton commented on pull request #14587:
URL: https://github.com/apache/airflow/pull/14587#issuecomment-832961019


   Hey @potiuk can you please review 🥇 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] closed pull request #14587: Add pre-commit check to sort and uniquify the static code check hooks

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed pull request #14587:
URL: https://github.com/apache/airflow/pull/14587


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] jbampton commented on pull request #14587: Add pre-commit check to sort and uniquify the static code check hooks

Posted by GitBox <gi...@apache.org>.
jbampton commented on pull request #14587:
URL: https://github.com/apache/airflow/pull/14587#issuecomment-833568309


   @kaxil can you please do a review ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #14587: Add pre-commit check to sort and uniquify the static code check hooks

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #14587:
URL: https://github.com/apache/airflow/pull/14587#issuecomment-895632283


   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org