Skip to content

Schemastore and known files enhancements#444

Merged
kehoecj merged 10 commits intomainfrom
feat/v2.2-enhancements
Apr 13, 2026
Merged

Schemastore and known files enhancements#444
kehoecj merged 10 commits intomainfrom
feat/v2.2-enhancements

Conversation

@kehoecj
Copy link
Copy Markdown
Collaborator

@kehoecj kehoecj commented Apr 10, 2026

  • Refactor CLI struct to use unexported fields with With* options
  • Embed SchemaStore catalog with remote fetching and local caching (24h TTL)
  • Add --schemastore (bool) and --schemastore-path (string) flags
  • Add .cfv.toml config file support with schema validation
  • Add --config and --no-config flags
  • Add JSONC file type support using hujson
  • Add .tf and .tfvars extensions to HCL
  • Add JSONC note on failed JSON files that are valid JSONC
  • Add stdin support via - search path with --file-types
  • Add exit code granularity (0=clean, 1=validation errors, 2=runtime errors)
  • Add pre-commit hook support (.pre-commit-hooks.yaml)
  • Add context.Context with timeout to schema fetching
  • Rename schemastore Lookup to Resolve
  • Remove configfile dependency on validator package
  • Deduplicate isGlobPattern into tools.IsGlobPattern
  • Extract resolveConfig/buildCLI in cmd/validator
  • Extract Go API docs to docs/go-api.md
  • Add Notes field to Report for non-error supplementary info
  • Fix --depth=0 with trailing slash on search path
  • Update README with TOC, JSON vs JSONC section, stronger About
  • Update release workflow to refresh SchemaStore catalog

- Refactor CLI struct to use unexported fields with With* options
- Embed SchemaStore catalog with remote fetching and local caching (24h TTL)
- Add --schemastore (bool) and --schemastore-path (string) flags
- Add .cfv.toml config file support with schema validation
- Add --config and --no-config flags
- Add JSONC file type support using hujson
- Add .tf and .tfvars extensions to HCL
- Add JSONC note on failed JSON files that are valid JSONC
- Add stdin support via - search path with --file-types
- Add exit code granularity (0=clean, 1=validation errors, 2=runtime errors)
- Add pre-commit hook support (.pre-commit-hooks.yaml)
- Add context.Context with timeout to schema fetching
- Rename schemastore Lookup to Resolve
- Remove configfile dependency on validator package
- Deduplicate isGlobPattern into tools.IsGlobPattern
- Extract resolveConfig/buildCLI in cmd/validator
- Extract Go API docs to docs/go-api.md
- Add Notes field to Report for non-error supplementary info
- Fix --depth=0 with trailing slash on search path
- Update README with TOC, JSON vs JSONC section, stronger About
- Update release workflow to refresh SchemaStore catalog

BREAKING: --schemastore is now a boolean flag (was string path).
Use --schemastore-path for local clones.
BREAKING: schemastore.Lookup renamed to schemastore.Resolve.
BREAKING: CLI struct fields are now unexported (use With* options).
@kehoecj kehoecj requested a review from a team as a code owner April 10, 2026 18:35
kehoecj added 3 commits April 10, 2026 13:38
- Update PKGBUILD to 2.2.0
- Update CHANGELOG from Unreleased to 2.2.0
- Add httptest-based tests for schema fetch/cache (200, 404, 500, network error, cache hit, unwritable dir)
- Add txtar tests for config file keys, stdin, and JSONC features
- Add unit tests for SchemaErrors, JSONC edge cases, stdin with quiet
- Fix config file depth not applying via flagSet.Set
- Coverage: 87.3% -> 92.8% (schemastore: 82.5% -> 91.3%, cmd/validator: 79.3% -> 96.9%)
- Add [validators.csv] section to .cfv.toml for CSV-specific options
  - delimiter: field delimiter character (default comma, supports \t for tab)
  - comment: comment character for skipping lines
  - lazy-quotes: allow quotes in unquoted fields
- CsvValidator struct now accepts Delimiter, Comment, LazyQuotes fields
  (zero values preserve existing behavior)
- ValidatorOptions/CSVOptions structs in configfile package
- applyValidatorOptions creates a copy of file types with configured validators
- Schema validates validator options (unknown keys caught immediately)
- Pattern extends to other validators by adding new option structs
- Updated README and index.md with validator options documentation
@kehoecj kehoecj marked this pull request as draft April 10, 2026 20:38
kehoecj added 6 commits April 10, 2026 16:30
- Add forbid-duplicate-keys option for JSON validator (walks token stream)
- Add forbid-duplicate-keys option for INI validator (uses go-ini shadows)
- YAML already rejects duplicate keys via yaml.v3 (documented, no option needed)
- Default: false for both (preserves current behavior)
- Config via .cfv.toml [validators.json] and [validators.ini] sections
- Schema validates all validator options
- Updated README and index.md with full validator options table
- Fix go:generate directive: ../../ not ../../../ (pkg/filetype is 2 levels deep)
- Fix generator output path: write to current directory since go generate runs from package dir
- Use context-aware HTTP request (noctx)
- Use slices.Sort instead of sort.Strings (revive)
- Use fmt.Fprintf instead of WriteString(Sprintf) (staticcheck)
- Use 0600 file permissions (gosec)
- Add //go:build ignore to generator (build tool, not runtime code)
- Point go:generate at main.go file directly (required with build tag)
- Coverage: 89.3% → 93.0%
…go doc comment

- Add Known Files section to README documenting automatic Linguist detection
- Update JSON vs JSONC section: tsconfig.json etc. are now auto-detected
- Document JSON/JSONC family behavior for --file-types and --exclude-file-types
- Note that --exclude-file-types doesn't affect extensionless known files
- Add package doc comment to file_type.go explaining the KnownFiles data flow
- Sync index.md with README.md
@kehoecj kehoecj changed the title feat: v2.2 enhancements Schemastore and known files enhancements Apr 13, 2026
@kehoecj kehoecj marked this pull request as ready for review April 13, 2026 19:06
@kehoecj kehoecj merged commit 8ccef55 into main Apr 13, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant