From bc4189b1c6f8e2fdd0bbd27b1e172de166133a86 Mon Sep 17 00:00:00 2001 From: Jamy Date: Wed, 21 Aug 2024 09:16:18 +0200 Subject: [PATCH] Lint schemes when PRs are created (#15) --- .github/ISSUE_TEMPLATE/config.yml | 4 ++-- .github/workflows/test.yml | 20 ++++++++++++++++++++ .yamllint.yaml | 11 +++++++++++ base16/ayu-mirage.yaml | 1 - base16/brewer.yaml | 16 ++++++++-------- base16/dracula.yaml | 4 ++-- base16/heetch.yaml | 3 --- base16/helios.yaml | 1 - base16/papercolor-dark.yaml | 4 +++- base16/papercolor-light.yaml | 4 +++- base16/pasque.yaml | 16 ++++++++-------- base16/rebecca.yaml | 2 -- base16/saga.yaml | 2 -- base16/shades-of-purple.yaml | 4 +++- base16/snazzy.yaml | 4 +++- base16/spaceduck.yaml | 4 +++- base16/sparky.yaml | 4 ++-- base24/sparky.yaml | 6 +++--- scripts/lint | 28 ++++++++++++++++++++++++++++ 19 files changed, 99 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100644 .yamllint.yaml create mode 100755 scripts/lint diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 79dfdb9..1a65ed8 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,10 +1,10 @@ blank_issues_enabled: true contact_links: - system: "base16" -name: Learn more about the various specs and larger ecosystem + name: Learn more about the various specs and larger ecosystem url: https://github.com/base16-project/home about: Sometimes the answers are right there, just waiting to be discovered. - system: "base16" -name: Discuss within the broader project + name: Discuss within the broader project about: Your issue is broadly applicable to most Base16 schemes (or the whole ecosystem). url: https://github.com/base16-project/home/issues/new diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..e656765 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,20 @@ +name: Test +on: + pull_request: + branches: + - "spec-**" + push: + branches: + - "spec-**" +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install deps + run: sudo apt install yamllint + + - name: Lint schemes + run: yamllint ${{ github.workspace }} && ${{ github.workspace }}/scripts/lint "${{ github.workspace }}" diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 0000000..53f1ffa --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,11 @@ +--- + +extends: default + +rules: + document-start: disable + comments: disable + line-length: + max: 120 + level: error + allow-non-breakable-inline-mappings: true diff --git a/base16/ayu-mirage.yaml b/base16/ayu-mirage.yaml index c27f718..5db3f27 100644 --- a/base16/ayu-mirage.yaml +++ b/base16/ayu-mirage.yaml @@ -19,4 +19,3 @@ palette: base0D: "5CCFE6" base0E: "D4BFFF" base0F: "F29E74" - diff --git a/base16/brewer.yaml b/base16/brewer.yaml index f66840f..76c9dba 100644 --- a/base16/brewer.yaml +++ b/base16/brewer.yaml @@ -13,11 +13,11 @@ palette: base06: "dadbdc" # +++ base07: "fcfdfe" # ++++ - base08: "e31a1c" # red - base09: "e6550d" # orange - base0A: "dca060" # yellow - base0B: "31a354" # green - base0C: "80b1d3" # aqua - base0D: "3182bd" # blue - base0E: "756bb1" # purple - base0F: "b15928" # brown + base08: "e31a1c" # red + base09: "e6550d" # orange + base0A: "dca060" # yellow + base0B: "31a354" # green + base0C: "80b1d3" # aqua + base0D: "3182bd" # blue + base0E: "756bb1" # purple + base0F: "b15928" # brown diff --git a/base16/dracula.yaml b/base16/dracula.yaml index f0dec31..93ae176 100644 --- a/base16/dracula.yaml +++ b/base16/dracula.yaml @@ -3,12 +3,12 @@ name: "Dracula" author: "Mike Barkmin (http://github.com/mikebarkmin) based on Dracula Theme (http://github.com/dracula)" variant: "dark" palette: - base00: "282936" #background + base00: "282936" # background base01: "3a3c4e" base02: "4d4f68" base03: "626483" base04: "62d6e8" - base05: "e9e9f4" #foreground + base05: "e9e9f4" # foreground base06: "f1f2f8" base07: "f7f7fb" base08: "ea51b2" diff --git a/base16/heetch.yaml b/base16/heetch.yaml index 86052e8..19cbb45 100644 --- a/base16/heetch.yaml +++ b/base16/heetch.yaml @@ -20,6 +20,3 @@ palette: base0D: "BD0152" base0E: "82034C" base0F: "470546" - - - diff --git a/base16/helios.yaml b/base16/helios.yaml index f2e222c..4fcf11b 100644 --- a/base16/helios.yaml +++ b/base16/helios.yaml @@ -19,4 +19,3 @@ palette: base0D: "1e8bac" # blue base0E: "be4264" # purple base0F: "c85e0d" # brown - diff --git a/base16/papercolor-dark.yaml b/base16/papercolor-dark.yaml index a4fedaf..e5ca490 100644 --- a/base16/papercolor-dark.yaml +++ b/base16/papercolor-dark.yaml @@ -1,6 +1,8 @@ system: "base16" name: "PaperColor Dark" -author: "Jon Leopard (http://github.com/jonleopard) based on PaperColor Theme (https://github.com/NLKNguyen/papercolor-theme)" +author: | + Jon Leopard (http://github.com/jonleopard) + based on PaperColor Theme (https://github.com/NLKNguyen/papercolor-theme) variant: "dark" palette: base00: "1c1c1c" # Default Background diff --git a/base16/papercolor-light.yaml b/base16/papercolor-light.yaml index 2673071..d0dba79 100644 --- a/base16/papercolor-light.yaml +++ b/base16/papercolor-light.yaml @@ -1,6 +1,8 @@ system: "base16" name: "PaperColor Light" -author: "Jon Leopard (http://github.com/jonleopard) based on PaperColor Theme (https://github.com/NLKNguyen/papercolor-theme)" +author: | + Jon Leopard (http://github.com/jonleopard) + based on PaperColor Theme (https://github.com/NLKNguyen/papercolor-theme) variant: "light" palette: base00: "eeeeee" # Default Background diff --git a/base16/pasque.yaml b/base16/pasque.yaml index cc13b8f..e980f35 100644 --- a/base16/pasque.yaml +++ b/base16/pasque.yaml @@ -13,11 +13,11 @@ palette: base06: "EDEAEF" base07: "BBAADD" - base08: "A92258" #Pink - base09: "918889" #Gray - base0A: "804ead" #Pasque - base0B: "C6914B" #Gold - base0C: "7263AA" #Lavender - base0D: "8E7DC6" #Blue - base0E: "953B9D" #Violet - base0F: "59325C" #Magenta + base08: "A92258" # Pink + base09: "918889" # Gray + base0A: "804ead" # Pasque + base0B: "C6914B" # Gold + base0C: "7263AA" # Lavender + base0D: "8E7DC6" # Blue + base0E: "953B9D" # Violet + base0F: "59325C" # Magenta diff --git a/base16/rebecca.yaml b/base16/rebecca.yaml index 12f4787..9956012 100644 --- a/base16/rebecca.yaml +++ b/base16/rebecca.yaml @@ -19,5 +19,3 @@ palette: base0D: "2de0a7" # functions base0E: "7aa5ff" # keywords base0F: "ff79c6" # deprecations - - diff --git a/base16/saga.yaml b/base16/saga.yaml index 600dc19..41467a4 100644 --- a/base16/saga.yaml +++ b/base16/saga.yaml @@ -19,5 +19,3 @@ palette: base0D: "c9fff7" # Celeste base0E: "dcc3f9" # Anemone base0F: "f6dddd" # Lycoris - - diff --git a/base16/shades-of-purple.yaml b/base16/shades-of-purple.yaml index 46f0e30..c9ef60b 100644 --- a/base16/shades-of-purple.yaml +++ b/base16/shades-of-purple.yaml @@ -1,6 +1,8 @@ system: "base16" name: "Shades of Purple" -author: "Iolar Demartini Junior (http://github.com/demartini) based on Shades of Purple Theme (https://github.com/ahmadawais/shades-of-purple-vscode)." +author: | + Iolar Demartini Junior (http://github.com/demartini + based on Shades of Purple Theme (https://github.com/ahmadawais/shades-of-purple-vscode). variant: "dark" palette: base00: "1e1e3f" # default background diff --git a/base16/snazzy.yaml b/base16/snazzy.yaml index fd6d4fc..ac73885 100644 --- a/base16/snazzy.yaml +++ b/base16/snazzy.yaml @@ -1,6 +1,8 @@ system: "base16" name: "Snazzy" -author: "Chawye Hsu (https://github.com/chawyehsu) based on Hyper Snazzy Theme (https://github.com/sindresorhus/hyper-snazzy)" +author: | + Chawye Hsu (https://github.com/chawyehsu) + based on Hyper Snazzy Theme (https://github.com/sindresorhus/hyper-snazzy) variant: "dark" palette: base00: "282a36" diff --git a/base16/spaceduck.yaml b/base16/spaceduck.yaml index 02d6acd..deda138 100644 --- a/base16/spaceduck.yaml +++ b/base16/spaceduck.yaml @@ -1,6 +1,8 @@ system: "base16" name: "Spaceduck" -author: "Guillermo Rodriguez (https://github.com/pineapplegiant), packaged by Gabriel Fontes (https://github.com/Misterio77)" +author: | + Guillermo Rodriguez (https://github.com/pineapplegiant), + packaged by Gabriel Fontes (https://github.com/Misterio77) variant: "dark" palette: base00: "16172d" diff --git a/base16/sparky.yaml b/base16/sparky.yaml index 7f44cc1..d3bd439 100644 --- a/base16/sparky.yaml +++ b/base16/sparky.yaml @@ -7,7 +7,7 @@ palette: base01: "00313C" # 547 C - Lighter Background base02: "003C46" # 547 CP - Selection base03: "003B49" # 309 C - Comments - base04: "00778B" # 7705 C - Lightest Background + base04: "00778B" # 7705 C - Lightest Background base05: "F4F5F0" # 11-0601 Tcx - Foreground base06: "F5F5F1" # P 179-1 U - Grey base07: "FFFFFF" # Hex White - White - there is no whiter Pantone than 11-0601 Tcx @@ -18,4 +18,4 @@ palette: base0C: "2DCCD3" # 319 C - Cyan base0D: "4698CB" # 7688 C - Blue base0E: "D59ED7" # 7438 C - Purple - base0F: "9B704D" # 10367 C - Brown \ No newline at end of file + base0F: "9B704D" # 10367 C - Brown diff --git a/base24/sparky.yaml b/base24/sparky.yaml index a209b84..1302b83 100644 --- a/base24/sparky.yaml +++ b/base24/sparky.yaml @@ -7,7 +7,7 @@ palette: base01: "00313C" # 547 C - Lighter Background base02: "003C46" # 547 CP - Selection base03: "003B49" # 309 C - Comments - base04: "00778B" # 7705 C - Lightest Background + base04: "00778B" # 7705 C - Lightest Background base05: "F4F5F0" # 11-0601 Tcx - Foreground base06: "F5F5F1" # P 179-1 U - Grey base07: "FFFFFF" # Hex White - White - there is no whiter Pantone than 11-0601 Tcx @@ -20,10 +20,10 @@ palette: base0E: "D59ED7" # 7438 C - Purple base0F: "9B704D" # 10367 C - Brown base10: "4B4F54" # 7540 C - Light Black - base11: "212322" # 419 C - Black + base11: "212322" # 419 C - Black base12: "FF7276" # 805 C - Light Red base13: "F6EB61" # 100 C - Light Yellow - used due to colourblind a11y with Light Orange base14: "8EDD65" # 7487 C - Light Green base15: "00C1D5" # 3115 C - Light Cyan base16: "69B3E7" # 292 C - Light Blue - base17: "F99FC9" # 210 C - Light Purple/Pink \ No newline at end of file + base17: "F99FC9" # 210 C - Light Purple/Pink diff --git a/scripts/lint b/scripts/lint new file mode 100755 index 0000000..026db6d --- /dev/null +++ b/scripts/lint @@ -0,0 +1,28 @@ +#!/usr/bin/env sh + +workspace="$1" +supported_schemes_systems="base16 base24" + +if [ -z $workspace ]; then + echo "Missing 'workspace' argument" +fi + +for scheme_system in $supported_schemes_systems; do + for scheme_path in "$workspace/$scheme_system"/*; do + scheme_filename=$(basename -- "$scheme_path") + + case "$scheme_filename" in + *.yaml) + if ! $(grep -q "author" "$scheme_path" \ + && grep -q "name" "$scheme_path" \ + && grep -q "palette" "$scheme_path" \ + && grep -q "system" "$scheme_path" \ + && grep -q "variant" "$scheme_path"); then + + echo "Error: Missing one of the required yaml properties (author|name|palette|system|variant) in $scheme_path" + exit 1 + fi + ;; + esac + done +done