Skip to content

Commit 2478df1

Browse files
committed
feat: improve first-time contributor developer experience
bin/validate_configs (new): - Single Ruby process validates all configs via Html2rss::Config.validate, replacing 48 separate bundle exec invocations (~2 min → seconds) - Prints per-file ok/FAIL status with inline error details on failure - Friendly error when the installed gem predates the validate API make validate: - Now calls bin/validate_configs instead of xargs + bundle exec loop bin/setup: - Removed set -vx (noisy shell tracing unhelpful for contributors) - Installs prettier via npm so make lint works immediately after setup - Checks for yamllint with install instructions if missing - Prints a next-steps command reference on completion .vscode/extensions.json (new): - Recommends redhat.vscode-yaml so VS Code prompts to install the extension needed to surface the schema modeline hints https://claude.ai/code/session_01MYdMDpKySqfU1E3qgdikoe
1 parent 4b98022 commit 2478df1

4 files changed

Lines changed: 71 additions & 3 deletions

File tree

.vscode/extensions.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"redhat.vscode-yaml"
4+
]
5+
}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ lint:
66
npx prettier --check lib/**/*.yml .github/**/*.yml README.md
77

88
validate:
9-
find lib/html2rss/configs -name '*.yml' -print0 | xargs -0 -n1 bundle exec html2rss validate
9+
bundle exec ruby bin/validate_configs
1010

1111
schema:
1212
mkdir -p schema

bin/setup

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,33 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33
IFS=$'\n\t'
4-
set -vx
54

5+
echo "==> Installing Ruby dependencies..."
66
bundle install
77

8-
# Do any other automated setup that you need to do here
8+
echo
9+
echo "==> Installing Node dependencies (required for make lint)..."
10+
npm install --no-fund --no-audit --no-save prettier
11+
12+
echo
13+
echo "==> Checking system tools..."
14+
if command -v yamllint &>/dev/null; then
15+
echo " yamllint: ok ($(yamllint --version))"
16+
else
17+
echo " yamllint: not found"
18+
echo " Install with one of:"
19+
echo " brew install yamllint"
20+
echo " pip install yamllint"
21+
fi
22+
23+
echo
24+
echo "==> Setup complete. Common commands:"
25+
echo
26+
echo " make # lint + validate + test"
27+
echo " make lint # yamllint, rubocop, prettier"
28+
echo " make validate # validate all configs against the html2rss schema"
29+
echo " make test # run rspec"
30+
echo
31+
echo " make test-config CONFIG=github.com/releases.yml # test a single config"
32+
echo " make test-domain DOMAIN=github.com # test all configs for a domain"
33+
echo " make schema # write schema locally (optional)"

bin/validate_configs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require 'bundler/setup'
5+
require 'html2rss'
6+
require 'yaml'
7+
8+
unless Html2rss::Config.respond_to?(:validate)
9+
warn 'Error: installed html2rss gem does not support Config.validate.'
10+
warn 'Run: bundle update html2rss'
11+
exit 1
12+
end
13+
14+
files = Dir['lib/html2rss/configs/**/*.yml'].sort
15+
failed = []
16+
17+
files.each do |file|
18+
config = YAML.safe_load_file(file, symbolize_names: true)
19+
result = Html2rss::Config.validate(config)
20+
21+
if result.success?
22+
puts "ok #{file}"
23+
else
24+
puts "FAIL #{file}"
25+
result.errors.to_h.each do |key, messages|
26+
Array(messages).each { |msg| warn " #{key}: #{msg}" }
27+
end
28+
failed << file
29+
end
30+
end
31+
32+
puts
33+
if failed.empty?
34+
puts "#{files.size} configs validated successfully."
35+
else
36+
warn "#{failed.size}/#{files.size} configs failed validation."
37+
exit 1
38+
end

0 commit comments

Comments
 (0)