Sign inSign up

shuehchoulu/lua-cook

By shuehchoulu

Updated almost 4 years ago

Test and lint lua-script

Image
0

118

shuehchoulu/lua-cook repository overview

Lua cook

Detailed in GitHub

It use Busted to test and LuaFormatter to lint lua scripts!

docker run --rm -t -v "$PWD:/data" shuehchoulu/lua-cook:${VERSION} lua-project.json

Configuration

You must give it configuration JSON file, for example lua-project.json:

{
  "files": ["src", "test"], // folders include lua scripts
  "test": { // configuration for testing
    "folders": ["test"], // needed folders
    "pattern": ".spec",
    "helper": "test/helpers.lua",
    "output": "gtest",
    "verbose": true
  },
  "format": { // configuration for formatting/linting
    "column-limit": 120,
    "single-quote-to-double-quote": true,
    "keep-simple-control-block-one-line": true,
    "no-keep-simple-function-one-line": true,
    "spaces-inside-table-braces": true
  }
}

Excepts commented fields, all the fields are directly pass to the dependency(LuaFormatter/Busted).

Specific action

In additionally, you can do specific action by passing second argument.

Test
docker run --rm -t -v "$PWD:/data" shuehchoulu/lua-cook:${VERSION} lua-project.json test --t_verbose

You can pass custom argument by command line without configuration file. The only different with Busted was all argument must prefix with t_, for example:

  • --t_verbose
  • --t_pattern=_spec
Format

Custom argument must prefix with f_.

docker run --rm -t -v "$PWD:/data" shuehchoulu/lua-cook:${VERSION} lua-project.json format --f_in-place
===== Formatting =====
... config data ...
formatting: /data/src/main.lua
    === Success ===
Lint
$ docker run --rm -t -v "$PWD:/data" shuehchoulu/lua-cook:${VERSION} lua-project.json format --f_check
===== Formatting =====
... config data ...
formatting: /data/src/main.lua
    === Success ===
  • --check Non-zero return if formatting is needed

Tag summary

Content type

Image

Digest

sha256:32540e333

Size

9.5 MB

Last updated

almost 4 years ago

docker pull shuehchoulu/lua-cook:v0.1