You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2019/10/16 07:28:11 UTC

[airflow-site] branch aip-11 updated: Add insert-license lint rule (#78)

This is an automated email from the ASF dual-hosted git repository.

kamilbregula pushed a commit to branch aip-11
in repository https://gitbox.apache.org/repos/asf/airflow-site.git


The following commit(s) were added to refs/heads/aip-11 by this push:
     new 36b3bd0  Add insert-license lint rule (#78)
36b3bd0 is described below

commit 36b3bd00e642a8e6d55d7a681dec954d5afe1bf1
Author: Kamil BreguĊ‚a <mi...@users.noreply.github.com>
AuthorDate: Wed Oct 16 09:28:03 2019 +0200

    Add insert-license lint rule (#78)
---
 .gitignore                                         | 17 +++++++
 .gitmodules                                        | 17 +++++++
 .pre-commit-config.yaml                            | 56 ++++++++++++++++++++++
 landing-pages/.gitmodules                          |  3 --
 landing-pages/site/layouts/404.html                | 32 ++++++-------
 landing-pages/site/layouts/_default/baseof.html    | 32 ++++++-------
 landing-pages/site/layouts/examples/baseof.html    | 19 ++++++++
 landing-pages/site/layouts/examples/list.html      | 19 ++++++++
 .../layouts/partials/buttons/button-filled.html    | 32 ++++++-------
 .../layouts/partials/buttons/button-hollow.html    | 32 ++++++-------
 .../layouts/partials/buttons/button-with-icon.html | 32 ++++++-------
 .../site/layouts/partials/hooks/head-end.html      | 28 +++++------
 .../site/layouts/shortcodes/accordion.html         | 32 ++++++-------
 .../hooks/head-end.html => license-templates.txt   | 14 +-----
 14 files changed, 239 insertions(+), 126 deletions(-)

diff --git a/.gitignore b/.gitignore
index f32e31a..98f0709 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,19 @@
+# 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.
+
 .idea/
 .DS_Store
diff --git a/.gitmodules b/.gitmodules
index 030e750..6001a4e 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,20 @@
+# 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.
+
 [submodule "landing-pages/site/themes/docsy"]
     path = landing-pages/site/themes/docsy
     url = https://github.com/google/docsy.git
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index fac8e0a..45d2907 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -28,6 +28,62 @@ repos:
     rev: v1.1.7
     hooks:
       - id: forbid-tabs
+      - id: insert-license
+        name: Add licence for all other files
+        args:
+          - --comment-style
+          - "|#|"
+          - --license-filepath
+          - license-templates.txt
+          - --fuzzy-match-generates-todo
+        files: ^\.gitmodules$|^\.gitignore$|^\.gitignore$|^Dockerfile.*$
+      - id: insert-license
+        name: Add licence for all JS/CSS/SCSS files
+        files: \.js$|\.s?css$
+        args:
+          - --comment-style
+          - "/**| *| */"
+          - --license-filepath
+          - license-templates.txt
+          - --fuzzy-match-generates-todo
+      - id: insert-license
+        name: Add licence for all shell files
+        types: [shell]
+        files: ^breeze$|^breeze-complete$|\.sh$
+        args:
+          - --comment-style
+          - "|#|"
+          - --license-filepath
+          - license-templates.txt
+          - --fuzzy-match-generates-todo
+      - id: insert-license
+        name: Add licence for all yaml files
+        types: [yaml]
+        args:
+          - --comment-style
+          - "|#|"
+          - --license-filepath
+          - license-templates.txt
+          - --fuzzy-match-generates-todo
+      - id: insert-license
+        name: Add licence for all TOML files
+        types: [toml]
+        args:
+          - --comment-style
+          - "|#|"
+          - --license-filepath
+          - license-templates.txt
+          - --fuzzy-match-generates-todo
+      - id: insert-license
+        name: Add licence for all HTML files
+        types: [text]
+        args:
+          - --comment-style
+          - "{{/*||*/}}"
+          - --license-filepath
+          - license-templates.txt
+          - --fuzzy-match-generates-todo
+        files: ^landing-pages/site/layouts/.+\.html$
   - repo: local
     hooks:
       - id: shellcheck
diff --git a/landing-pages/.gitmodules b/landing-pages/.gitmodules
deleted file mode 100644
index b2afb66..0000000
--- a/landing-pages/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "site/themes/docsy"]
-    path = site/themes/docsy
-    url = https://github.com/google/docsy.git
diff --git a/landing-pages/site/layouts/404.html b/landing-pages/site/layouts/404.html
index 0a110b2..e1cdd54 100644
--- a/landing-pages/site/layouts/404.html
+++ b/landing-pages/site/layouts/404.html
@@ -1,20 +1,20 @@
 {{/*
-* 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.
+ 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.
 */}}
 
 {{ define "main" }}
diff --git a/landing-pages/site/layouts/_default/baseof.html b/landing-pages/site/layouts/_default/baseof.html
index 54fd5ed..c5e50d5 100644
--- a/landing-pages/site/layouts/_default/baseof.html
+++ b/landing-pages/site/layouts/_default/baseof.html
@@ -1,20 +1,20 @@
 {{/*
-* 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.
+ 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.
 */}}
 
 <!doctype html>
diff --git a/landing-pages/site/layouts/examples/baseof.html b/landing-pages/site/layouts/examples/baseof.html
index 868dd94..f4831e5 100644
--- a/landing-pages/site/layouts/examples/baseof.html
+++ b/landing-pages/site/layouts/examples/baseof.html
@@ -1,3 +1,22 @@
+{{/*
+ 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.
+*/}}
+
 <!doctype html>
 <html lang="{{ .Site.Language.Lang }}" class="no-js">
 <head>
diff --git a/landing-pages/site/layouts/examples/list.html b/landing-pages/site/layouts/examples/list.html
index 0e65878..d3055c9 100644
--- a/landing-pages/site/layouts/examples/list.html
+++ b/landing-pages/site/layouts/examples/list.html
@@ -1,3 +1,22 @@
+{{/*
+ 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.
+*/}}
+
 {{ define "main" }}
     {{ with .Content }}
         {{ . }}
diff --git a/landing-pages/site/layouts/partials/buttons/button-filled.html b/landing-pages/site/layouts/partials/buttons/button-filled.html
index 15cd947..ebe64a1 100644
--- a/landing-pages/site/layouts/partials/buttons/button-filled.html
+++ b/landing-pages/site/layouts/partials/buttons/button-filled.html
@@ -1,20 +1,20 @@
 {{/*
-* 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.
+ 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.
 */}}
 
 <button class="btn-filled bodytext__xsmall--white">{{ .text }}</button>
diff --git a/landing-pages/site/layouts/partials/buttons/button-hollow.html b/landing-pages/site/layouts/partials/buttons/button-hollow.html
index f01f048..0560923 100644
--- a/landing-pages/site/layouts/partials/buttons/button-hollow.html
+++ b/landing-pages/site/layouts/partials/buttons/button-hollow.html
@@ -1,20 +1,20 @@
 {{/*
-* 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.
+ 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.
 */}}
 
 <button class="btn-hollow btn-blue bodytext__xsmall--blue">{{ .text }}</button>
diff --git a/landing-pages/site/layouts/partials/buttons/button-with-icon.html b/landing-pages/site/layouts/partials/buttons/button-with-icon.html
index 126d7a6..81de580 100644
--- a/landing-pages/site/layouts/partials/buttons/button-with-icon.html
+++ b/landing-pages/site/layouts/partials/buttons/button-with-icon.html
@@ -1,20 +1,20 @@
 {{/*
-* 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.
+ 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.
 */}}
 
 {{ $svg_path := .svg_path | default "icons/github.svg" }}
diff --git a/landing-pages/site/layouts/partials/hooks/head-end.html b/landing-pages/site/layouts/partials/hooks/head-end.html
index 1092f39..8610cf5 100644
--- a/landing-pages/site/layouts/partials/hooks/head-end.html
+++ b/landing-pages/site/layouts/partials/hooks/head-end.html
@@ -1,20 +1,20 @@
 {{/*
-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
+ 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
+   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.
+ 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.
 */}}
 
 {{ $scssMain := "scss/main-custom.scss"}}
diff --git a/landing-pages/site/layouts/shortcodes/accordion.html b/landing-pages/site/layouts/shortcodes/accordion.html
index 55a8e02..ab33a0d 100644
--- a/landing-pages/site/layouts/shortcodes/accordion.html
+++ b/landing-pages/site/layouts/shortcodes/accordion.html
@@ -1,20 +1,20 @@
 {{/*
-* 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.
+ 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.
 */}}
 
 <details class="accordion">
diff --git a/landing-pages/site/layouts/partials/hooks/head-end.html b/license-templates.txt
similarity index 55%
copy from landing-pages/site/layouts/partials/hooks/head-end.html
copy to license-templates.txt
index 1092f39..60b675e 100644
--- a/landing-pages/site/layouts/partials/hooks/head-end.html
+++ b/license-templates.txt
@@ -1,4 +1,3 @@
-{{/*
 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
@@ -7,7 +6,7 @@ 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
+  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
@@ -15,14 +14,3 @@ software distributed under the License is distributed on an
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
-*/}}
-
-{{ $scssMain := "scss/main-custom.scss"}}
-{{ if .Site.IsServer }}
-    {{ $css := resources.Get $scssMain | toCSS (dict "enableSourceMap" true) }}
-    <link href="{{ $css.RelPermalink }}" rel="stylesheet">
-{{ else }}
-    {{ $css := resources.Get $scssMain | toCSS (dict "enableSourceMap" false) | postCSS | minify | fingerprint }}
-    <link rel="preload" href="{{ $css.RelPermalink }}" as="style">
-    <link href="{{ $css.RelPermalink }}" rel="stylesheet" integrity="{{ $css.Data.integrity }}">
-{{ end }}