aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2020-07-05 20:45:46 +0200
committerThomas Vigouroux <39092278+vigoux@users.noreply.github.com>2020-07-06 11:15:17 +0200
commit27d7a0ffff1623572a642f3e45db3fc556dafec3 (patch)
tree2eef90da375b82a85b30bf5e996f53054cb3f4cb
parentAllow arbitrary query files in locals.lua (diff)
downloadnvim-treesitter-27d7a0ffff1623572a642f3e45db3fc556dafec3.tar
nvim-treesitter-27d7a0ffff1623572a642f3e45db3fc556dafec3.tar.gz
nvim-treesitter-27d7a0ffff1623572a642f3e45db3fc556dafec3.tar.bz2
nvim-treesitter-27d7a0ffff1623572a642f3e45db3fc556dafec3.tar.lz
nvim-treesitter-27d7a0ffff1623572a642f3e45db3fc556dafec3.tar.xz
nvim-treesitter-27d7a0ffff1623572a642f3e45db3fc556dafec3.tar.zst
nvim-treesitter-27d7a0ffff1623572a642f3e45db3fc556dafec3.zip
Add style-check script
-rw-r--r--.travis.yml2
-rw-r--r--CONTRIBUTING.md12
-rwxr-xr-xscripts/pre-push7
-rwxr-xr-xscripts/style-check.sh3
4 files changed, 23 insertions, 1 deletions
diff --git a/.travis.yml b/.travis.yml
index a6749df1e..a3d4dfe86 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,4 +8,4 @@ before_install:
- sudo luarocks install luacheck
script:
- - luacheck **/**/*.lua --codes
+ - ./scripts/style-check.sh
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index af48cdc62..47dcb9f83 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -11,6 +11,18 @@ As you know, `nvim-treesitter` is roughly splitted in two parts :
Depending on which part of the plugin you want to contribute to, please read the appropriate section.
+## Style Checks and Tests
+
+We haven't implemented any functionality tests yet. Feel free to contribute.
+However, we check code style with `luacheck`!
+Please install luacheck and activate our `pre-push` hook to automatically check style before
+every push:
+
+```bash
+luarocks install luacheck
+ln -s ../../scripts/pre-push .git/hooks/pre-push
+```
+
## Parser configurations
Contributing to parser configurations is basically modifying one of the `queries/*/*.scm`.
diff --git a/scripts/pre-push b/scripts/pre-push
new file mode 100755
index 000000000..00d4c5071
--- /dev/null
+++ b/scripts/pre-push
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+# Can be used as a pre-push hook
+# Just symlink this file to .git/hooks/pre-push
+
+echo "Running style check..."
+./scripts/style-check.sh
diff --git a/scripts/style-check.sh b/scripts/style-check.sh
new file mode 100755
index 000000000..181ab4581
--- /dev/null
+++ b/scripts/style-check.sh
@@ -0,0 +1,3 @@
+#!/usr/bin/env bash
+
+luacheck `find -name "*.lua"` --codes