From 7b9911eb9a60ab5423b9f651654d2e066874b439 Mon Sep 17 00:00:00 2001 From: Ash Berlin-Taylor Date: Tue, 13 Nov 2018 14:01:44 +0000 Subject: [PATCH] [AIRFLOW-2779] Add license headers to doc files (#4178) This adds ASF license headers to all the .rst and .md files with the exception of the Pull Request template (as that is included verbatim when opening a Pull Request on Github which would be messy) --- .rat-excludes | 30 ++++++++++++++++++++++++------ docs/conf.py | 20 ++++++++++++++++++++ scripts/ci/check-license.sh | 24 ++++++------------------ 3 files changed, 50 insertions(+), 24 deletions(-) diff --git a/.rat-excludes b/.rat-excludes index c9487dd8c49c1..05f7b98000f89 100644 --- a/.rat-excludes +++ b/.rat-excludes @@ -1,16 +1,21 @@ +# Note: these patterns are applied to single files or directories, not full paths +# coverage/* will ignore any coverage dir, but airflow/www/static/coverage/* will match nothing + .gitignore .gitattributes +.airflowignore .coverage .coveragerc .codecov.yml +.eslintrc +.eslintignore +.flake8 .rat-excludes requirements.txt .*log .travis.yml .*pyc .*lock -docs -.*md dist build airflow.egg-info @@ -18,16 +23,23 @@ apache_airflow.egg-info .idea metastore_db .*sql +.*svg .*csv CHANGELOG.txt .*zip .*lock +# Generated doc files +.*html +_build/* +_static/* +.buildinfo +searchindex.js + # Apache Rat does not detect BSD-2 clause properly # it is compatible according to http://www.apache.org/legal/resolved.html#category-a kerberos_auth.py airflow_api_auth_backend_kerberos_auth_py.html licenses/* -airflow/www/static/docs parallel.js underscore.js jquery.dataTables.min.js @@ -37,6 +49,12 @@ bootstrap-toggle.min.js bootstrap-toggle.min.css d3.v3.min.js ace.js -airflow/www/static/coverage/* -airflow/git_version -scripts/ci/flake8_diff.sh +node_modules/* +.*json +coverage/* +git_version +flake8_diff.sh + +rat-results.txt +apache-airflow-.*\+incubating-source.tar.gz.* +apache-airflow-.*\+incubating-bin.tar.gz.* diff --git a/docs/conf.py b/docs/conf.py index 8b5d8305bbb15..fa2a3d2274acb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,5 +1,25 @@ # -*- coding: utf-8 -*- # +# flake8: noqa +# Disable Flake8 because of all the sphinx imports +# +# 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. + # Airflow documentation build configuration file, created by # sphinx-quickstart on Thu Oct 9 20:50:01 2014. # diff --git a/scripts/ci/check-license.sh b/scripts/ci/check-license.sh index 83c942a0a4f12..035283f9061b5 100755 --- a/scripts/ci/check-license.sh +++ b/scripts/ci/check-license.sh @@ -73,6 +73,9 @@ mkdir -p ${TRAVIS_CACHE}/lib exit 1 } +# This is the target of a symlink in airflow/www/static/docs - and rat exclude doesn't cope with the symlink target doesn't exist +mkdir -p docs/_build/html/ + echo "Running license checks. This can take a while." $java_cmd -jar "$rat_jar" -E "$FWDIR"/.rat-excludes -d "$FWDIR" > rat-results.txt @@ -84,24 +87,9 @@ fi ERRORS="$(cat rat-results.txt | grep -e "??")" if test ! -z "$ERRORS"; then - echo "Could not find Apache license headers in the following files:" - echo "$ERRORS" - COUNT=`echo "${ERRORS}" | wc -l` - # due to old builds can be removed later - rm -rf ${TRAVIS_CACHE}/rat-error-count - if [ ! -f ${TRAVIS_CACHE}/rat-error-count-builds ]; then - [ "${TRAVIS_PULL_REQUEST}" = "false" ] && echo ${COUNT} > ${TRAVIS_CACHE}/rat-error-count-builds - OLD_COUNT=${COUNT} - else - typeset -i OLD_COUNT=$(cat ${TRAVIS_CACHE}/rat-error-count-builds) - fi - if [ ${COUNT} -gt ${OLD_COUNT} ]; then - echo "New missing licenses (${COUNT} vs ${OLD_COUNT}) detected. Please correct them by adding them to to header of your files" - exit 1 - else - [ "${TRAVIS_PULL_REQUEST}" = "false" ] && echo ${COUNT} > ${TRAVIS_CACHE}/rat-error-count-builds - fi - exit 0 + echo >&2 "Could not find Apache license headers in the following files:" + echo >&2 "$ERRORS" + exit 1 else echo -e "RAT checks passed." fi