potiuk commented on a change in pull request #5238: [AIRFLOW-4364] Add Pylint 
to CI
URL: https://github.com/apache/airflow/pull/5238#discussion_r281035061
 
 

 ##########
 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%...*}
 
 Review comment:
   Just a question - I could not find it quickly but maybe we should get 
somehow the base branch for the PR and make the check for all changes? From 
what I see now, we will only run pylint check for the last pushed commit if we 
add a new one in the existing PR, but maybe we should run it for all the 
commits in PR ? It should not change much but maybe it can be simplified a bit 
in this case (no distinction of normal/force-push commits).

----------------------------------------------------------------
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

Reply via email to