potiuk commented on a change in pull request #5238: [AIRFLOW-4364] Add Pylint to CI URL: https://github.com/apache/airflow/pull/5238#discussion_r281034657
########## File path: scripts/ci/ci_pylint.sh ########## @@ -0,0 +1,44 @@ +#!/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. +# + +set -ex + +# TODO When Airflow is fully Pylint compatible, remove git-lint and run pylint on complete changed files +# Using git-lint is an intermediate solution only for integrating Pylint! +# TODO After full Airflow-Pylint compatibility, add if-clause checking if .pylintrc was edited and if so, run pylint on complete project instead of changed files +if [[ ! -z $TRAVIS_COMMIT_RANGE ]]; then + # Running in Travis. + # Given the nature of Airflow PRs, where every PR should be a single commit, we force push and + # override history a lot. Therefore we must check if the commits exist first. + FIRST_COMMIT=${TRAVIS_COMMIT_RANGE:0:12} + + # First commit in range exists. This should pick up regular commits. + git cat-file -e ${FIRST_COMMIT} && git reset --soft ${TRAVIS_COMMIT_RANGE%...*} + + # Only reset the (single) commit that the current build is running against. + # This should pick up force pushes, overwriting history. + git cat-file -e ${FIRST_COMMIT} || git reset --soft $TRAVIS_COMMIT~1 + + python $(dirname ${BASH_SOURCE[0]})/ci_pylint.py +else Review comment: Shouldn't we reset all back to the original state here? I think it is nice for any other potential scripts running after this one. ---------------------------------------------------------------- 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: [email protected] With regards, Apache Git Services
