mirror of
https://github.com/ivuorinen/nvim-shellspec.git
synced 2026-01-26 03:24:00 +00:00
- Add modern Lua implementation with modular architecture - Implement HEREDOC preservation and smart comment indentation - Create dual implementation (Neovim Lua + VimScript fallback) - Add comprehensive health check and configuration system - Enhance formatting engine with state machine for context awareness - Update documentation with Lua configuration examples - Add memory files for development workflow and conventions
4.0 KiB
4.0 KiB
Development Commands for nvim-shellspec
Quality Assurance & Linting Commands
Primary Linting Command
pre-commit run --all-files
This runs all configured linters and formatters including:
- ShellCheck for shell scripts
- shfmt for shell script formatting
- yamllint for YAML files
- markdownlint for Markdown files
- Various pre-commit hooks
Individual Linters
# YAML linting
yamllint .
# Markdown linting (via npx)
npx markdownlint-cli -c .markdownlint.json --fix README.md
# Shell script linting
shellcheck bin/shellspec-format
# Shell script formatting
shfmt -w bin/shellspec-format
# Lua linting (if available)
luacheck lua/shellspec/
Code Formatting
ShellSpec DSL Formatting
# Using standalone formatter
./bin/shellspec-format file.spec.sh
# Or in Neovim/Vim
:ShellSpecFormat
:ShellSpecFormatRange (for selected lines)
Testing New Lua Implementation (Neovim)
-- Test in Neovim command line
:lua require('shellspec').setup({ auto_format = true })
:lua require('shellspec').format_buffer()
-- Health check
:checkhealth shellspec
Development Testing
Manual Plugin Testing
# Create test file
touch test_example.spec.sh
# Test in Neovim
nvim test_example.spec.sh
# Verify filetype: :set filetype?
# Test formatting: :ShellSpecFormat
# Test health check: :checkhealth shellspec
HEREDOC and Comment Testing
Create test content with:
Describe "test"
# Comment that should be indented
It "should preserve HEREDOC"
cat <<EOF
This should not be reformatted
Even with nested indentation
EOF
End
End
Git Integration
# Pre-commit hooks are automatically installed
pre-commit install
# Run pre-commit on all files
pre-commit run --all-files
Neovim-Specific Development
Lua Module Testing
# Test individual modules in Neovim
:lua print(vim.inspect(require('shellspec.config').defaults))
:lua require('shellspec.format').format_buffer()
:lua require('shellspec.autocmds').setup()
Health Diagnostics
# Comprehensive health check
:checkhealth shellspec
# Check if modules load correctly
:lua require('shellspec.health').check()
File System Utilities (macOS/Darwin)
# File operations
ls -la # List files with details
find . -name # Find files by pattern
grep -r # Search in files (or use rg for ripgrep)
# Better alternatives available on system:
rg # ripgrep for faster searching
fd # faster find alternative
# Find all ShellSpec files in project
fd -e spec.sh
fd "_spec.sh$"
rg -t sh "Describe|Context|It" spec/
Development Workflow
Standard Development
- Make changes to Vim script or Lua files
- Test with sample ShellSpec files (
test_example.spec.sh) - Run
pre-commit run --all-filesbefore committing - Fix any linting issues
- Test in both Neovim (Lua path) and Vim (VimScript path)
- Commit changes
Feature Development
- Update Lua implementation in
lua/shellspec/ - Update VimScript compatibility in
autoload/shellspec.vim - Test dual implementation paths
- Update health checks if needed
- Update documentation
Configuration Testing
-- Test different configurations
require('shellspec').setup({
auto_format = true,
indent_size = 4,
indent_comments = false,
heredoc_patterns = {"<<[A-Z_]+", "<<'[^']*'"}
})
Performance Testing
# Test with large ShellSpec files
time nvim +':ShellSpecFormat' +':wq' large_spec_file.spec.sh
# Compare Lua vs VimScript performance
# (Use older Neovim version to force VimScript path)
Plugin Integration Testing
-- Test with lazy.nvim
{
dir = "/path/to/local/nvim-shellspec",
config = function()
require("shellspec").setup({ auto_format = true })
end
}
Memory and State Debugging
-- Debug configuration state
:lua print(vim.inspect(require('shellspec.config').config))
-- Debug formatting state
:lua require('shellspec.format').format_lines({"Describe 'test'", " It 'works'", " End", "End"})