casbin / lua-casbin

An authorization library that supports access control models like ACL, RBAC, ABAC in Lua (Kong, APISIX, OpenResty)
Apache License 2.0
55 stars 18 forks source link

Regarding code specifications or style #30

Closed leeqvip closed 3 years ago

leeqvip commented 3 years ago

I suggest that we should follow a coding style, such as : lua-style-guide.

hsluoyz commented 3 years ago

@techoner good idea, is there any linter tool we can utilize? Because it's hard to review PR with the coding guide just via human eyes.

uran0sH commented 3 years ago

https://github.com/mpeterv/luacheck this might be useful

hsluoyz commented 3 years ago

@RobotHuang good, but how to integrate it into our pipeline? Like local test run, git commit hook run or GitHub Pull Request checks.

uran0sH commented 3 years ago

@hsluoyz https://github.com/RobotHuang/lua-action/blob/master/.github/workflows/main.yml#L37 this is a simple example. We also could use other's action, like https://github.com/marketplace/actions/luacheck

hsluoyz commented 3 years ago

@RobotHuang good! Let's integrate it into this repo.

hsluoyz commented 3 years ago

@rushitote any thoughts on this?

rushitote commented 3 years ago

@hsluoyz I believe the two major styles we don't follow are:

Should we refactor it to follow LuaRocks or we follow our current style?

hsluoyz commented 3 years ago

There's no hard requirement for Lua coding styles. For easier porting code from Go/Java to Lua, I think currently 4 spaces and camelCase sound OK for now.