Schemastore and known files enhancements#444
Merged
Conversation
- 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).
- 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
- 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.