Skip to content

Commit

Permalink
Add luacheck config and configuration for Travis CI (#2790)
Browse files Browse the repository at this point in the history
* Move luacheck conf and fix Travis for all possible filenames
* Add lua script to help with luacheck config
* Add xargs approach for current luac.cross file checking
* Enable luacheck but do not break build
  • Loading branch information
galjonsfigur authored and marcelstoer committed Jun 28, 2019
1 parent 93b1a2d commit 7de8a01
Show file tree
Hide file tree
Showing 6 changed files with 1,164 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ script:
- if [ "$OS" = "windows" ]; then bash "$TRAVIS_BUILD_DIR"/tools/travis/ci-build-windows-ms.sh; fi
- if [ "$OS" = "linux" -a "$TRAVIS_PULL_REQUEST" != "false" ]; then bash "$TRAVIS_BUILD_DIR"/tools/travis/pr-build.sh; fi
- cd "$TRAVIS_BUILD_DIR"
- LUA_FILES=`find lua_modules lua_examples -iname "*.lua"`
- echo checking $LUA_FILES
- $LUACC -p $LUA_FILES
- echo "checking:"
- find lua_modules lua_examples -iname "*.lua" -print0 | xargs -0 echo
- find lua_modules lua_examples -iname "*.lua" -print0 | xargs -0 $LUACC -p
- if [ "$OS" = "linux" ]; then bash "$TRAVIS_BUILD_DIR"/tools/travis/run-luacheck.sh || true ; fi

7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ Use the platform and tools you feel most comfortable with. There are no constrai
- [Full-fledged Linux environment](http://www.esp8266.com/wiki/doku.php?id=toolchain#how_to_setup_a_vm_to_host_your_toolchain), either physical or virtual.
- [Docker image](https://hub.docker.com/r/marcelstoer/nodemcu-build/) which allows running the build inside the container as if you were running a build script on your local machine.

## Writing Lua Code
A great resource about writing Lua for NodeMCU can be found in [Lua Developer FAQ](https://nodemcu.readthedocs.io/en/latest/lua-developer-faq/) - make sure to read it! When you're writing your Lua code and it's not working as it should you can test it with `luacheck` tool that can help you find various types of bugs. To install it you have to install [luarocks](https://luarocks.org/) and use command `sudo luarocks install luacheck` to install the tool. Now you're ready to go! By using this command (assuming you're in `nodemcu-firmware` directory):

`luacheck --config tools/luacheck_config.lua <your file to check>`

you can look for bugs and problems within the code!

## Writing Documentation
The NodeMCU documentation is maintained within the same repository as the code. The primary reason is to keep the two in sync more easily. It's thus trivial for the NodeMCU team to verify that a PR includes the necessary documentation. Furthermore, the documentation is merged automatically with the code if it moves from branch X to Y.

Expand Down
Loading

0 comments on commit 7de8a01

Please sign in to comment.