From 99cdbdbbdeb228388e3f44897de2158ba53ba55c Mon Sep 17 00:00:00 2001 From: Gil Desmarais Date: Tue, 10 Mar 2026 18:21:06 +0100 Subject: [PATCH 1/6] feat(devx): add config validation workflow --- .github/workflows/ruby.yml | 14 ++++++++------ .gitignore | 1 + .vscode/extensions.json | 5 +++++ Makefile | 11 +++++++++-- README.md | 14 +++++++++++++- bin/setup | 29 +++++++++++++++++++++++++++-- bin/validate_configs | 38 ++++++++++++++++++++++++++++++++++++++ 7 files changed, 101 insertions(+), 11 deletions(-) create mode 100644 .vscode/extensions.json create mode 100755 bin/validate_configs diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 95ca094..d9f7902 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -11,14 +11,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 with: node-version: "20" - name: Install dependencies - run: | - sudo apt-get install -yqq yamllint + run: sudo apt-get install -yqq yamllint - name: Set up Ruby uses: ruby/setup-ruby@v1 @@ -29,6 +28,9 @@ jobs: - name: Run linters run: make lint + - name: Validate configs + run: make validate + test: strategy: fail-fast: false @@ -38,7 +40,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 @@ -53,7 +55,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 diff --git a/.gitignore b/.gitignore index 8f658ee..ad1d7b6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ /spec/reports/ /tmp/ /node_modules/ +/schema/ # rspec failure tracking .rspec_status diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..6098b6e --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "redhat.vscode-yaml" + ] +} diff --git a/Makefile b/Makefile index 3c824ba..fc4889f 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,16 @@ -default: lint test +default: lint validate test lint: yamllint lib/html2rss/configs/ .github/ bundle exec rubocop -P -f quiet - npx prettier --check lib/**/*.yml .github/**/*.yml README.md + npx prettier --check lib/**/*.yml .github/**/*.yml README.md + +validate: + bundle exec ruby bin/validate_configs + +schema: + mkdir -p schema + bundle exec html2rss schema --write schema/html2rss-config.schema.json test: bundle exec rspec diff --git a/README.md b/README.md index 9610a96..aa91c1a 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,18 @@ channel: The `type` field specifies the parameter type (currently only `string` is supported), and `default` provides the default value when no parameter is explicitly provided. +## Validation + +Validate configs against the html2rss schema before committing: + +```bash +# Validate all configs +make validate + +# Validate a single config directly +bundle exec html2rss validate lib/html2rss/configs/github.com/releases.yml +``` + ## Testing Uses **dynamic test generation** - no individual spec files needed! @@ -55,7 +67,7 @@ make test-config CONFIG=github.com/releases.yml make test-domain DOMAIN=github.com ``` -**Adding new configs**: Just create the YAML file and run tests. No spec file needed. +**Adding new configs**: Just create the YAML file and run `make validate` then tests. No spec file needed. **Config folder convention**: Place configs under the registrable domain folder (e.g., `example.com/` or `bbc.co.uk/`). Legacy subdomain folders (e.g., `news.example.com/`) are allowed but not preferred. diff --git a/bin/setup b/bin/setup index dce67d8..e0de87d 100755 --- a/bin/setup +++ b/bin/setup @@ -1,8 +1,33 @@ #!/usr/bin/env bash set -euo pipefail IFS=$'\n\t' -set -vx +echo "==> Installing Ruby dependencies..." bundle install -# Do any other automated setup that you need to do here +echo +echo "==> Installing Node dependencies (required for make lint)..." +npm install --no-fund --no-audit --no-save prettier + +echo +echo "==> Checking system tools..." +if command -v yamllint &>/dev/null; then + echo " yamllint: ok ($(yamllint --version))" +else + echo " yamllint: not found" + echo " Install with one of:" + echo " brew install yamllint" + echo " pip install yamllint" +fi + +echo +echo "==> Setup complete. Common commands:" +echo +echo " make # lint + validate + test" +echo " make lint # yamllint, rubocop, prettier" +echo " make validate # validate all configs against the html2rss schema" +echo " make test # run rspec" +echo +echo " make test-config CONFIG=github.com/releases.yml # test a single config" +echo " make test-domain DOMAIN=github.com # test all configs for a domain" +echo " make schema # write schema locally (optional)" diff --git a/bin/validate_configs b/bin/validate_configs new file mode 100755 index 0000000..8ee479c --- /dev/null +++ b/bin/validate_configs @@ -0,0 +1,38 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require 'bundler/setup' +require 'html2rss' +require 'yaml' + +unless Html2rss::Config.respond_to?(:validate) + warn 'Error: installed html2rss gem does not support Config.validate.' + warn 'Run: bundle update html2rss' + exit 1 +end + +files = Dir['lib/html2rss/configs/**/*.yml'] +failed = [] + +files.each do |file| + config = YAML.safe_load_file(file, symbolize_names: true) + result = Html2rss::Config.validate(config) + + if result.success? + puts "ok #{file}" + else + puts "FAIL #{file}" + result.errors.to_h.each do |key, messages| + Array(messages).each { |msg| warn " #{key}: #{msg}" } + end + failed << file + end +end + +puts +if failed.empty? + puts "#{files.size} configs validated successfully." +else + warn "#{failed.size}/#{files.size} configs failed validation." + exit 1 +end From 8a67725a69d53ce4d9870c028ce2a90e52d5636f Mon Sep 17 00:00:00 2001 From: Gil Desmarais Date: Tue, 10 Mar 2026 18:21:21 +0100 Subject: [PATCH 2/6] feat(config): add YAML schema hints for editors --- .vscode/settings.json | 5 +++++ README.md | 19 +++++++++++++++++++ .../configs/adfc.de/pressemitteilungen.yml | 1 + lib/html2rss/configs/apnews.com/hub.yml | 1 + lib/html2rss/configs/avherald.com/index.yml | 1 + .../configs/bbc.co.uk/available_episodes.yml | 1 + lib/html2rss/configs/bbc.com/mundo.yml | 1 + .../configs/blog.mondediplo.net/feed.yml | 1 + .../configs/canarianweekly.com/front.yml | 1 + .../configs/cinemascore.com/index.yml | 1 + .../configs/cleanenergywire.org/news.yml | 1 + lib/html2rss/configs/cnet.com/section_sub.yml | 1 + .../configs/computerbase.de/meistgelesen.yml | 1 + lib/html2rss/configs/cutle.fish/index.yml | 1 + .../configs/deraktionaer.de/meistgelesen.yml | 1 + ...ials_data_documentation_technotes_json.yml | 1 + .../configs/dfs.de/pressemitteilungen.yml | 1 + lib/html2rss/configs/dsw-info.de/presse.yml | 1 + lib/html2rss/configs/espn.com/f1.yml | 3 +++ lib/html2rss/configs/fia.com/documents.yml | 1 + lib/html2rss/configs/formula1.com/latest.yml | 1 + lib/html2rss/configs/github.com/releases.yml | 1 + lib/html2rss/configs/iaapa.org/news.yml | 1 + lib/html2rss/configs/imdb.com/ratings.yml | 1 + .../karriere_arbeitsleben_heiko_mell.yml | 1 + .../configs/kinocheck.de/filmstarts.yml | 1 + .../configs/microsoft.com/azure-products.yml | 1 + .../configs/newyorker.com/magazine.yml | 1 + lib/html2rss/configs/nomanssky.com/news.yml | 1 + .../search.yml | 1 + lib/html2rss/configs/phys.org/weekly.yml | 1 + .../configs/rbb24.de/meistgeklickt.yml | 1 + .../configs/robinwood.de/aktuelles.yml | 1 + .../s3.amazonaws.com/popular_movies.yml | 1 + .../configs/sebastianvettel.de/news.yml | 1 + .../configs/softwareleadweekly.com/issues.yml | 1 + .../configs/solarthermalworld.org/news.yml | 1 + .../configs/spektrum.de/meistgelesen.yml | 1 + .../configs/spiegel.de/impressum_autor.yml | 1 + .../hot_network_questions.yml | 1 + lib/html2rss/configs/steuerzahler.de/news.yml | 1 + lib/html2rss/configs/stripes.com/index.yml | 1 + .../support.apple.com/en_gb_ht201222.yml | 1 + .../support.apple.com/exchange_repair.yml | 1 + .../configs/teneriffa-news.com/news.yml | 1 + lib/html2rss/configs/test.de/archiv.yml | 1 + .../international_mostpopular.yml | 1 + .../configs/thoughtworks.com/insights.yml | 1 + .../aktuelle_nachrichten.yml | 1 + .../configs/webentwickler-jobs.de/in.yml | 1 + 50 files changed, 74 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..616d1a6 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "yaml.schemas": { + "https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json": "lib/html2rss/configs/**/*.yml" + } +} diff --git a/README.md b/README.md index aa91c1a..15350ae 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,25 @@ make test-domain DOMAIN=github.com **Config folder convention**: Place configs under the registrable domain folder (e.g., `example.com/` or `bbc.co.uk/`). Legacy subdomain folders (e.g., `news.example.com/`) are allowed but not preferred. +## Editor Setup (JSON Schema) + +Get inline validation and autocompletion when editing configs in your IDE. +All config files already carry the schema modeline at the top: + +```yaml +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json +``` + +Any editor with [yaml-language-server](https://github.com/redhat-developer/yaml-language-server) +support (VS Code + [YAML extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml), +Neovim, Helix, …) will automatically pick up the schema when opening a config file. + +The included `.vscode/settings.json` additionally associates the schema with all +configs via a glob pattern, so new files get validation before the modeline is added. + +> `make schema` writes `schema/html2rss-config.schema.json` locally — useful for +> offline editing or when you want to pin against the currently installed gem version. + ## Documentation - [Main Documentation](https://html2rss.github.io/html2rss-configs/) diff --git a/lib/html2rss/configs/adfc.de/pressemitteilungen.yml b/lib/html2rss/configs/adfc.de/pressemitteilungen.yml index 8592aad..ca777c2 100644 --- a/lib/html2rss/configs/adfc.de/pressemitteilungen.yml +++ b/lib/html2rss/configs/adfc.de/pressemitteilungen.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://www.adfc.de/presse/pressemitteilungen/ time_zone: Europe/Berlin diff --git a/lib/html2rss/configs/apnews.com/hub.yml b/lib/html2rss/configs/apnews.com/hub.yml index 6aef1ab..913b2fc 100644 --- a/lib/html2rss/configs/apnews.com/hub.yml +++ b/lib/html2rss/configs/apnews.com/hub.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json --- parameters: section: diff --git a/lib/html2rss/configs/avherald.com/index.yml b/lib/html2rss/configs/avherald.com/index.yml index dfb6444..92ad4cc 100644 --- a/lib/html2rss/configs/avherald.com/index.yml +++ b/lib/html2rss/configs/avherald.com/index.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json --- channel: url: https://avherald.com/ diff --git a/lib/html2rss/configs/bbc.co.uk/available_episodes.yml b/lib/html2rss/configs/bbc.co.uk/available_episodes.yml index 2113a9c..e0eb1f4 100644 --- a/lib/html2rss/configs/bbc.co.uk/available_episodes.yml +++ b/lib/html2rss/configs/bbc.co.uk/available_episodes.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json parameters: id: type: string diff --git a/lib/html2rss/configs/bbc.com/mundo.yml b/lib/html2rss/configs/bbc.com/mundo.yml index 8dcb8e4..f59be67 100644 --- a/lib/html2rss/configs/bbc.com/mundo.yml +++ b/lib/html2rss/configs/bbc.com/mundo.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json --- channel: url: https://www.bbc.com/mundo diff --git a/lib/html2rss/configs/blog.mondediplo.net/feed.yml b/lib/html2rss/configs/blog.mondediplo.net/feed.yml index 8675339..a21d593 100644 --- a/lib/html2rss/configs/blog.mondediplo.net/feed.yml +++ b/lib/html2rss/configs/blog.mondediplo.net/feed.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json parameters: blog: type: string diff --git a/lib/html2rss/configs/canarianweekly.com/front.yml b/lib/html2rss/configs/canarianweekly.com/front.yml index 6e147aa..170e401 100644 --- a/lib/html2rss/configs/canarianweekly.com/front.yml +++ b/lib/html2rss/configs/canarianweekly.com/front.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://www.canarianweekly.com/ time_zone: Europe/London diff --git a/lib/html2rss/configs/cinemascore.com/index.yml b/lib/html2rss/configs/cinemascore.com/index.yml index a6b52fb..dec4449 100644 --- a/lib/html2rss/configs/cinemascore.com/index.yml +++ b/lib/html2rss/configs/cinemascore.com/index.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://webapp.cinemascore.com/guest/surveys ttl: 720 diff --git a/lib/html2rss/configs/cleanenergywire.org/news.yml b/lib/html2rss/configs/cleanenergywire.org/news.yml index bb53efe..36785d1 100644 --- a/lib/html2rss/configs/cleanenergywire.org/news.yml +++ b/lib/html2rss/configs/cleanenergywire.org/news.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://www.cleanenergywire.org/news-archive time_zone: "Europe/Berlin" diff --git a/lib/html2rss/configs/cnet.com/section_sub.yml b/lib/html2rss/configs/cnet.com/section_sub.yml index 9f68ecf..ed67bc6 100644 --- a/lib/html2rss/configs/cnet.com/section_sub.yml +++ b/lib/html2rss/configs/cnet.com/section_sub.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json --- parameters: section: diff --git a/lib/html2rss/configs/computerbase.de/meistgelesen.yml b/lib/html2rss/configs/computerbase.de/meistgelesen.yml index b5c18e9..365d412 100644 --- a/lib/html2rss/configs/computerbase.de/meistgelesen.yml +++ b/lib/html2rss/configs/computerbase.de/meistgelesen.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: title: "computerbase.de: meistgelesen" url: https://www.computerbase.de diff --git a/lib/html2rss/configs/cutle.fish/index.yml b/lib/html2rss/configs/cutle.fish/index.yml index 95ac828..123112c 100644 --- a/lib/html2rss/configs/cutle.fish/index.yml +++ b/lib/html2rss/configs/cutle.fish/index.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json --- channel: url: https://cutle.fish/ diff --git a/lib/html2rss/configs/deraktionaer.de/meistgelesen.yml b/lib/html2rss/configs/deraktionaer.de/meistgelesen.yml index c338b25..e538909 100644 --- a/lib/html2rss/configs/deraktionaer.de/meistgelesen.yml +++ b/lib/html2rss/configs/deraktionaer.de/meistgelesen.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: title: "deraktionaer.de: meistgelesen" url: https://deraktionaer.de/ diff --git a/lib/html2rss/configs/developer.apple.com/tutorials_data_documentation_technotes_json.yml b/lib/html2rss/configs/developer.apple.com/tutorials_data_documentation_technotes_json.yml index fe55c8d..3809d17 100644 --- a/lib/html2rss/configs/developer.apple.com/tutorials_data_documentation_technotes_json.yml +++ b/lib/html2rss/configs/developer.apple.com/tutorials_data_documentation_technotes_json.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json --- channel: json: true diff --git a/lib/html2rss/configs/dfs.de/pressemitteilungen.yml b/lib/html2rss/configs/dfs.de/pressemitteilungen.yml index 3f10ed4..b8d973d 100644 --- a/lib/html2rss/configs/dfs.de/pressemitteilungen.yml +++ b/lib/html2rss/configs/dfs.de/pressemitteilungen.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://www.dfs.de/homepage/de/medien/presse/ time_zone: Europe/Berlin diff --git a/lib/html2rss/configs/dsw-info.de/presse.yml b/lib/html2rss/configs/dsw-info.de/presse.yml index afab1ec..fe8f276 100644 --- a/lib/html2rss/configs/dsw-info.de/presse.yml +++ b/lib/html2rss/configs/dsw-info.de/presse.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://www.dsw-info.de/presse time_zone: Europe/Berlin diff --git a/lib/html2rss/configs/espn.com/f1.yml b/lib/html2rss/configs/espn.com/f1.yml index 68f32a8..d586752 100644 --- a/lib/html2rss/configs/espn.com/f1.yml +++ b/lib/html2rss/configs/espn.com/f1.yml @@ -1,9 +1,12 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json +strategy: default channel: url: https://www.espn.com/f1/ time_zone: UTC ttl: 60 selectors: items: + s: 'dfd' selector: ".headlineStack__list > li" title: selector: "a" diff --git a/lib/html2rss/configs/fia.com/documents.yml b/lib/html2rss/configs/fia.com/documents.yml index 729531b..0a19113 100644 --- a/lib/html2rss/configs/fia.com/documents.yml +++ b/lib/html2rss/configs/fia.com/documents.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json --- channel: url: https://www.fia.com/documents/championships/fia-formula-one-world-championship-14/season/season-2026-2072 diff --git a/lib/html2rss/configs/formula1.com/latest.yml b/lib/html2rss/configs/formula1.com/latest.yml index c95070a..afd9daa 100644 --- a/lib/html2rss/configs/formula1.com/latest.yml +++ b/lib/html2rss/configs/formula1.com/latest.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://www.formula1.com/en/latest/all.html time_zone: UTC diff --git a/lib/html2rss/configs/github.com/releases.yml b/lib/html2rss/configs/github.com/releases.yml index c313825..1441806 100644 --- a/lib/html2rss/configs/github.com/releases.yml +++ b/lib/html2rss/configs/github.com/releases.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json parameters: username: type: string diff --git a/lib/html2rss/configs/iaapa.org/news.yml b/lib/html2rss/configs/iaapa.org/news.yml index bf35635..d4820b5 100644 --- a/lib/html2rss/configs/iaapa.org/news.yml +++ b/lib/html2rss/configs/iaapa.org/news.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://www.iaapa.org/news time_zone: UTC diff --git a/lib/html2rss/configs/imdb.com/ratings.yml b/lib/html2rss/configs/imdb.com/ratings.yml index 46cae73..9ff71ca 100644 --- a/lib/html2rss/configs/imdb.com/ratings.yml +++ b/lib/html2rss/configs/imdb.com/ratings.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json parameters: user_id: type: string diff --git a/lib/html2rss/configs/ingenieur.de/karriere_arbeitsleben_heiko_mell.yml b/lib/html2rss/configs/ingenieur.de/karriere_arbeitsleben_heiko_mell.yml index e88712f..09b9e29 100644 --- a/lib/html2rss/configs/ingenieur.de/karriere_arbeitsleben_heiko_mell.yml +++ b/lib/html2rss/configs/ingenieur.de/karriere_arbeitsleben_heiko_mell.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json --- channel: url: https://www.ingenieur.de/karriere/arbeitsleben/heiko-mell/ diff --git a/lib/html2rss/configs/kinocheck.de/filmstarts.yml b/lib/html2rss/configs/kinocheck.de/filmstarts.yml index 7b38776..3e2987d 100644 --- a/lib/html2rss/configs/kinocheck.de/filmstarts.yml +++ b/lib/html2rss/configs/kinocheck.de/filmstarts.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://kinocheck.de/filmstarts time_zone: Europe/Berlin diff --git a/lib/html2rss/configs/microsoft.com/azure-products.yml b/lib/html2rss/configs/microsoft.com/azure-products.yml index 27eb9cb..e18b5c5 100644 --- a/lib/html2rss/configs/microsoft.com/azure-products.yml +++ b/lib/html2rss/configs/microsoft.com/azure-products.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://azure.microsoft.com/en-us/products language: en diff --git a/lib/html2rss/configs/newyorker.com/magazine.yml b/lib/html2rss/configs/newyorker.com/magazine.yml index b6e8d8d..b837beb 100644 --- a/lib/html2rss/configs/newyorker.com/magazine.yml +++ b/lib/html2rss/configs/newyorker.com/magazine.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json --- channel: url: https://www.newyorker.com/magazine diff --git a/lib/html2rss/configs/nomanssky.com/news.yml b/lib/html2rss/configs/nomanssky.com/news.yml index 511fa4d..0631793 100644 --- a/lib/html2rss/configs/nomanssky.com/news.yml +++ b/lib/html2rss/configs/nomanssky.com/news.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json --- channel: url: https://www.nomanssky.com/news/ diff --git a/lib/html2rss/configs/pankow.lebensmittel-kontrollergebnisse.de/search.yml b/lib/html2rss/configs/pankow.lebensmittel-kontrollergebnisse.de/search.yml index 67f42f3..9c51c86 100644 --- a/lib/html2rss/configs/pankow.lebensmittel-kontrollergebnisse.de/search.yml +++ b/lib/html2rss/configs/pankow.lebensmittel-kontrollergebnisse.de/search.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json --- channel: url: https://pankow.lebensmittel-kontrollergebnisse.de/Search diff --git a/lib/html2rss/configs/phys.org/weekly.yml b/lib/html2rss/configs/phys.org/weekly.yml index 3002a9f..c1e54d7 100644 --- a/lib/html2rss/configs/phys.org/weekly.yml +++ b/lib/html2rss/configs/phys.org/weekly.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://phys.org/weekly-news/ time_zone: Europe/London diff --git a/lib/html2rss/configs/rbb24.de/meistgeklickt.yml b/lib/html2rss/configs/rbb24.de/meistgeklickt.yml index 9e8ab00..8382f81 100644 --- a/lib/html2rss/configs/rbb24.de/meistgeklickt.yml +++ b/lib/html2rss/configs/rbb24.de/meistgeklickt.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: title: "rbb24.de: meistgeklickt" url: https://rbb24.de/ diff --git a/lib/html2rss/configs/robinwood.de/aktuelles.yml b/lib/html2rss/configs/robinwood.de/aktuelles.yml index 5b749b6..50a32de 100644 --- a/lib/html2rss/configs/robinwood.de/aktuelles.yml +++ b/lib/html2rss/configs/robinwood.de/aktuelles.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://www.robinwood.de/was-gibt-es-neues/aktuelles time_zone: Europe/Berlin diff --git a/lib/html2rss/configs/s3.amazonaws.com/popular_movies.yml b/lib/html2rss/configs/s3.amazonaws.com/popular_movies.yml index 7b8a4e0..6e0cdaa 100644 --- a/lib/html2rss/configs/s3.amazonaws.com/popular_movies.yml +++ b/lib/html2rss/configs/s3.amazonaws.com/popular_movies.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json # This generates a RSS of the daily updated # https://github.com/sjlu/popular-movies channel: diff --git a/lib/html2rss/configs/sebastianvettel.de/news.yml b/lib/html2rss/configs/sebastianvettel.de/news.yml index be4deb2..e9e84a7 100644 --- a/lib/html2rss/configs/sebastianvettel.de/news.yml +++ b/lib/html2rss/configs/sebastianvettel.de/news.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json --- channel: url: https://sebastianvettel.de/news/ diff --git a/lib/html2rss/configs/softwareleadweekly.com/issues.yml b/lib/html2rss/configs/softwareleadweekly.com/issues.yml index 248f272..c397ec9 100644 --- a/lib/html2rss/configs/softwareleadweekly.com/issues.yml +++ b/lib/html2rss/configs/softwareleadweekly.com/issues.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://softwareleadweekly.com/issues time_zone: UTC diff --git a/lib/html2rss/configs/solarthermalworld.org/news.yml b/lib/html2rss/configs/solarthermalworld.org/news.yml index af186b1..86b6780 100644 --- a/lib/html2rss/configs/solarthermalworld.org/news.yml +++ b/lib/html2rss/configs/solarthermalworld.org/news.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://solarthermalworld.org/news time_zone: UTC diff --git a/lib/html2rss/configs/spektrum.de/meistgelesen.yml b/lib/html2rss/configs/spektrum.de/meistgelesen.yml index 4c6b3c0..4a56d1e 100644 --- a/lib/html2rss/configs/spektrum.de/meistgelesen.yml +++ b/lib/html2rss/configs/spektrum.de/meistgelesen.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: title: "spektrum.de: meistgelesen" url: https://www.spektrum.de/ diff --git a/lib/html2rss/configs/spiegel.de/impressum_autor.yml b/lib/html2rss/configs/spiegel.de/impressum_autor.yml index 637f83e..1dbe355 100644 --- a/lib/html2rss/configs/spiegel.de/impressum_autor.yml +++ b/lib/html2rss/configs/spiegel.de/impressum_autor.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json parameters: id: type: string diff --git a/lib/html2rss/configs/stackoverflow.com/hot_network_questions.yml b/lib/html2rss/configs/stackoverflow.com/hot_network_questions.yml index 0e05e4e..de6e927 100644 --- a/lib/html2rss/configs/stackoverflow.com/hot_network_questions.yml +++ b/lib/html2rss/configs/stackoverflow.com/hot_network_questions.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: title: "stackoverflow.com: Hot Network Questions" url: https://stackoverflow.com/questions diff --git a/lib/html2rss/configs/steuerzahler.de/news.yml b/lib/html2rss/configs/steuerzahler.de/news.yml index 42513ed..0379b04 100644 --- a/lib/html2rss/configs/steuerzahler.de/news.yml +++ b/lib/html2rss/configs/steuerzahler.de/news.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://www.steuerzahler.de/news time_zone: Europe/Berlin diff --git a/lib/html2rss/configs/stripes.com/index.yml b/lib/html2rss/configs/stripes.com/index.yml index 177c241..25f14af 100644 --- a/lib/html2rss/configs/stripes.com/index.yml +++ b/lib/html2rss/configs/stripes.com/index.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json --- channel: url: https://www.stripes.com/ diff --git a/lib/html2rss/configs/support.apple.com/en_gb_ht201222.yml b/lib/html2rss/configs/support.apple.com/en_gb_ht201222.yml index 3c621c6..cff9615 100644 --- a/lib/html2rss/configs/support.apple.com/en_gb_ht201222.yml +++ b/lib/html2rss/configs/support.apple.com/en_gb_ht201222.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json --- channel: url: https://support.apple.com/en-gb/HT201222 diff --git a/lib/html2rss/configs/support.apple.com/exchange_repair.yml b/lib/html2rss/configs/support.apple.com/exchange_repair.yml index e205b76..a00dfb8 100644 --- a/lib/html2rss/configs/support.apple.com/exchange_repair.yml +++ b/lib/html2rss/configs/support.apple.com/exchange_repair.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://support.apple.com/exchange_repair time_zone: America/Los_Angeles diff --git a/lib/html2rss/configs/teneriffa-news.com/news.yml b/lib/html2rss/configs/teneriffa-news.com/news.yml index a170313..e063654 100644 --- a/lib/html2rss/configs/teneriffa-news.com/news.yml +++ b/lib/html2rss/configs/teneriffa-news.com/news.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://www.teneriffa-news.com/news time_zone: "Europe/Lisbon" diff --git a/lib/html2rss/configs/test.de/archiv.yml b/lib/html2rss/configs/test.de/archiv.yml index 1bc19ae..9c84c5e 100644 --- a/lib/html2rss/configs/test.de/archiv.yml +++ b/lib/html2rss/configs/test.de/archiv.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json --- channel: url: https://www.test.de/archiv/ diff --git a/lib/html2rss/configs/theguardian.com/international_mostpopular.yml b/lib/html2rss/configs/theguardian.com/international_mostpopular.yml index 0126e7a..bcce060 100644 --- a/lib/html2rss/configs/theguardian.com/international_mostpopular.yml +++ b/lib/html2rss/configs/theguardian.com/international_mostpopular.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: title: "theguardian.com: International most popular" url: https://www.theguardian.com/international diff --git a/lib/html2rss/configs/thoughtworks.com/insights.yml b/lib/html2rss/configs/thoughtworks.com/insights.yml index cf53552..42d235d 100644 --- a/lib/html2rss/configs/thoughtworks.com/insights.yml +++ b/lib/html2rss/configs/thoughtworks.com/insights.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://www.thoughtworks.com/insights language: en diff --git a/lib/html2rss/configs/tourismusnetzwerk-brandenburg.de/aktuelle_nachrichten.yml b/lib/html2rss/configs/tourismusnetzwerk-brandenburg.de/aktuelle_nachrichten.yml index 436023a..1892fef 100644 --- a/lib/html2rss/configs/tourismusnetzwerk-brandenburg.de/aktuelle_nachrichten.yml +++ b/lib/html2rss/configs/tourismusnetzwerk-brandenburg.de/aktuelle_nachrichten.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json channel: url: https://www.tourismusnetzwerk-brandenburg.de/nc/aktuelle-nachrichten/ time_zone: Europe/Berlin diff --git a/lib/html2rss/configs/webentwickler-jobs.de/in.yml b/lib/html2rss/configs/webentwickler-jobs.de/in.yml index ca03f84..2cf625c 100644 --- a/lib/html2rss/configs/webentwickler-jobs.de/in.yml +++ b/lib/html2rss/configs/webentwickler-jobs.de/in.yml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json --- parameters: region: From 4f738fdffe871febd5e52d8b2fb8cad2888b5ae5 Mon Sep 17 00:00:00 2001 From: Gil Desmarais Date: Tue, 10 Mar 2026 18:32:40 +0100 Subject: [PATCH 3/6] fix(devx): pin prettier and harden config validation --- .github/workflows/ruby.yml | 3 +++ Makefile | 4 ++-- bin/setup | 2 +- bin/validate_configs | 32 ++++++++++++++++++-------------- package-lock.json | 28 ++++++++++++++++++++++++++++ package.json | 6 ++++++ 6 files changed, 58 insertions(+), 17 deletions(-) create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index d9f7902..2e3a970 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -19,6 +19,9 @@ jobs: - name: Install dependencies run: sudo apt-get install -yqq yamllint + - name: Install Node dependencies + run: npm ci --ignore-scripts --no-fund --no-audit + - name: Set up Ruby uses: ruby/setup-ruby@v1 with: diff --git a/Makefile b/Makefile index fc4889f..4126c24 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ default: lint validate test lint: yamllint lib/html2rss/configs/ .github/ bundle exec rubocop -P -f quiet - npx prettier --check lib/**/*.yml .github/**/*.yml README.md + ./node_modules/.bin/prettier --check lib/**/*.yml .github/**/*.yml README.md validate: bundle exec ruby bin/validate_configs @@ -53,4 +53,4 @@ restore-tests: lintfix: bundle exec rubocop -a - npx prettier --write lib/**/*.yml .github/**/*.yml README.md + ./node_modules/.bin/prettier --write lib/**/*.yml .github/**/*.yml README.md diff --git a/bin/setup b/bin/setup index e0de87d..935796b 100755 --- a/bin/setup +++ b/bin/setup @@ -7,7 +7,7 @@ bundle install echo echo "==> Installing Node dependencies (required for make lint)..." -npm install --no-fund --no-audit --no-save prettier +npm install --ignore-scripts --no-fund --no-audit echo echo "==> Checking system tools..." diff --git a/bin/validate_configs b/bin/validate_configs index 8ee479c..b462e7b 100755 --- a/bin/validate_configs +++ b/bin/validate_configs @@ -5,26 +5,30 @@ require 'bundler/setup' require 'html2rss' require 'yaml' -unless Html2rss::Config.respond_to?(:validate) - warn 'Error: installed html2rss gem does not support Config.validate.' - warn 'Run: bundle update html2rss' - exit 1 -end - files = Dir['lib/html2rss/configs/**/*.yml'] failed = [] files.each do |file| - config = YAML.safe_load_file(file, symbolize_names: true) - result = Html2rss::Config.validate(config) + begin + config = YAML.safe_load_file(file, symbolize_names: true) + result = Html2rss::Config.validate(config) - if result.success? - puts "ok #{file}" - else - puts "FAIL #{file}" - result.errors.to_h.each do |key, messages| - Array(messages).each { |msg| warn " #{key}: #{msg}" } + if result.success? + puts "ok #{file}" + else + puts "FAIL #{file}" + result.errors.to_h.each do |key, messages| + Array(messages).each { |msg| warn " #{key}: #{msg}" } + end + failed << file end + rescue Psych::Exception => e + puts "FAIL #{file}" + warn " parse: #{e.message}" + failed << file + rescue StandardError => e + puts "FAIL #{file}" + warn " validation: #{e.class}: #{e.message}" failed << file end end diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..72917e7 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,28 @@ +{ + "name": "html2rss-configs", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "prettier": "3.8.1" + } + }, + "node_modules/prettier": { + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.1.tgz", + "integrity": "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..fb8b622 --- /dev/null +++ b/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "devDependencies": { + "prettier": "3.8.1" + } +} From 8bbf08c9f1e153b897a77a4af7b85d7b8c0d99e4 Mon Sep 17 00:00:00 2001 From: Gil Desmarais Date: Tue, 10 Mar 2026 18:41:59 +0100 Subject: [PATCH 4/6] fix(ci): skip schema-only changed config fetch tests --- bin/rspec_changed_configs | 42 +++++++++++++++++++--------- bin/validate_configs | 34 +++++++++++----------- lib/html2rss/configs/espn.com/f1.yml | 2 -- 3 files changed, 45 insertions(+), 33 deletions(-) diff --git a/bin/rspec_changed_configs b/bin/rspec_changed_configs index bae20c5..db46eb1 100755 --- a/bin/rspec_changed_configs +++ b/bin/rspec_changed_configs @@ -1,18 +1,34 @@ #!/usr/bin/env ruby # frozen_string_literal: true -changed_files = `git diff --name-only origin/master | grep 'lib/html2rss/configs/.*/.*.yml'`.split("\n") - -if changed_files.any? - # Use dynamic test file with environment variable to filter changed configs - config_names = changed_files.map { |file| file.sub('lib/html2rss/configs/', '') } - - # Test each changed config individually - config_names.each do |config_name| - puts "Testing changed config: #{config_name}" - system("bundle exec rspec --example '#{config_name}' --tag fetch spec/html2rss/configs_dynamic_spec.rb") - end -else - puts 'No changed config files found' +CONFIG_PATH = %r{\Alib/html2rss/configs/.+/.+\.yml\z} +SCHEMA_MODELINE = /\A[+-]# yaml-language-server: \$schema=/ + +def comment_only_change?(file) + diff_lines = `git diff --unified=0 origin/master -- #{file}`.lines + changed_lines = diff_lines.select { |line| line.start_with?('+', '-') } + content_lines = changed_lines.reject { |line| line.start_with?('+++', '---') } + + content_lines.any? && content_lines.all? { |line| line.match?(SCHEMA_MODELINE) } +end + +changed_files = `git diff --name-only origin/master` + .split("\n") + .grep(CONFIG_PATH) + +test_files = changed_files.reject { |file| comment_only_change?(file) } + +if test_files.empty? + puts 'No changed config files require fetch tests' exit 0 end + +failed = false + +test_files.each do |file| + config_name = file.sub('lib/html2rss/configs/', '') + puts "Testing changed config: #{config_name}" + failed ||= !system("bundle exec rspec --example '#{config_name}' --tag fetch spec/html2rss/configs_dynamic_spec.rb") +end + +exit 1 if failed diff --git a/bin/validate_configs b/bin/validate_configs index b462e7b..eb0b48c 100755 --- a/bin/validate_configs +++ b/bin/validate_configs @@ -9,28 +9,26 @@ files = Dir['lib/html2rss/configs/**/*.yml'] failed = [] files.each do |file| - begin - config = YAML.safe_load_file(file, symbolize_names: true) - result = Html2rss::Config.validate(config) + config = YAML.safe_load_file(file, symbolize_names: true) + result = Html2rss::Config.validate(config) - if result.success? - puts "ok #{file}" - else - puts "FAIL #{file}" - result.errors.to_h.each do |key, messages| - Array(messages).each { |msg| warn " #{key}: #{msg}" } - end - failed << file - end - rescue Psych::Exception => e - puts "FAIL #{file}" - warn " parse: #{e.message}" - failed << file - rescue StandardError => e + if result.success? + puts "ok #{file}" + else puts "FAIL #{file}" - warn " validation: #{e.class}: #{e.message}" + result.errors.to_h.each do |key, messages| + Array(messages).each { |msg| warn " #{key}: #{msg}" } + end failed << file end +rescue Psych::Exception => error + puts "FAIL #{file}" + warn " parse: #{error.message}" + failed << file +rescue StandardError => error + puts "FAIL #{file}" + warn " validation: #{error.class}: #{error.message}" + failed << file end puts diff --git a/lib/html2rss/configs/espn.com/f1.yml b/lib/html2rss/configs/espn.com/f1.yml index d586752..61c117b 100644 --- a/lib/html2rss/configs/espn.com/f1.yml +++ b/lib/html2rss/configs/espn.com/f1.yml @@ -1,12 +1,10 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/html2rss/html2rss/refs/heads/master/schema/html2rss-config.schema.json -strategy: default channel: url: https://www.espn.com/f1/ time_zone: UTC ttl: 60 selectors: items: - s: 'dfd' selector: ".headlineStack__list > li" title: selector: "a" From 0abeff5a5b43446eac6122e577cf94bb1c4bcb97 Mon Sep 17 00:00:00 2001 From: Gil Desmarais Date: Tue, 10 Mar 2026 21:33:16 +0100 Subject: [PATCH 5/6] docs: update readme --- README.md | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 15350ae..ae1cbbb 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ This repository contains `html2rss` feed configurations for many websites. ## Dynamic Parameters -Configs must include a `parameters` section to define default values for dynamic parameters: +Parameterized configs should include a `parameters` section with default values: ```yaml parameters: @@ -38,20 +38,31 @@ channel: # ... rest of config ``` -The `type` field specifies the parameter type (currently only `string` is supported), and `default` provides the default value when no parameter is explicitly provided. +The `type` field specifies the parameter type (currently only `string` is supported), and `default` provides the default value used by this repository's validation and fetch tests. + +Notes: + +- Only configs that use `%s` placeholders need a `parameters` section. +- Callers can still override those defaults at runtime with `html2rss feed ... --params ...`. +- Dynamic substitution applies to `channel` and `headers`; selectors are not parameterized by this feature. ## Validation -Validate configs against the html2rss schema before committing: +Use both schema-aware editing and runtime validation before committing: ```bash -# Validate all configs +# Validate all configs with the runtime validator make validate # Validate a single config directly bundle exec html2rss validate lib/html2rss/configs/github.com/releases.yml + +# Export the current JSON Schema locally for editor use +make schema ``` +The JSON Schema is useful for editor autocompletion and basic structural checks. Runtime validation remains authoritative for merged defaults and cross-field rules. + ## Testing Uses **dynamic test generation** - no individual spec files needed! @@ -67,7 +78,7 @@ make test-config CONFIG=github.com/releases.yml make test-domain DOMAIN=github.com ``` -**Adding new configs**: Just create the YAML file and run `make validate` then tests. No spec file needed. +**Adding new configs**: Create the YAML file, run `make validate`, then run the generated tests. No dedicated spec file is needed. **Config folder convention**: Place configs under the registrable domain folder (e.g., `example.com/` or `bbc.co.uk/`). Legacy subdomain folders (e.g., `news.example.com/`) are allowed but not preferred. @@ -92,6 +103,8 @@ configs via a glob pattern, so new files get validation before the modeline is a ## Documentation -- [Main Documentation](https://html2rss.github.io/html2rss-configs/) +- [Selectors Reference](https://html2rss.github.io/ruby-gem/reference/selectors/) +- [Dynamic Parameters](https://html2rss.github.io/ruby-gem/how-to/dynamic-parameters/) +- [CLI Reference](https://html2rss.github.io/ruby-gem/reference/cli-reference/) - [Contributing Guide](https://html2rss.github.io/get-involved/contributing) - [Sponsorship Page](https://html2rss.github.io/get-involved/sponsoring) From ce705bc1de30437b146b3b0aa16181c9d5c30915 Mon Sep 17 00:00:00 2001 From: Gil Desmarais Date: Tue, 10 Mar 2026 22:05:03 +0100 Subject: [PATCH 6/6] Fix RuboCop CI warnings --- .rubocop.yml | 2 +- bin/rspec_changed_configs | 4 ++-- bin/validate_configs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 592cf20..172518b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,4 @@ -require: +plugins: - rubocop-rspec - rubocop-performance diff --git a/bin/rspec_changed_configs b/bin/rspec_changed_configs index db46eb1..4bed75e 100755 --- a/bin/rspec_changed_configs +++ b/bin/rspec_changed_configs @@ -13,8 +13,8 @@ def comment_only_change?(file) end changed_files = `git diff --name-only origin/master` - .split("\n") - .grep(CONFIG_PATH) + .split("\n") + .grep(CONFIG_PATH) test_files = changed_files.reject { |file| comment_only_change?(file) } diff --git a/bin/validate_configs b/bin/validate_configs index eb0b48c..4fef430 100755 --- a/bin/validate_configs +++ b/bin/validate_configs @@ -26,7 +26,7 @@ rescue Psych::Exception => error warn " parse: #{error.message}" failed << file rescue StandardError => error - puts "FAIL #{file}" + puts "FAIL #{file}" warn " validation: #{error.class}: #{error.message}" failed << file end