From 01f9a9a07d472f45f13fd78e004fc7ed8fd38b20 Mon Sep 17 00:00:00 2001 From: Victoria Mitchell Date: Fri, 3 Feb 2023 10:01:47 -0700 Subject: [PATCH 1/3] add 2022 and 2023 as acceptable years --- bin/check-source | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/check-source b/bin/check-source index e1b11285..2f076af5 100755 --- a/bin/check-source +++ b/bin/check-source @@ -18,7 +18,7 @@ here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" function replace_acceptable_years() { # this needs to replace all acceptable forms with 'YEARS' - sed -e 's/20[12][78901]-20[12][89012]/YEARS/' -e 's/20[12][89012]/YEARS/' + sed -e 's/20[12][7890123]-20[12][890123]/YEARS/' -e 's/20[12][890123]/YEARS/' } printf "=> Checking for unacceptable language… " From 5ecc15424cd491af9f50e5d447e4a0c9b9d2865c Mon Sep 17 00:00:00 2001 From: Victoria Mitchell Date: Fri, 3 Feb 2023 10:02:03 -0700 Subject: [PATCH 2/3] skip snippets in the main swift check --- Snippets/Parsing/test.md | 2 ++ Sources/Markdown/Markdown.docc/Snippets.md | 2 ++ bin/check-source | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Snippets/Parsing/test.md b/Snippets/Parsing/test.md index 7fab4475..6190ff3b 100644 --- a/Snippets/Parsing/test.md +++ b/Snippets/Parsing/test.md @@ -1,3 +1,5 @@ # Sample document This is a *sample document*. + + diff --git a/Sources/Markdown/Markdown.docc/Snippets.md b/Sources/Markdown/Markdown.docc/Snippets.md index e0c646e0..e8b0b741 100644 --- a/Sources/Markdown/Markdown.docc/Snippets.md +++ b/Sources/Markdown/Markdown.docc/Snippets.md @@ -41,3 +41,5 @@ a Markdown document to a consistent, preferred style. @Snippet(path: "swift-markdown/Snippets/Formatting/PreferredHeadingStyle") @Snippet(path: "swift-markdown/Snippets/Formatting/ThematicBreakCharacter") @Snippet(path: "swift-markdown/Snippets/Formatting/UseCodeFence") + + diff --git a/bin/check-source b/bin/check-source index 2f076af5..38af343e 100755 --- a/bin/check-source +++ b/bin/check-source @@ -49,7 +49,7 @@ for language in swift-or-c bash md-or-tutorial html docker; do reader=head case "$language" in swift-or-c) - exceptions=( -name 'Package*.swift') + exceptions=( -name 'Package*.swift' -o -path './Snippets/*') matching_files=( -name '*.swift' -o -name '*.c' -o -name '*.h' ) cat > "$tmp" <<"EOF" /* From df2cb36f9a844a47e24ea2865ae9d593e7c0760a Mon Sep 17 00:00:00 2001 From: Victoria Mitchell Date: Fri, 3 Feb 2023 13:25:12 -0700 Subject: [PATCH 3/3] add license checking for snippets that uses tail --- bin/check-source | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/bin/check-source b/bin/check-source index 38af343e..26717a7d 100755 --- a/bin/check-source +++ b/bin/check-source @@ -40,7 +40,7 @@ printf "\033[0;32mokay.\033[0m\n" printf "=> Checking license headers… " tmp=$(mktemp /tmp/.swift-markdown-check-source_XXXXXX) -for language in swift-or-c bash md-or-tutorial html docker; do +for language in swift-or-c snippet bash md-or-tutorial html docker; do declare -a matching_files declare -a exceptions declare -a reader @@ -61,6 +61,22 @@ for language in swift-or-c bash md-or-tutorial html docker; do See https://swift.org/LICENSE.txt for license information See https://swift.org/CONTRIBUTORS.txt for Swift project authors */ +EOF + ;; + snippet) + matching_files=( -name '*.swift' -a -path './Snippets/*') + exceptions=( -name 'Package*.swift') + reader=tail + cat > "$tmp" <<"EOF" +/* + This source file is part of the Swift.org open source project + + Copyright (c) YEARS Apple Inc. and the Swift project authors + Licensed under Apache License v2.0 with Runtime Library Exception + + See https://swift.org/LICENSE.txt for license information + See https://swift.org/CONTRIBUTORS.txt for Swift project authors +*/ EOF ;; bash) @@ -150,3 +166,4 @@ done printf "\033[0;32mokay.\033[0m\n" rm "$tmp" +# vim: filetype=bash shiftwidth=2 softtabstop=2