Jump to content




cclint - lua linter with cc-specified features

utility

  • You cannot reply to this topic
1 reply to this topic

#1 Shura1oplot

  • New Members
  • 1 posts

Posted 11 March 2014 - 01:49 PM

cclint is an outside MC lua linter with CC-specified features. It uses luac's bytecode listing and reports all accesses to global variables, which catches many typing errors in variable names.

Examples
Spoiler

If luac cannot compile code, cclint reports error.
Spoiler

Global variable can be declared by
os.loadAPI("path/NAME")
bapil.loadAPI("path/NAME")

Linter supports some control directives:
  • lint-ignore-global-get: foo,bar,baz - ignore global get for listed names,
  • lint-ignore-global-set: foo,bar,baz - ignore global set for listed names,
  • lint-ignore-global: foo,bar,baz - ignore global get or set for listed names,
  • lint-set-globals-in-main-chunk - ignore globals set in main chunk,
  • lint-check-globals-cached - report on getting globals outside main chunk.
Directives can be added as comment into the code.
Spoiler

Download: https://github.com/Shura1oplot/cclint

How to install
On windows: On linux:
  • install lua 5.1 from repository (for debian based distros: apt-get install lua5.1)
  • copy cclint.py to ~/bin
  • ensure ~/bin is in PATH environment variable
  • use it in terminal emulator by typing "cclint.py lua_file"
On OSX:
  • install lua 5.1 somehow (I have never use OSX)
  • copy cclint.py to ~/bin
  • ensure ~/bin is in PATH variable
  • if directory with luac5.1 is not in PATH environment variable, set LUAC51 environment variable to full path to luac5.1.
  • use it in terminal emulator by typing "cclint.py lua_file"
cclint looks for luac5.1 binary:
  • in LUAC51 environment variable,
  • in the directory with cclint.py [only on Windows],
  • in directories in PATH environment variable.

Similar projects:
There is an experimental SublimeText 3 plugin: https://github.com/S...-contrib-cclint
It can be installed only by git clone to ~/.config/sublime-text-3/Packages directory.
Tested on linux, may work on OSX and should not work on windows without some changes in plugin code.
If windows support is needed, add issue or pull request in github project page.
Spoiler

Edited by Shura1oplot, 11 March 2014 - 03:01 PM.


#2 tesla1889

  • Members
  • 351 posts
  • LocationSt. Petersburg

Posted 15 March 2014 - 03:08 PM

http://en.wikipedia...._%28software%29

pretty ambitious from what i've read
i'm glad someone has implemented this





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users