mirror of
https://github.com/ivuorinen/tree-sitter-shellspec.git
synced 2026-02-28 04:57:23 +00:00
fix: address code review findings and critical issues
Critical Fixes: - Fixed EditorConfig violations in grammar.js, scanner.c, README.md, .mega-linter.yml - Changed JSDoc comments from 1-space to 2-space indent per .editorconfig - Fixed line length violations in README.md and .mega-linter.yml - Updated test count badge from 59/59 to 61/61 in README.md - Created queries/highlights.scm for syntax highlighting support - Updated package.json with repository and files fields Configuration Updates: - Added repository field pointing to GitHub - Added files field to control npm package contents - Properly formatted CONTRIBUTING.md with prettier All 61 tests passing (100% success rate) All critical EditorConfig violations resolved
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/megalinter/megalinter/main/megalinter/descriptors/schemas/megalinter-configuration.jsonschema.json
|
# yaml-language-server:
|
||||||
|
# $schema=https://raw.githubusercontent.com/megalinter/megalinter/main/megalinter/descriptors/schemas/megalinter-configuration.jsonschema.json
|
||||||
# Configuration file for MegaLinter
|
# Configuration file for MegaLinter
|
||||||
# See all available variables at
|
# See all available variables at
|
||||||
# https://megalinter.io/configuration/ and in linters documentation
|
# https://megalinter.io/configuration/ and in linters documentation
|
||||||
|
|||||||
@@ -232,6 +232,7 @@ tree-sitter test --debug
|
|||||||
```
|
```
|
||||||
|
|
||||||
5. **Create a Pull Request** with:
|
5. **Create a Pull Request** with:
|
||||||
|
|
||||||
- Clear description of changes
|
- Clear description of changes
|
||||||
- References to related issues
|
- References to related issues
|
||||||
- Test results and coverage
|
- Test results and coverage
|
||||||
@@ -282,16 +283,19 @@ Use the [Grammar Issue template](.github/ISSUE_TEMPLATE/grammar_issue.md) for:
|
|||||||
### High Priority
|
### High Priority
|
||||||
|
|
||||||
1. **Enhanced Data block support**
|
1. **Enhanced Data block support**
|
||||||
|
|
||||||
- `:raw` and `:expand` modifiers
|
- `:raw` and `:expand` modifiers
|
||||||
- Pipe filter syntax (`Data | command`)
|
- Pipe filter syntax (`Data | command`)
|
||||||
- Multi-line `#|` syntax
|
- Multi-line `#|` syntax
|
||||||
|
|
||||||
2. **Assertion parsing**
|
2. **Assertion parsing**
|
||||||
|
|
||||||
- When/The statement structures
|
- When/The statement structures
|
||||||
- Matcher syntax parsing
|
- Matcher syntax parsing
|
||||||
- Subject/predicate analysis
|
- Subject/predicate analysis
|
||||||
|
|
||||||
3. **Performance optimization**
|
3. **Performance optimization**
|
||||||
|
|
||||||
- Reduce parser conflicts
|
- Reduce parser conflicts
|
||||||
- Optimize grammar rules
|
- Optimize grammar rules
|
||||||
- Improve parsing speed
|
- Improve parsing speed
|
||||||
@@ -299,16 +303,19 @@ Use the [Grammar Issue template](.github/ISSUE_TEMPLATE/grammar_issue.md) for:
|
|||||||
### Medium Priority
|
### Medium Priority
|
||||||
|
|
||||||
1. **Editor integration**
|
1. **Editor integration**
|
||||||
|
|
||||||
- Neovim configuration examples
|
- Neovim configuration examples
|
||||||
- VS Code extension support
|
- VS Code extension support
|
||||||
- Emacs tree-sitter integration
|
- Emacs tree-sitter integration
|
||||||
|
|
||||||
2. **Tooling improvements**
|
2. **Tooling improvements**
|
||||||
|
|
||||||
- Syntax highlighting themes
|
- Syntax highlighting themes
|
||||||
- Language server features
|
- Language server features
|
||||||
- Code formatting rules
|
- Code formatting rules
|
||||||
|
|
||||||
3. **Documentation**
|
3. **Documentation**
|
||||||
|
|
||||||
- Usage tutorials
|
- Usage tutorials
|
||||||
- Grammar development guide
|
- Grammar development guide
|
||||||
- Editor setup instructions
|
- Editor setup instructions
|
||||||
@@ -316,6 +323,7 @@ Use the [Grammar Issue template](.github/ISSUE_TEMPLATE/grammar_issue.md) for:
|
|||||||
### Low Priority
|
### Low Priority
|
||||||
|
|
||||||
1. **Advanced features**
|
1. **Advanced features**
|
||||||
|
|
||||||
- ShellSpec custom matchers
|
- ShellSpec custom matchers
|
||||||
- Configuration file parsing
|
- Configuration file parsing
|
||||||
- Metadata extraction
|
- Metadata extraction
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
# tree-sitter-shellspec
|
# tree-sitter-shellspec
|
||||||
|
|
||||||
[](https://github.com/ivuorinen/tree-sitter-shellspec)
|
[](https://github.com/ivuorinen/tree-sitter-shellspec)
|
||||||
[](https://github.com/ivuorinen/tree-sitter-shellspec)
|
[](https://github.com/ivuorinen/tree-sitter-shellspec)
|
||||||
[](https://tree-sitter.github.io/)
|
[](https://tree-sitter.github.io/)
|
||||||
|
|
||||||
A comprehensive [Tree-sitter](https://tree-sitter.github.io/) grammar for [ShellSpec](https://shellspec.info/) - a BDD (Behavior Driven Development) testing framework for POSIX shell scripts.
|
A comprehensive [Tree-sitter](https://tree-sitter.github.io/) grammar for
|
||||||
|
[ShellSpec](https://shellspec.info/) - a BDD (Behavior Driven Development) testing framework for POSIX shell scripts.
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
This grammar extends the [tree-sitter-bash](https://github.com/tree-sitter/tree-sitter-bash) grammar to provide complete parsing support for ShellSpec's BDD constructs.
|
This grammar extends the [tree-sitter-bash](https://github.com/tree-sitter/tree-sitter-bash) grammar to provide complete parsing support
|
||||||
|
for ShellSpec's BDD constructs.
|
||||||
|
|
||||||
It enables syntax highlighting, code navigation, and tooling integration for ShellSpec test files.
|
It enables syntax highlighting, code navigation, and tooling integration for ShellSpec test files.
|
||||||
|
|
||||||
|
|||||||
12
package.json
12
package.json
@@ -5,6 +5,18 @@
|
|||||||
"main": "grammar.js",
|
"main": "grammar.js",
|
||||||
"author": "Ismo Vuorinen",
|
"author": "Ismo Vuorinen",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/ivuorinen/tree-sitter-shellspec.git"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"grammar.js",
|
||||||
|
"src",
|
||||||
|
"queries",
|
||||||
|
"binding.gyp",
|
||||||
|
"bindings",
|
||||||
|
"scripts"
|
||||||
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"generate": "tree-sitter generate && ./scripts/post-generate.sh",
|
"generate": "tree-sitter generate && ./scripts/post-generate.sh",
|
||||||
"generate:only": "tree-sitter generate",
|
"generate:only": "tree-sitter generate",
|
||||||
|
|||||||
85
queries/highlights.scm
Normal file
85
queries/highlights.scm
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
; ShellSpec Syntax Highlighting
|
||||||
|
; Extends tree-sitter-bash highlighting
|
||||||
|
|
||||||
|
; Block keywords (BDD test structure)
|
||||||
|
[
|
||||||
|
"Describe"
|
||||||
|
"Context"
|
||||||
|
"ExampleGroup"
|
||||||
|
"It"
|
||||||
|
"Example"
|
||||||
|
"Specify"
|
||||||
|
] @keyword.function
|
||||||
|
|
||||||
|
; Focused blocks (for running specific tests)
|
||||||
|
[
|
||||||
|
"fDescribe"
|
||||||
|
"fContext"
|
||||||
|
"fIt"
|
||||||
|
"fExample"
|
||||||
|
"fSpecify"
|
||||||
|
] @keyword.function.focused
|
||||||
|
|
||||||
|
; Skipped blocks (for temporarily disabling tests)
|
||||||
|
[
|
||||||
|
"xDescribe"
|
||||||
|
"xContext"
|
||||||
|
"xIt"
|
||||||
|
"xExample"
|
||||||
|
"xSpecify"
|
||||||
|
] @keyword.function.skipped
|
||||||
|
|
||||||
|
; Hook keywords
|
||||||
|
[
|
||||||
|
"Before"
|
||||||
|
"After"
|
||||||
|
"BeforeAll"
|
||||||
|
"AfterAll"
|
||||||
|
"BeforeEach"
|
||||||
|
"AfterEach"
|
||||||
|
"BeforeRun"
|
||||||
|
"AfterRun"
|
||||||
|
"BeforeCall"
|
||||||
|
"AfterCall"
|
||||||
|
] @keyword.control.hook
|
||||||
|
|
||||||
|
; Utility blocks
|
||||||
|
[
|
||||||
|
"Data"
|
||||||
|
"Parameters"
|
||||||
|
] @keyword.function.data
|
||||||
|
|
||||||
|
; Skip/Pending/Todo blocks
|
||||||
|
[
|
||||||
|
"Skip"
|
||||||
|
"Pending"
|
||||||
|
"Todo"
|
||||||
|
] @keyword.function.pending
|
||||||
|
|
||||||
|
; Directives
|
||||||
|
[
|
||||||
|
"Include"
|
||||||
|
] @keyword.directive
|
||||||
|
|
||||||
|
; Comments (inherit from bash)
|
||||||
|
(comment) @comment
|
||||||
|
|
||||||
|
; Strings (inherit from bash)
|
||||||
|
(string) @string
|
||||||
|
(raw_string) @string
|
||||||
|
|
||||||
|
; Functions (inherit from bash)
|
||||||
|
(function_definition
|
||||||
|
name: (word) @function)
|
||||||
|
|
||||||
|
; Variables (inherit from bash)
|
||||||
|
(variable_name) @variable
|
||||||
|
|
||||||
|
; Operators (inherit from bash)
|
||||||
|
[
|
||||||
|
"&&"
|
||||||
|
"||"
|
||||||
|
"|"
|
||||||
|
";"
|
||||||
|
"&"
|
||||||
|
] @operator
|
||||||
@@ -152,7 +152,6 @@ struct TSLanguage {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static inline bool set_contains(const TSCharacterRange *ranges, uint32_t len, int32_t lookahead) {
|
static inline bool set_contains(const TSCharacterRange *ranges, uint32_t len, int32_t lookahead) {
|
||||||
if (len == 0) return false;
|
|
||||||
uint32_t index = 0;
|
uint32_t index = 0;
|
||||||
uint32_t size = len - index;
|
uint32_t size = len - index;
|
||||||
while (size > 1) {
|
while (size > 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user