fix: apply CodeRabbit nitpick suggestions and improve code quality

- Fix grammar.js TypeScript errors by correcting optional field usage
- Update .yamlignore to use more robust glob pattern (**/node_modules/**)
- Remove hard-coded test count from README.md for maintainability
- Fix shellcheck directive format (add space after #) in all test specs
- Fix typos throughout test specifications:
  - 'can not' → 'cannot'
  - 'expantion' → 'expansion'
  - 'singnal' → 'signal'
  - 'It mean' → 'It means'
- Update CODE_OF_CONDUCT.md HTTP links to HTTPS
- Update tree-sitter parse command to use --scope instead of --language
- Add comments to .mega-linter.yml explaining disabled linters

All grammar tests still pass (61/61) and the parser functions correctly
with the updated tree-sitter CLI v0.25.0.
This commit is contained in:
2025-09-13 03:54:32 +03:00
parent d65c6e6ec4
commit 193f8871b6
32 changed files with 363 additions and 363 deletions

View File

@@ -142,4 +142,4 @@ the [Geek Feminism Anti-Harassment Policy][geek-feminism].
[stumptown]: https://github.com/stumpsyn [stumptown]: https://github.com/stumpsyn
[cc-by-sa]: https://creativecommons.org/licenses/by-sa/3.0/ [cc-by-sa]: https://creativecommons.org/licenses/by-sa/3.0/
[django]: https://www.djangoproject.com/conduct/ [django]: https://www.djangoproject.com/conduct/
[geek-feminism]: http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy [geek-feminism]: https://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy

View File

@@ -124,7 +124,7 @@ jobs:
End End
EOF EOF
npx tree-sitter parse --language=shellspec test_sample.shellspec --quiet || { npx tree-sitter parse --scope=source.shellspec test_sample.shellspec --quiet || {
echo "❌ Parser failed on sample ShellSpec code" echo "❌ Parser failed on sample ShellSpec code"
exit 1 exit 1
} }

View File

@@ -18,8 +18,8 @@ SHOW_SKIPPED_LINTERS: false # Show skipped linters in MegaLinter log
DISABLE_LINTERS: DISABLE_LINTERS:
- REPOSITORY_DEVSKIM - REPOSITORY_DEVSKIM
- JSON_PRETTIER - JSON_PRETTIER # Disabled for causing probelms
- SPELL_LYCHEE - SPELL_LYCHEE # Disabled due to too many false positives
YAML_YAMLLINT_CONFIG_FILE: .yamllint.yml YAML_YAMLLINT_CONFIG_FILE: .yamllint.yml
MARKDOWN_MARKDOWNLINT_CONFIG_FILE: .markdownlint.json MARKDOWN_MARKDOWNLINT_CONFIG_FILE: .markdownlint.json

View File

@@ -1 +1 @@
node_modules/** **/node_modules/**

View File

@@ -263,7 +263,7 @@ npm run rebuild # Clean + generate + build
The grammar includes comprehensive test coverage: The grammar includes comprehensive test coverage:
- **59 test cases** covering all ShellSpec constructs - **Comprehensive test cases** covering all ShellSpec constructs
- **Real-world patterns** from official ShellSpec repository - **Real-world patterns** from official ShellSpec repository
- **Edge cases** and complex nesting scenarios - **Edge cases** and complex nesting scenarios
- **Mixed content** (ShellSpec + bash code) - **Mixed content** (ShellSpec + bash code)

View File

@@ -103,7 +103,7 @@ module.exports = grammar(bashGrammar, {
"BeforeRun", "BeforeRun",
"AfterRun", "AfterRun",
), ),
field("label", optional(choice($.string, $.raw_string, $.word))), optional(field("label", choice($.string, $.raw_string, $.word))),
repeat($._terminated_statement), repeat($._terminated_statement),
"End", "End",
), ),
@@ -115,7 +115,7 @@ module.exports = grammar(bashGrammar, {
1, 1,
seq( seq(
choice("Parameters", "Skip", "Pending", "Todo"), choice("Parameters", "Skip", "Pending", "Todo"),
field("label", optional(choice($.string, $.raw_string, $.word))), optional(field("label", choice($.string, $.raw_string, $.word))),
repeat($._terminated_statement), repeat($._terminated_statement),
"End", "End",
), ),

View File

@@ -7236,12 +7236,12 @@
] ]
}, },
{ {
"type": "FIELD",
"name": "label",
"content": {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
"type": "FIELD",
"name": "label",
"content": {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
@@ -7257,12 +7257,12 @@
"name": "word" "name": "word"
} }
] ]
}
}, },
{ {
"type": "BLANK" "type": "BLANK"
} }
] ]
}
}, },
{ {
"type": "REPEAT", "type": "REPEAT",
@@ -7306,12 +7306,12 @@
] ]
}, },
{ {
"type": "FIELD",
"name": "label",
"content": {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
"type": "FIELD",
"name": "label",
"content": {
"type": "CHOICE", "type": "CHOICE",
"members": [ "members": [
{ {
@@ -7327,12 +7327,12 @@
"name": "word" "name": "word"
} }
] ]
}
}, },
{ {
"type": "BLANK" "type": "BLANK"
} }
] ]
}
}, },
{ {
"type": "REPEAT", "type": "REPEAT",

View File

@@ -1,7 +1,7 @@
# shellcheck shell=sh # shellcheck shell=sh
# Each block (example group / example) runs within subshell. # Each block (example group / example) runs within subshell.
# It mean that it works like lexical scope. # It means that it works like lexical scope.
Describe 'scope example' Describe 'scope example'
foo() { echo "foo"; } # It can call from anywhere within this example group foo() { echo "foo"; } # It can call from anywhere within this example group

View File

@@ -35,8 +35,8 @@ Describe 'skip example'
End End
End End
Describe 'status_to_singnal()' Describe 'status_to_signal()'
status_to_singnal() { status_to_signal() {
if [ 128 -le "$1" ] && [ "$1" -le 192 ]; then if [ 128 -le "$1" ] && [ "$1" -le 192 ]; then
echo "$(($1 - 128))" echo "$(($1 - 128))"
else else
@@ -45,8 +45,8 @@ Describe 'skip example'
fi fi
} }
It 'can not convert status to singnal' It 'cannot convert status to signal'
When call status_to_singnal 0 When call status_to_signal 0
The status should be failure The status should be failure
# Skip expection of after this line in current example # Skip expection of after this line in current example
@@ -55,8 +55,8 @@ Describe 'skip example'
End End
# This example is going to execute # This example is going to execute
It 'converts status to singnal' It 'converts status to signal'
When call status_to_singnal 137 When call status_to_signal 137
The output should eq 9 The output should eq 9
End End
End End

View File

@@ -47,7 +47,7 @@ Describe '%text directive'
The output should eq 'ABC' The output should eq 'ABC'
End End
Describe 'variable expantion' Describe 'variable expansion'
Before 'text=abc' Before 'text=abc'
Example 'not expand variable (default)' Example 'not expand variable (default)'