Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: CI

on:
push:
Expand All @@ -7,6 +7,24 @@ on:
branches: [ main, develop ]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Lua and LuaRocks
run: |
sudo apt-get update
sudo apt-get install -y lua5.4 luarocks

- name: Install luacheck
run: |
sudo luarocks install luacheck

- name: Run linting
run: |
make lint

test:
runs-on: ubuntu-latest
strategy:
Expand All @@ -29,4 +47,4 @@ jobs:

- name: Run tests
run: |
nvim --headless -c "PlenaryBustedDirectory tests/ { minimal_init = 'tests/minimal_init.vim' }"
make test
45 changes: 45 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
-- luacheck configuration for markdown-notes.nvim

-- Use LuaJIT + Neovim standard library
std = "luajit"

-- Add Neovim globals
globals = {
"vim",
}

-- Additional read-only globals for testing
read_globals = {
-- Busted testing framework
"describe", "it", "before_each", "after_each", "setup", "teardown",
"assert", "spy", "stub", "mock",
-- Plenary testing
"require",
}

-- Files/directories to exclude
exclude_files = {
".luarocks/",
"doc/tags",
}

-- Ignore specific warnings
ignore = {
"212", -- Unused argument (common in Neovim plugins for callback functions)
"213", -- Unused loop variable (common in ipairs/pairs loops)
}

-- Maximum line length
max_line_length = 100

-- Files and their specific configurations
files = {
["tests/"] = {
-- Allow longer lines in tests for readability
max_line_length = 120,
-- Additional testing globals
globals = {
"vim", -- vim is mocked in tests
}
}
}
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Makefile for markdown-notes.nvim

.PHONY: test lint lint-fix clean help

# Default target
help:
@echo "Available targets:"
@echo " test - Run all tests"
@echo " lint - Run luacheck linter"
@echo " lint-fix - Run luacheck and show detailed issues for fixing"
@echo " clean - Clean up temporary files"
@echo " help - Show this help message"

# Run tests
test:
nvim --headless -u tests/minimal_init.vim -c "lua require('plenary.test_harness').test_directory('tests')"

# Run linter
lint:
luacheck lua/ tests/

# Run linter with detailed output for fixing
lint-fix:
luacheck --formatter plain --codes lua/ tests/

# Clean up
clean:
find . -name "*.tmp" -delete
find . -name "luacov.*" -delete

# Check dependencies
check-deps:
@command -v luacheck >/dev/null 2>&1 || { echo "luacheck not found. Install with: luarocks install luacheck"; exit 1; }
@echo "✓ All dependencies available"
25 changes: 23 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,31 @@ We welcome contributions! Here's how to get started:
git clone https://github.com/yourusername/markdown-notes.nvim.git
cd markdown-notes.nvim

# Run tests (requires plenary.nvim)
nvim --headless -u tests/minimal_init.vim -c "lua require('plenary.test_harness').test_directory('tests')"
# Install luacheck for linting (optional but recommended)
luarocks install luacheck

# Run tests
make test

# Run linting
make lint

# Fix linting issues with detailed output
make lint-fix
```

### Development Tools

This project includes several development tools accessible via the Makefile:

- `make test` - Run all tests using plenary.nvim
- `make lint` - Run luacheck linter on source and test files
- `make lint-fix` - Run luacheck with detailed output for fixing issues
- `make clean` - Clean up temporary files
- `make check-deps` - Verify required tools are installed

The project uses GitHub Actions for CI, which automatically runs both tests and linting on all pull requests.

### Reporting Issues

- Use GitHub Issues for bug reports and feature requests
Expand Down
Loading