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
26 changes: 22 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
name: Tests
name: CI

on:
push:
branches: [ main ]
branches: [ main, develop ]
pull_request:
branches: [ main ]
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
53 changes: 53 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
-- 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 = 120

-- 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
},
},
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2025 paris3200
Copyright (c) 2025 Jason Paris

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
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"
Loading