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 2019/05/08 18:09:58 UTC

[GitHub] [airflow] BasPH commented on a change in pull request #5238: [AIRFLOW-4364] Add Pylint to CI

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

 ##########
 File path: scripts/ci/ci_pylint.py
 ##########
 @@ -0,0 +1,104 @@
+# 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.
+
+"""This script runs Pylint and filters out only the changed lines."""
+# TODO remove this script once the complete Airflow codebase is Pylint compatible.
+
+import os
+import re
+import subprocess
+import sys
+from io import StringIO
+
+from collections import defaultdict
+from pathlib import Path
+
+from pylint import lint
+from pylint.reporters.text import ColorizedTextReporter
+
+# Get Python files to run Pylint against.
+# Git command from https://github.com/sk-/git-lint/blob/master/gitlint/git.py
+git_modified_files_cmd = "git status --porcelain --untracked-files=all --ignore-submodules=all".split()
 
 Review comment:
   Yea I borrowed this method from git-lint. The shell script calls `git --reset` on the repo to make everything locally modified, and this Python script can then pick it up. This script can be used both locally and in Travis, by starting the ci_pylint.sh script.
   
   I will add documentation and more comments.

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


With regards,
Apache Git Services