blockwatch-cli 0.11.1__tar.gz → 0.11.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/AGENTS.md +3 -2
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/CHANGELOG.md +20 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/CLAUDE.md +3 -2
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/Cargo.lock +28 -1
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/Cargo.toml +3 -5
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/PKG-INFO +1 -1
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/README.md +18 -15
- blockwatch_cli-0.11.3/blockwatch.toml +40 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/docs/ci.md +4 -6
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/docs/cli.md +14 -6
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/docs/validators/README.md +1 -1
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/release.toml +3 -3
- blockwatch_cli-0.11.3/scripts/check_language_count.lua +19 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/setup.py +2 -2
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/block_parser.rs +2 -2
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/blocks.rs +21 -4
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/cli.rs +2 -1
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/config.rs +5 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/fs.rs +1 -1
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/javascript.rs +46 -0
- blockwatch_cli-0.11.3/src/language_parsers/lean.rs +495 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/markdown.rs +1 -1
- blockwatch_cli-0.11.3/src/language_parsers/mdx.rs +420 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/mod.rs +81 -49
- blockwatch_cli-0.11.3/src/language_parsers/ocaml.rs +136 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/tsx.rs +6 -6
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/repo_path.rs +2 -2
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/skill.md +4 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/validators/check_ai.rs +0 -1
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/validators/mod.rs +1 -1
- blockwatch_cli-0.11.1/blockwatch.toml +0 -6
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/.agents/.claude-plugin/plugin.json +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/.agents/skills/blockwatch/SKILL.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/.claude-plugin/marketplace.json +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/.github/dependabot.yml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/.github/workflows/blockwatch.yml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/.github/workflows/codeql.yml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/.github/workflows/markdownlint.yml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/.github/workflows/pypi.yml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/.github/workflows/release.yml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/.github/workflows/rust.yml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/.github/workflows/trusted-checks.yml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/.gitignore +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/.markdownlint-cli2.yaml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/.pre-commit-config.yaml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/.pre-commit-hooks.yaml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/LICENSE +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/SECURITY.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/clippy.toml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/codecov.yml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/demo.gif +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/dist-workspace.toml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/docs/agents.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/docs/symbols.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/docs/validators/affects.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/docs/validators/check-ai.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/docs/validators/check-lua.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/docs/validators/keep-sorted.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/docs/validators/keep-unique.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/docs/validators/line-count.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/docs/validators/line-pattern.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/docs/validators/same-as.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/pypi/pyproject.toml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/pyproject.toml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/scripts/check_latest_gpt_nano_model.lua +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/diff_parser.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/flags.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/bash.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/c.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/c_sharp.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/cmake.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/cpp.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/css.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/dart.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/dockerfile.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/elixir.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/go.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/graphql.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/groovy.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/hcl.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/html.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/java.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/json.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/json.scm +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/kotlin.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/lua.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/makefile.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/nix.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/php.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/proto.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/python.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/ruby.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/rust.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/scala.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/sql.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/starlark.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/swift.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/toml.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/typescript.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/xml.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/language_parsers/yaml.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/lib.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/main.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/path_arguments.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/paths_glob.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/report.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/sarif.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/settings.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/symbol_path.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/symbols.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/tag_parser.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/validators/affects.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/validators/check_lua.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/validators/keep_sorted.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/validators/keep_unique.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/validators/line_count.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/validators/line_pattern.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/validators/same_as.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/violation_address.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/src/virtual_blocks.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/affects.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/check_ai.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/check_lua.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/common/empty.toml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/common/mod.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/config.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/encoding.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/general.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/keep_sorted.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/keep_unique.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/line_count.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/line_pattern.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/list.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/path_arguments.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/repository_root.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/same_as.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/sarif.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/skill.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/suppressions.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/symbol_references.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/cross_file_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/cross_file_target.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/custom_ext_source.javascript +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/custom_ext_target.javascript +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/dangling.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/missing_symbol.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/more_added_than_deleted.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/multiline_tag_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/multiline_tag_target.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/nested_mapping_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/nested_mapping_target.yaml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/sibling.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/symbol_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/symbol_target.json +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/table_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/table_target.toml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/tag_and_content_source.ts +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/tag_and_content_target.ts +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/whole_file_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/affects/whole_file_target.json +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/check_ai/two_blocks.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/check_lua/affects.lua +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/check_lua/affects.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/check_lua/affects_drift.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/check_lua/blocking_io.lua +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/check_lua/blocking_io.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/check_lua/echo.lua +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/check_lua/fail.lua +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/check_lua/mode.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/check_lua/os.lua +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/check_lua/pathfmt/report_path.lua +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/check_lua/pathfmt/source.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/check_lua/pattern.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/check_lua/pattern_many_matches.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/check_lua/pattern_no_match.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/check_lua/success.lua +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/check_lua/success_and_failure.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/config/glob_target/config.toml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/config/glob_target/package.json +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/config/glob_target/plugins/blue/package.json +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/config/glob_target/plugins/green/package.json +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/config/glob_target/plugins/red/package.json +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/general/block_selection.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/general/custom_file_extension.javascript +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/general/custom_file_extension.python +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/general/disable_enable.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/general/paths/invalid.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/general/paths/subdir/nested_invalid.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/general/paths/valid.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/general/severity.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/hidden/.github/workflows/ci.yml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/keep_sorted/orderings.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/keep_unique/basic_and_pattern.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/line_count/equality_and_greater_than.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/line_pattern/forbidden_text.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/line_pattern/hex_and_word_patterns.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/list/.hg/.gitkeep +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/list/a.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/list/b.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/positions/unicode_columns.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/same_as/custom_ext_source.javascript +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/same_as/custom_ext_target.javascript +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/same_as/package.json +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/same_as/paths/alpha/item.txt +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/same_as/paths/beta/item.txt +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/same_as/paths_and_block_source.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/same_as/paths_source.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/same_as/sibling.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/same_as/source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/same_as/split_table_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/same_as/split_table_target.toml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/same_as/symbol_mismatch_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/same_as/symbol_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/same_as/target.md +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/same_as/whole_file_mismatch_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/same_as/whole_file_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/same_as/whole_file_target.json +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/sarif/advisory.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/sarif/clean.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/sarif/sorted.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/sarif/unnamed.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/suppressions/commit_msg.txt +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/suppressions/commit_msg_gone_a.txt +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/suppressions/commit_msg_gone_b.txt +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/suppressions/commit_msg_lowercase_trailer.txt +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/suppressions/commit_msg_malformed.txt +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/suppressions/commit_msg_with_noise.txt +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/suppressions/dangling.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/suppressions/sorted.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/suppressions/symbol.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/suppressions/symbol_target.json +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/suppressions/two_rules.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/suppressions/unnamed.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/symbol_references/escapes_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/symbol_references/escapes_target.json +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/symbol_references/filter_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/symbol_references/filter_target.yaml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/symbol_references/json_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/symbol_references/json_target.json +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/symbol_references/jsonc_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/symbol_references/jsonc_target.jsonc +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/symbol_references/mixed_list_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/symbol_references/mixed_list_target.json +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/symbol_references/toml_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/symbol_references/toml_target.toml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/symbol_references/yaml_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/symbol_references/yaml_target.yaml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/symbol_references/yml_source.rs +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/symbol_references/yml_target.yml +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/verbosity/affects/pair.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/verbosity/clean/counted.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/verbosity/clean/noop.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/verbosity/clean/notes.txt +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/verbosity/clean/sorted.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/verbosity/diff/two_blocks.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/verbosity/failing/unsorted.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/testdata/verbosity/mixed/both_kinds.py +0 -0
- {blockwatch_cli-0.11.1 → blockwatch_cli-0.11.3}/tests/verbosity.rs +0 -0
|
@@ -125,8 +125,9 @@ Source files here contain real `<block ...>` tags. Two runs check them:
|
|
|
125
125
|
the code here.
|
|
126
126
|
|
|
127
127
|
The hook and CI read `blockwatch.toml`. It skips `tests/testdata/`, where the fixtures break rules on purpose. It also
|
|
128
|
-
|
|
129
|
-
runs that block on a schedule.
|
|
128
|
+
skips the `latest-model` block, because its `check-lua` script needs the network. `.github/workflows/trusted-checks.yml`
|
|
129
|
+
runs that block on a schedule. The `[[block]]` entries in `blockwatch.toml` hold rules too, with no tag in the file
|
|
130
|
+
they check, such as the version and the dependencies in `Cargo.toml`.
|
|
130
131
|
|
|
131
132
|
No test checks these blocks, so `cargo test` can pass while the hook fails. `tests/general.rs` also runs the linter on
|
|
132
133
|
the whole tree, but with an empty config, so the fixtures fail that run on purpose. To check the blocks before you
|
|
@@ -12,6 +12,26 @@ Releases up to and including v0.3.11 predate this file. Their notes live on the
|
|
|
12
12
|
|
|
13
13
|
## [Unreleased] - ReleaseDate
|
|
14
14
|
|
|
15
|
+
## [0.11.3] - 2026-10-15
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- A block with `keep-unique-pattern` now fails the run with ``unrecognized attribute `keep-unique-pattern` ``. Before,
|
|
20
|
+
blockwatch accepted the attribute and ignored it, so `keep-unique` compared whole lines. Put the regex in
|
|
21
|
+
`keep-unique` itself: `keep-unique="(?P<value>\w+)"`.
|
|
22
|
+
|
|
23
|
+
## [0.11.2] - 2026-10-15
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- blockwatch now supports Lean (`.lean`), OCaml (`.ml`, `.mli`) and MDX (`.mdx`) files. Before, it skipped them, so
|
|
28
|
+
their tags were never checked. In MDX, put tags in JavaScript comments, such as `{/* <block> */}`.
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- In JSX and TSX, the braces around a `{/* <block> */}` tag are no longer block content. Before, the `}` after a start
|
|
33
|
+
tag and the `{` before an end tag were part of the block, so e.g. `keep-sorted` reported a correctly sorted list.
|
|
34
|
+
|
|
15
35
|
## [0.11.1] - 2026-10-14
|
|
16
36
|
|
|
17
37
|
### Added
|
|
@@ -125,8 +125,9 @@ Source files here contain real `<block ...>` tags. Two runs check them:
|
|
|
125
125
|
the code here.
|
|
126
126
|
|
|
127
127
|
The hook and CI read `blockwatch.toml`. It skips `tests/testdata/`, where the fixtures break rules on purpose. It also
|
|
128
|
-
|
|
129
|
-
runs that block on a schedule.
|
|
128
|
+
skips the `latest-model` block, because its `check-lua` script needs the network. `.github/workflows/trusted-checks.yml`
|
|
129
|
+
runs that block on a schedule. The `[[block]]` entries in `blockwatch.toml` hold rules too, with no tag in the file
|
|
130
|
+
they check, such as the version and the dependencies in `Cargo.toml`.
|
|
130
131
|
|
|
131
132
|
No test checks these blocks, so `cargo test` can pass while the hook fails. `tests/general.rs` also runs the linter on
|
|
132
133
|
the whole tree, but with an empty config, so the fixtures fail that run on purpose. To check the blocks before you
|
|
@@ -274,7 +274,7 @@ checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
|
|
|
274
274
|
|
|
275
275
|
[[package]]
|
|
276
276
|
name = "blockwatch"
|
|
277
|
-
version = "0.11.
|
|
277
|
+
version = "0.11.3"
|
|
278
278
|
dependencies = [
|
|
279
279
|
"anyhow",
|
|
280
280
|
"assert-json-diff",
|
|
@@ -289,6 +289,7 @@ dependencies = [
|
|
|
289
289
|
"heck",
|
|
290
290
|
"ignore",
|
|
291
291
|
"libc",
|
|
292
|
+
"markdown",
|
|
292
293
|
"mlua",
|
|
293
294
|
"percent-encoding",
|
|
294
295
|
"predicates",
|
|
@@ -328,6 +329,7 @@ dependencies = [
|
|
|
328
329
|
"tree-sitter-make",
|
|
329
330
|
"tree-sitter-md",
|
|
330
331
|
"tree-sitter-nix",
|
|
332
|
+
"tree-sitter-ocaml",
|
|
331
333
|
"tree-sitter-php",
|
|
332
334
|
"tree-sitter-proto",
|
|
333
335
|
"tree-sitter-python",
|
|
@@ -1268,6 +1270,15 @@ dependencies = [
|
|
|
1268
1270
|
"which",
|
|
1269
1271
|
]
|
|
1270
1272
|
|
|
1273
|
+
[[package]]
|
|
1274
|
+
name = "markdown"
|
|
1275
|
+
version = "1.0.0"
|
|
1276
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1277
|
+
checksum = "a5cab8f2cadc416a82d2e783a1946388b31654d391d1c7d92cc1f03e295b1deb"
|
|
1278
|
+
dependencies = [
|
|
1279
|
+
"unicode-id",
|
|
1280
|
+
]
|
|
1281
|
+
|
|
1271
1282
|
[[package]]
|
|
1272
1283
|
name = "matchit"
|
|
1273
1284
|
version = "0.8.4"
|
|
@@ -2646,6 +2657,16 @@ dependencies = [
|
|
|
2646
2657
|
"tree-sitter-language",
|
|
2647
2658
|
]
|
|
2648
2659
|
|
|
2660
|
+
[[package]]
|
|
2661
|
+
name = "tree-sitter-ocaml"
|
|
2662
|
+
version = "0.26.0"
|
|
2663
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2664
|
+
checksum = "43adb10fcccbcbbce0f4adc9dab7cd55f0a5eafc2d71bd4c03fcc5d6767066e0"
|
|
2665
|
+
dependencies = [
|
|
2666
|
+
"cc",
|
|
2667
|
+
"tree-sitter-language",
|
|
2668
|
+
]
|
|
2669
|
+
|
|
2649
2670
|
[[package]]
|
|
2650
2671
|
name = "tree-sitter-php"
|
|
2651
2672
|
version = "0.25.1"
|
|
@@ -2788,6 +2809,12 @@ version = "2.9.0"
|
|
|
2788
2809
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2789
2810
|
checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"
|
|
2790
2811
|
|
|
2812
|
+
[[package]]
|
|
2813
|
+
name = "unicode-id"
|
|
2814
|
+
version = "0.3.7"
|
|
2815
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2816
|
+
checksum = "65dd75ab2d9d379dbe86d4059e91d8b5a6e7054865eaba1ddbfc7a817ff96392"
|
|
2817
|
+
|
|
2791
2818
|
[[package]]
|
|
2792
2819
|
name = "unicode-ident"
|
|
2793
2820
|
version = "1.0.24"
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "blockwatch"
|
|
3
|
-
|
|
4
|
-
version = "0.11.1"
|
|
5
|
-
# </block>
|
|
3
|
+
version = "0.11.3"
|
|
6
4
|
edition = "2024"
|
|
7
5
|
repository = "https://github.com/mennanov/blockwatch"
|
|
8
6
|
description = "Language agnostic linter that keeps your code and documentation in sync and valid"
|
|
@@ -27,6 +25,7 @@ fnv = "1.0"
|
|
|
27
25
|
globset = "0.4.18"
|
|
28
26
|
heck = "0.5"
|
|
29
27
|
ignore = "0.4"
|
|
28
|
+
markdown = "1.0.0"
|
|
30
29
|
mlua = { version = "0.12.0", features = ["lua54", "vendored", "async", "send"] }
|
|
31
30
|
percent-encoding = "2.3"
|
|
32
31
|
regex = "1.12"
|
|
@@ -42,7 +41,6 @@ strum_macros = "0.28"
|
|
|
42
41
|
tokio = { version = "1.52", features = ["full"] }
|
|
43
42
|
toml_edit = { version = "0.25", default-features = false, features = ["parse", "serde"] }
|
|
44
43
|
# The grammar crates the language parsers are built from.
|
|
45
|
-
# <block keep-sorted keep-unique>
|
|
46
44
|
tree-sitter = "0.27.0"
|
|
47
45
|
tree-sitter-bash = "0.25"
|
|
48
46
|
tree-sitter-c = "0.24"
|
|
@@ -66,6 +64,7 @@ tree-sitter-lua = "0.5"
|
|
|
66
64
|
tree-sitter-make = "1.1"
|
|
67
65
|
tree-sitter-md = "0.5"
|
|
68
66
|
tree-sitter-nix = "0.3.0"
|
|
67
|
+
tree-sitter-ocaml = "0.26"
|
|
69
68
|
tree-sitter-php = "0.25"
|
|
70
69
|
tree-sitter-proto = "0.6.0"
|
|
71
70
|
tree-sitter-python = "0.25"
|
|
@@ -79,7 +78,6 @@ tree-sitter-toml-ng = "0.7"
|
|
|
79
78
|
tree-sitter-typescript = "0.23"
|
|
80
79
|
tree-sitter-xml = "0.7"
|
|
81
80
|
tree-sitter-yaml = "0.7"
|
|
82
|
-
# </block>
|
|
83
81
|
unidiff = "0.4.1"
|
|
84
82
|
winnow = "1.0"
|
|
85
83
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: blockwatch-cli
|
|
3
|
-
Version: 0.11.
|
|
3
|
+
Version: 0.11.3
|
|
4
4
|
Summary: Language agnostic linter that keeps your code and documentation in sync and valid
|
|
5
5
|
Keywords: linter,sync,drift,comments,agents
|
|
6
6
|
Home-Page: https://github.com/mennanov/blockwatch
|
|
@@ -10,7 +10,7 @@ Some parts of a codebase have to change together: a function and its docs, or a
|
|
|
10
10
|
blockwatch lets you write those rules in comments, right next to the code. If they fall out of sync, your pre-commit
|
|
11
11
|
hook or CI run fails.
|
|
12
12
|
|
|
13
|
-
Supports [
|
|
13
|
+
Supports [37 languages](#supported-languages) and their common file names, such as `Gemfile` or `.mjs`.
|
|
14
14
|
|
|
15
15
|
[//]: # (</block>)
|
|
16
16
|
|
|
@@ -96,16 +96,16 @@ have to nitpick in code review.
|
|
|
96
96
|
same-as="src/validators/mod.rs:validator-registry, docs/validators/README.md:validators-index"
|
|
97
97
|
same-as-pattern='^\|\s*\[`(?P<value>[a-z-]+)`\]'> -->
|
|
98
98
|
|
|
99
|
-
| Validator | Description | Attributes
|
|
100
|
-
|
|
101
|
-
| [`affects`](docs/validators/affects.md) | Forces linked blocks to be edited together (e.g. code and its docs); needs a diff | `affects`
|
|
102
|
-
| [`same-as`](docs/validators/same-as.md) | Asserts two or more blocks hold the same value, across languages and formats; no diff needed | `same-as`, `same-as-pattern`, `same-as-mode`, `same-as-format` |
|
|
103
|
-
| [`keep-sorted`](docs/validators/keep-sorted.md) | Enforces alphabetical or numerical ordering on list items | `keep-sorted`, `keep-sorted-pattern`, `keep-sorted-format`
|
|
104
|
-
| [`keep-unique`](docs/validators/keep-unique.md) | Prevents duplicate lines within a block | `keep-unique`
|
|
105
|
-
| [`line-pattern`](docs/validators/line-pattern.md) | Enforces that every line matches a regex, or that no line matches a forbidden one | `line-pattern`, `line-pattern-forbidden`
|
|
106
|
-
| [`line-count`](docs/validators/line-count.md) | Enforces lower or upper bounds on the number of lines in a block | `line-count`
|
|
107
|
-
| [`check-ai`](docs/validators/check-ai.md) | Validates content against natural language rules using an LLM | `check-ai`, `check-ai-pattern`
|
|
108
|
-
| [`check-lua`](docs/validators/check-lua.md) | Runs custom validation logic written in Lua | `check-lua`, `check-lua-pattern`, `check-lua-timeout`
|
|
99
|
+
| Validator | Description | Attributes |
|
|
100
|
+
|---------------------------------------------------|----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
|
|
101
|
+
| [`affects`](docs/validators/affects.md) | Forces linked blocks to be edited together (e.g. code and its docs); needs a diff | `affects` |
|
|
102
|
+
| [`same-as`](docs/validators/same-as.md) | Asserts two or more blocks hold the same value, across languages and formats; no diff needed | `same-as`, `same-as-paths`, `same-as-pattern`, `same-as-mode`, `same-as-format` |
|
|
103
|
+
| [`keep-sorted`](docs/validators/keep-sorted.md) | Enforces alphabetical or numerical ordering on list items | `keep-sorted`, `keep-sorted-pattern`, `keep-sorted-format` |
|
|
104
|
+
| [`keep-unique`](docs/validators/keep-unique.md) | Prevents duplicate lines within a block | `keep-unique` |
|
|
105
|
+
| [`line-pattern`](docs/validators/line-pattern.md) | Enforces that every line matches a regex, or that no line matches a forbidden one | `line-pattern`, `line-pattern-forbidden` |
|
|
106
|
+
| [`line-count`](docs/validators/line-count.md) | Enforces lower or upper bounds on the number of lines in a block | `line-count` |
|
|
107
|
+
| [`check-ai`](docs/validators/check-ai.md) | Validates content against natural language rules using an LLM | `check-ai`, `check-ai-pattern` |
|
|
108
|
+
| [`check-lua`](docs/validators/check-lua.md) | Runs custom validation logic written in Lua | `check-lua`, `check-lua-pattern`, `check-lua-timeout` |
|
|
109
109
|
|
|
110
110
|
<!-- </block> -->
|
|
111
111
|
|
|
@@ -210,12 +210,11 @@ exclusions, and custom extension mappings.
|
|
|
210
210
|
|
|
211
211
|
**pre-commit** (`.pre-commit-config.yaml`):
|
|
212
212
|
|
|
213
|
-
<!-- <block name="pre-commit-rev" same-as=
|
|
214
|
-
same-as-pattern='rev: v(?P<value>\d+\.\d+\.\d+)'> -->
|
|
213
|
+
<!-- <block name="pre-commit-rev" same-as-pattern='rev: v(?P<value>\d+\.\d+\.\d+)'> -->
|
|
215
214
|
|
|
216
215
|
```yaml
|
|
217
216
|
- repo: https://github.com/mennanov/blockwatch
|
|
218
|
-
rev: v0.11.
|
|
217
|
+
rev: v0.11.3 # Use latest release
|
|
219
218
|
hooks:
|
|
220
219
|
- id: blockwatch
|
|
221
220
|
```
|
|
@@ -240,7 +239,8 @@ For plain git hooks, local pre-commit setups, and sandboxing untrusted Lua scrip
|
|
|
240
239
|
|
|
241
240
|
## Supported Languages
|
|
242
241
|
|
|
243
|
-
<!-- <block name="supported-grammar" keep-sorted="asc" keep-sorted-pattern="^- (?P<value>.+)" affects=":pitch"
|
|
242
|
+
<!-- <block name="supported-grammar" keep-sorted="asc" keep-sorted-pattern="^- (?P<value>.+)" affects=":pitch"
|
|
243
|
+
check-lua="scripts/check_language_count.lua" check-lua-pattern="(?m)^- (?P<value>.+)"> -->
|
|
244
244
|
|
|
245
245
|
- Bash (with `.zsh`, `.bashrc`, `.bash_profile`, `.zshrc` and `.envrc` support)
|
|
246
246
|
- C#
|
|
@@ -259,10 +259,13 @@ For plain git hooks, local pre-commit setups, and sandboxing untrusted Lua scrip
|
|
|
259
259
|
- Java
|
|
260
260
|
- JavaScript (with `.mjs` and `.cjs` support)
|
|
261
261
|
- Kotlin
|
|
262
|
+
- Lean
|
|
262
263
|
- Lua (with `.rockspec` support)
|
|
264
|
+
- MDX
|
|
263
265
|
- Makefile (with `GNUmakefile` and `.mak` support)
|
|
264
266
|
- Markdown
|
|
265
267
|
- Nix
|
|
268
|
+
- OCaml (`.ml`, `.mli`)
|
|
266
269
|
- PHP
|
|
267
270
|
- Protocol Buffers (`.proto`)
|
|
268
271
|
- Python (with `.pyi` and `.pyw` support)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# The test fixtures break the rules on purpose.
|
|
2
|
+
ignore = ['tests/testdata/**']
|
|
3
|
+
|
|
4
|
+
# This block runs on a schedule in .github/workflows/trusted-checks.yml as it needs network access and ideally should
|
|
5
|
+
# be avoided in a precommit hook.
|
|
6
|
+
skip-blocks = ['src/validators/check_ai.rs:latest-model']
|
|
7
|
+
|
|
8
|
+
# A block listed in `skip-blocks` is checked only by the scheduled run, so that run must list it too.
|
|
9
|
+
[[block]]
|
|
10
|
+
target = 'blockwatch.toml#/skip-blocks'
|
|
11
|
+
same-as = '.github/workflows/trusted-checks.yml#/jobs/blockwatch/steps/0/with/only_blocks'
|
|
12
|
+
same-as-pattern = '(?P<value>[\w./-]+\.\w+:[\w-]+)'
|
|
13
|
+
|
|
14
|
+
# Users copy the version from the docs, and the pre-commit hooks install the PyPI package that setup.py pins. So each
|
|
15
|
+
# copy must be the version being released. `cargo release` rewrites them with the replacements in release.toml.
|
|
16
|
+
# The SARIF example also holds the version of the SARIF format, so the version only has to be one of its values.
|
|
17
|
+
[[block]]
|
|
18
|
+
target = 'Cargo.toml#/package/version'
|
|
19
|
+
same-as = '''README.md:pre-commit-rev,
|
|
20
|
+
docs/ci.md:pre-commit-rev,
|
|
21
|
+
docs/ci.md:commit-msg-rev,
|
|
22
|
+
docs/cli.md:sarif-example,
|
|
23
|
+
setup.py:blockwatch-cli-version'''
|
|
24
|
+
same-as-mode = 'subset'
|
|
25
|
+
|
|
26
|
+
# The pattern skips the lines that are not a dependency, such as a comment or the items of a `features` list.
|
|
27
|
+
[[block]]
|
|
28
|
+
target = 'Cargo.toml#/dependencies'
|
|
29
|
+
keep-sorted = true
|
|
30
|
+
keep-sorted-pattern = '^(?P<value>[\w-]+) = '
|
|
31
|
+
|
|
32
|
+
# Dependabot updates actions/checkout in the workflows, but not this pin, which dist copies into release.yml.
|
|
33
|
+
# The pattern reads both the pin, `v7`, and each `actions/checkout@v7` in the workflows.
|
|
34
|
+
[[block]]
|
|
35
|
+
target = 'dist-workspace.toml#/dist/github-action-commits/actions~1checkout'
|
|
36
|
+
same-as = '''.github/workflows/codeql.yml,
|
|
37
|
+
.github/workflows/markdownlint.yml,
|
|
38
|
+
.github/workflows/pypi.yml,
|
|
39
|
+
.github/workflows/rust.yml'''
|
|
40
|
+
same-as-pattern = '(?:actions/checkout@|^)(?P<value>v\d+)$'
|
|
@@ -15,12 +15,11 @@ It stays fast, because a file without a block tag is not parsed. To check only t
|
|
|
15
15
|
To use [pre-commit](https://pre-commit.com), add the hook to `.pre-commit-config.yaml`. pre-commit installs a prebuilt
|
|
16
16
|
`blockwatch` from PyPI, so you don't need Rust:
|
|
17
17
|
|
|
18
|
-
<!-- <block name="pre-commit-rev" same-as=
|
|
19
|
-
same-as-pattern='rev: v(?P<value>\d+\.\d+\.\d+)'> -->
|
|
18
|
+
<!-- <block name="pre-commit-rev" same-as-pattern='rev: v(?P<value>\d+\.\d+\.\d+)'> -->
|
|
20
19
|
|
|
21
20
|
```yaml
|
|
22
21
|
- repo: https://github.com/mennanov/blockwatch
|
|
23
|
-
rev: v0.11.
|
|
22
|
+
rev: v0.11.3 # Use latest release
|
|
24
23
|
hooks:
|
|
25
24
|
- id: blockwatch
|
|
26
25
|
```
|
|
@@ -56,12 +55,11 @@ The `blockwatch` hook runs before the commit message exists, so it cannot see a
|
|
|
56
55
|
`blockwatch-commit-msg` hook runs one stage later, at `commit-msg`, and hands the message Git is about to use to
|
|
57
56
|
[`--suppress-from`](cli.md#suppressing-from-a-file):
|
|
58
57
|
|
|
59
|
-
<!-- <block name="commit-msg-rev" same-as=
|
|
60
|
-
same-as-pattern='rev: v(?P<value>\d+\.\d+\.\d+)'> -->
|
|
58
|
+
<!-- <block name="commit-msg-rev" same-as-pattern='rev: v(?P<value>\d+\.\d+\.\d+)'> -->
|
|
61
59
|
|
|
62
60
|
```yaml
|
|
63
61
|
- repo: https://github.com/mennanov/blockwatch
|
|
64
|
-
rev: v0.11.
|
|
62
|
+
rev: v0.11.3 # Use latest release
|
|
65
63
|
hooks:
|
|
66
64
|
- id: blockwatch-commit-msg
|
|
67
65
|
```
|
|
@@ -140,7 +140,7 @@ much — see [Checking Only Changed Blocks](ci.md#checking-only-changed-blocks).
|
|
|
140
140
|
|
|
141
141
|
### Supported Diff Input
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
<!-- <block name="diff-input" same-as-pattern="`(?P<value>[a-z]/)`"> -->
|
|
144
144
|
|
|
145
145
|
Each diff header points at a file, and `blockwatch` resolves that path against the repository:
|
|
146
146
|
|
|
@@ -165,7 +165,7 @@ A diff with a file that does not exist in the repository is an error too — but
|
|
|
165
165
|
Entries whose extension maps to no language, such as binary assets or lockfiles, contribute no blocks and are passed
|
|
166
166
|
over, so a diff carrying them alongside source changes still validates normally.
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
<!-- </block> -->
|
|
169
169
|
|
|
170
170
|
In each case `blockwatch` stops rather than check the wrong file, reporting the diff target at fault. The messages
|
|
171
171
|
describe the input rather than the command that produced it, since a diff need not come from Git:
|
|
@@ -275,6 +275,8 @@ Write globs in single quotes. TOML then takes them as written, backslashes inclu
|
|
|
275
275
|
|
|
276
276
|
Each key matches a flag:
|
|
277
277
|
|
|
278
|
+
<!-- <block name="config-keys" same-as-pattern="^\|\s*`(?P<value>[a-z-]+)`"> -->
|
|
279
|
+
|
|
278
280
|
| Key | Flag | When the flag is given too |
|
|
279
281
|
|---------------|----------------|---------------------------------------------------|
|
|
280
282
|
| `ignore` | `--ignore` | Both lists apply. |
|
|
@@ -284,6 +286,8 @@ Each key matches a flag:
|
|
|
284
286
|
| `only-blocks` | `--only-block` | The flags' selection replaces the config's. |
|
|
285
287
|
| `skip-blocks` | `--skip-block` | The flags' selection replaces the config's. |
|
|
286
288
|
|
|
289
|
+
<!-- </block> -->
|
|
290
|
+
|
|
287
291
|
So `blockwatch -e keep-sorted` runs only `keep-sorted`, whatever the config enables or disables. An extra `--ignore`
|
|
288
292
|
still skips the files the config skips.
|
|
289
293
|
|
|
@@ -293,6 +297,8 @@ unsupported language, a block address that is not `FILE:BLOCK_NAME`, or both `en
|
|
|
293
297
|
cannot turn a setting off without anyone noticing. The error quotes the bad key or value. For an unknown key or a value
|
|
294
298
|
of the wrong type, it also shows the line and column:
|
|
295
299
|
|
|
300
|
+
<!-- <block name="config-key-error" same-as-pattern="`(?P<value>[a-z-]+)`"> -->
|
|
301
|
+
|
|
296
302
|
```text
|
|
297
303
|
Error: invalid config file "blockwatch.toml"
|
|
298
304
|
|
|
@@ -301,9 +307,11 @@ Caused by:
|
|
|
301
307
|
|
|
|
302
308
|
1 | ignor = ['x']
|
|
303
309
|
| ^^^^^
|
|
304
|
-
unknown field `ignor`, expected one of `ignore`, `extensions`, `enable`, `disable`, `block`
|
|
310
|
+
unknown field `ignor`, expected one of `ignore`, `extensions`, `enable`, `disable`, `only-blocks`, `skip-blocks`, `block`
|
|
305
311
|
```
|
|
306
312
|
|
|
313
|
+
<!-- </block> -->
|
|
314
|
+
|
|
307
315
|
Everything else stays out of the file:
|
|
308
316
|
|
|
309
317
|
- **The paths and globs, `--diff`, `--only-changed`, `--suppress` and `--suppress-from`** describe one run, not the
|
|
@@ -546,15 +554,15 @@ Nothing else about the run changes: the same violations are found, and the exit
|
|
|
546
554
|
"tool": {
|
|
547
555
|
"driver": {
|
|
548
556
|
"name": "blockwatch",
|
|
549
|
-
"version": "0.11.
|
|
550
|
-
"semanticVersion": "0.11.
|
|
557
|
+
"version": "0.11.3",
|
|
558
|
+
"semanticVersion": "0.11.3",
|
|
551
559
|
"informationUri": "https://github.com/mennanov/blockwatch",
|
|
552
560
|
"rules": [
|
|
553
561
|
{
|
|
554
562
|
"id": "keep-sorted",
|
|
555
563
|
"name": "keep-sorted",
|
|
556
564
|
"shortDescription": { "text": "Requires the lines of a block to stay in order." },
|
|
557
|
-
"helpUri": "https://github.com/mennanov/blockwatch/blob/v0.11.
|
|
565
|
+
"helpUri": "https://github.com/mennanov/blockwatch/blob/v0.11.3/docs/validators/keep-sorted.md"
|
|
558
566
|
}
|
|
559
567
|
]
|
|
560
568
|
}
|
|
@@ -72,7 +72,7 @@ along with the rest of their file.
|
|
|
72
72
|
Controls how a violation is reported. Mirrors
|
|
73
73
|
[LSP diagnostic severities](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnostic).
|
|
74
74
|
|
|
75
|
-
<!-- <block name="severity-levels"
|
|
75
|
+
<!-- <block name="severity-levels" same-as-pattern="^\|\s*`(?P<value>[a-z]+)`"> -->
|
|
76
76
|
|
|
77
77
|
| Value | Reported | Exit code |
|
|
78
78
|
|-------------------|----------|-----------|
|
|
@@ -36,9 +36,9 @@ exactly = 1
|
|
|
36
36
|
|
|
37
37
|
# The version is spelled out in the docs as well: the `rev:` of the pre-commit
|
|
38
38
|
# snippets, and the `blockwatch` version and `helpUri` of the SARIF sample
|
|
39
|
-
# output. The `
|
|
40
|
-
# a run once any of them goes stale,
|
|
41
|
-
# check green. `exactly` aborts the release before publishing to crates.io if a
|
|
39
|
+
# output. The `[[block]]` entry for `Cargo.toml#/package/version` in
|
|
40
|
+
# blockwatch.toml lists them all and fails a run once any of them goes stale,
|
|
41
|
+
# so they are rewritten here to keep that check green. `exactly` aborts the release before publishing to crates.io if a
|
|
42
42
|
# snippet is ever reworded past these patterns.
|
|
43
43
|
[[pre-release-replacements]]
|
|
44
44
|
file = "README.md"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
-- Checks that the number of languages the README's pitch claims is the number of items in its list of supported
|
|
2
|
+
-- languages. The list's block points at the pitch with `affects`, so the pitch arrives in `ctx.affects`, and the script
|
|
3
|
+
-- needs no file access. `check-lua-pattern` passes one value for each item, so an item that wraps over two lines
|
|
4
|
+
-- counts once.
|
|
5
|
+
|
|
6
|
+
function validate(ctx, content)
|
|
7
|
+
local pitch = ctx.affects and ctx.affects[1]
|
|
8
|
+
if not pitch then
|
|
9
|
+
return "the block must point at the pitch with affects"
|
|
10
|
+
end
|
|
11
|
+
local claimed = pitch.content:match("(%d+) languages")
|
|
12
|
+
if not claimed then
|
|
13
|
+
return "the pitch does not say how many languages are supported"
|
|
14
|
+
end
|
|
15
|
+
if tonumber(claimed) ~= #content then
|
|
16
|
+
return string.format("the pitch claims %s languages, but the list has %d", claimed, #content)
|
|
17
|
+
end
|
|
18
|
+
return nil
|
|
19
|
+
end
|
|
@@ -5,8 +5,8 @@ from setuptools import setup
|
|
|
5
5
|
setup(
|
|
6
6
|
name='blockwatch-pre-commit-placeholder',
|
|
7
7
|
version='0.0.0',
|
|
8
|
-
# <block
|
|
9
|
-
install_requires=['blockwatch-cli==0.11.
|
|
8
|
+
# <block name="blockwatch-cli-version" same-as-pattern="blockwatch-cli==(?P<value>\d+\.\d+\.\d+)">
|
|
9
|
+
install_requires=['blockwatch-cli==0.11.3'],
|
|
10
10
|
# </block>
|
|
11
11
|
# Without it, setuptools takes the directories under src/ for Python packages.
|
|
12
12
|
packages=[],
|
|
@@ -32,7 +32,7 @@ impl<C: CommentsParser> BlocksFromCommentsParser<C> {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/// Assembles [`Block`]s out of a comment stream.
|
|
35
|
-
struct BlocksIterator<'source, I: Iterator<Item = Comment>> {
|
|
35
|
+
pub(crate) struct BlocksIterator<'source, I: Iterator<Item = Comment>> {
|
|
36
36
|
partial_blocks: PartialBlocksIterator<'source, I>,
|
|
37
37
|
/// Start tags still waiting for their end tag, outermost first.
|
|
38
38
|
open_blocks: Vec<BlockStart>,
|
|
@@ -46,7 +46,7 @@ struct BlocksIterator<'source, I: Iterator<Item = Comment>> {
|
|
|
46
46
|
|
|
47
47
|
impl<'source, I: Iterator<Item = Comment>> BlocksIterator<'source, I> {
|
|
48
48
|
/// Starts the block stream over the comments of `contents`, which must be in source order.
|
|
49
|
-
fn new(comments: I, contents: &'source str) -> Self {
|
|
49
|
+
pub(crate) fn new(comments: I, contents: &'source str) -> Self {
|
|
50
50
|
Self {
|
|
51
51
|
partial_blocks: PartialBlocksIterator::new(comments, contents),
|
|
52
52
|
open_blocks: Vec::new(),
|
|
@@ -294,7 +294,8 @@ impl Block {
|
|
|
294
294
|
#[derive(Clone, Copy, Serialize_repr, EnumString, Debug, PartialEq)]
|
|
295
295
|
#[strum(ascii_case_insensitive)]
|
|
296
296
|
#[repr(u8)]
|
|
297
|
-
|
|
297
|
+
/* <block name="block-severity" same-as="docs/validators/README.md:severity-levels"
|
|
298
|
+
same-as-format="identifier" same-as-pattern="^(?P<value>[A-Z][a-z]+) = \d"> */
|
|
298
299
|
pub(crate) enum BlockSeverity {
|
|
299
300
|
/// The default. A violation at this level makes the run exit non-zero, failing a hook or CI.
|
|
300
301
|
Error = 1,
|
|
@@ -898,7 +899,8 @@ fn virtual_blocks_in_file(
|
|
|
898
899
|
}
|
|
899
900
|
|
|
900
901
|
const RECOGNIZED_ATTRIBUTES: &[&str] = &[
|
|
901
|
-
|
|
902
|
+
/* <block keep-sorted same-as="src/skill.md:validator-reference"
|
|
903
|
+
same-as-pattern='"(?P<value>[a-z-]+)"'> */
|
|
902
904
|
"affects",
|
|
903
905
|
"check-ai",
|
|
904
906
|
"check-ai-pattern",
|
|
@@ -909,7 +911,6 @@ const RECOGNIZED_ATTRIBUTES: &[&str] = &[
|
|
|
909
911
|
"keep-sorted-format",
|
|
910
912
|
"keep-sorted-pattern",
|
|
911
913
|
"keep-unique",
|
|
912
|
-
"keep-unique-pattern",
|
|
913
914
|
"line-count",
|
|
914
915
|
"line-pattern",
|
|
915
916
|
"line-pattern-forbidden",
|
|
@@ -2815,7 +2816,7 @@ mod supported_languages_tests {
|
|
|
2815
2816
|
"/* <block> */\nint main() { return 0; }\n/* </block> */".to_string(),
|
|
2816
2817
|
),
|
|
2817
2818
|
(
|
|
2818
|
-
"cc.
|
|
2819
|
+
"cc.cc".to_string(),
|
|
2819
2820
|
"// <block>\nint main() { return 0; }\n// </block>".to_string(),
|
|
2820
2821
|
),
|
|
2821
2822
|
(
|
|
@@ -2982,6 +2983,10 @@ mod supported_languages_tests {
|
|
|
2982
2983
|
"kts.kts".to_string(),
|
|
2983
2984
|
"// <block>\nplugins { }\n// </block>".to_string(),
|
|
2984
2985
|
),
|
|
2986
|
+
(
|
|
2987
|
+
"lean.lean".to_string(),
|
|
2988
|
+
"-- <block>\ndef x := 1\n-- </block>".to_string(),
|
|
2989
|
+
),
|
|
2985
2990
|
(
|
|
2986
2991
|
"lua.lua".to_string(),
|
|
2987
2992
|
"-- <block>\nlocal x = 1\n-- </block>".to_string(),
|
|
@@ -3006,6 +3011,10 @@ mod supported_languages_tests {
|
|
|
3006
3011
|
"md.md".to_string(),
|
|
3007
3012
|
"<div>\n<!-- <block> -->\n## Heading\n<!-- </block> -->\n</div>".to_string(),
|
|
3008
3013
|
),
|
|
3014
|
+
(
|
|
3015
|
+
"mdx.mdx".to_string(),
|
|
3016
|
+
"{/* <block> */}\n## Heading\n{/* </block> */}".to_string(),
|
|
3017
|
+
),
|
|
3009
3018
|
(
|
|
3010
3019
|
"mk.mk".to_string(),
|
|
3011
3020
|
"# <block>\nall:\n\t@echo \"hello\"\n# </block>".to_string(),
|
|
@@ -3022,6 +3031,14 @@ mod supported_languages_tests {
|
|
|
3022
3031
|
"nix.nix".to_string(),
|
|
3023
3032
|
"# <block>\n{ pkgs = null; }\n# </block>".to_string(),
|
|
3024
3033
|
),
|
|
3034
|
+
(
|
|
3035
|
+
"ml.ml".to_string(),
|
|
3036
|
+
"(* <block> *)\nlet x = 1\n(* </block> *)".to_string(),
|
|
3037
|
+
),
|
|
3038
|
+
(
|
|
3039
|
+
"mli.mli".to_string(),
|
|
3040
|
+
"(* <block> *)\nval x : int\n(* </block> *)".to_string(),
|
|
3041
|
+
),
|
|
3025
3042
|
(
|
|
3026
3043
|
"php.php".to_string(),
|
|
3027
3044
|
"<?php\n# <block>\necho 'hello';\n# </block>\n?>".to_string(),
|
|
@@ -376,7 +376,8 @@ fn write_sarif_violations(violations: &HashMap<RepoPath, Vec<Violation>>) -> any
|
|
|
376
376
|
fn repository_root_path(current_path: PathBuf) -> anyhow::Result<PathBuf> {
|
|
377
377
|
current_path
|
|
378
378
|
.ancestors()
|
|
379
|
-
|
|
379
|
+
/* <block same-as="src/fs.rs:vcs-metadata-directories" same-as-mode="subset"
|
|
380
|
+
same-as-pattern='"(?P<value>\.[a-z]+)"'> */
|
|
380
381
|
.find(|path| path.join(".git").exists() || path.join(".hg").exists())
|
|
381
382
|
// </block>
|
|
382
383
|
.map(|path| path.to_path_buf())
|
|
@@ -37,6 +37,10 @@ pub(crate) struct Config {
|
|
|
37
37
|
#[derive(Deserialize)]
|
|
38
38
|
#[serde(deny_unknown_fields)]
|
|
39
39
|
struct ConfigFile {
|
|
40
|
+
// The error example in the docs also shows `block` and a misspelled key, so the docs only have
|
|
41
|
+
// to hold each of these keys.
|
|
42
|
+
/* <block name="config-keys" same-as="docs/cli.md:config-keys, docs/cli.md:config-key-error"
|
|
43
|
+
same-as-mode="subset" same-as-format="identifier" same-as-pattern="^(?P<value>[a-z_]+):"> */
|
|
40
44
|
#[serde(default)]
|
|
41
45
|
ignore: Vec<String>,
|
|
42
46
|
#[serde(default)]
|
|
@@ -49,6 +53,7 @@ struct ConfigFile {
|
|
|
49
53
|
only_blocks: Vec<String>,
|
|
50
54
|
#[serde(default, rename = "skip-blocks")]
|
|
51
55
|
skip_blocks: Vec<String>,
|
|
56
|
+
// </block>
|
|
52
57
|
/// The `[[block]]` entries, each with the byte range of its header.
|
|
53
58
|
#[serde(default)]
|
|
54
59
|
block: Vec<Spanned<BlockEntry>>,
|
|
@@ -7,7 +7,7 @@ use std::path::{Path, PathBuf};
|
|
|
7
7
|
/// Directory names a version control system keeps its own state in.
|
|
8
8
|
///
|
|
9
9
|
/// A superset of the markers that identify a repository root.
|
|
10
|
-
// <block name="vcs-metadata-directories">
|
|
10
|
+
// <block name="vcs-metadata-directories" same-as-pattern='"(?P<value>\.[a-z]+)"'>
|
|
11
11
|
const VCS_METADATA_DIRECTORY_NAMES: [&str; 4] = [".git", ".hg", ".jj", ".svn"];
|
|
12
12
|
// </block>
|
|
13
13
|
|
|
@@ -100,4 +100,50 @@ let between = 2;
|
|
|
100
100
|
|
|
101
101
|
Ok(())
|
|
102
102
|
}
|
|
103
|
+
|
|
104
|
+
#[test]
|
|
105
|
+
fn jsx_expression_holding_only_a_comment_covers_its_braces() -> anyhow::Result<()> {
|
|
106
|
+
let mut comments_parser = comments_parser()?;
|
|
107
|
+
|
|
108
|
+
let comments: Vec<Comment> = comments_parser
|
|
109
|
+
.parse(
|
|
110
|
+
r#"const list = (
|
|
111
|
+
<ul>
|
|
112
|
+
{/* lone */}
|
|
113
|
+
{/* with code */ items}
|
|
114
|
+
{ /* first */ /* second */ }
|
|
115
|
+
</ul>
|
|
116
|
+
);
|
|
117
|
+
"#,
|
|
118
|
+
)
|
|
119
|
+
.collect();
|
|
120
|
+
|
|
121
|
+
assert_eq!(
|
|
122
|
+
comments,
|
|
123
|
+
vec![
|
|
124
|
+
Comment {
|
|
125
|
+
position_range: Position::new(3, 5)..Position::new(3, 17),
|
|
126
|
+
source_range: 26..38,
|
|
127
|
+
comment_text: " lone ".to_string()
|
|
128
|
+
},
|
|
129
|
+
Comment {
|
|
130
|
+
position_range: Position::new(4, 6)..Position::new(4, 21),
|
|
131
|
+
source_range: 44..59,
|
|
132
|
+
comment_text: " with code ".to_string()
|
|
133
|
+
},
|
|
134
|
+
Comment {
|
|
135
|
+
position_range: Position::new(5, 7)..Position::new(5, 18),
|
|
136
|
+
source_range: 73..84,
|
|
137
|
+
comment_text: " first ".to_string()
|
|
138
|
+
},
|
|
139
|
+
Comment {
|
|
140
|
+
position_range: Position::new(5, 19)..Position::new(5, 31),
|
|
141
|
+
source_range: 85..97,
|
|
142
|
+
comment_text: " second ".to_string()
|
|
143
|
+
},
|
|
144
|
+
]
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
Ok(())
|
|
148
|
+
}
|
|
103
149
|
}
|