diff --git a/README.md b/README.md index 1a0b17a..f48c20c 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,20 @@ # rapidchecker Grammar and format checker for ABB Rapid code. -- 🔎 Checks ABB RAPID code (.sys modules) for grammar errors and formatting issues. +- 🔎 Checks ABB RAPID code (.sys modules) - 🦾 Tested with RobotWare 5 code. - 🐍 Powered by Python and [pyparsing](https://github.com/pyparsing/pyparsing). +## Features + +`rapidchecker` checks for: + +- Code that violates the ABB RAPID grammar. +- Bad indentation. +- Lowercase keywords (`if` instead of `IF`, `module` instead of `MODULE` etc) +- Trailing space. +- Too many empty lines. + ## Getting started Install with `pip install rapidchecker` @@ -17,17 +27,11 @@ python -m rapidchecker If any grammar or format errors are found, they are printed to stdout and the command exits with exitcode 1. -## Features - -`rapidchecker` checks for: - -- Code that violates the ABB RAPID grammar. -- Bad indentation. Assumes indentation of 4 spaces. -- Lowercase keywords (`if` instead of `IF`, `module` instead of `MODULE` etc) +## Configuration -## To be added +You can enable/disable different checks by adding a `rapidchecker.toml` file to the folder in which rapidchecker runs. -- Checks for procedure, variable, function and signal names (enforce camel_case or snakeCase). +See [rapidchecker.template.toml](rapidchecker.template.toml) for reference. ## References diff --git a/rapidchecker.template.toml b/rapidchecker.template.toml new file mode 100644 index 0000000..d76d459 --- /dev/null +++ b/rapidchecker.template.toml @@ -0,0 +1,40 @@ +# Check for indentation errors +indentation_check = true + +# Expected indentation size (spaces only) +indentation_size = 2 + +# Throw error when RAPID keywords (IF, PROC, MODULE) are not in uppercase +require_uppercase_keywords = true + +# Maximum number of allowed empty lines +max_empty_lines = 2 + +# Throw error if file doesn't end with a new line +require_new_line_eof = true + +# Throw error when trailing space is found +allow_trailing_space = false + +# When indent_error_section = false, the error section in a procedure should be indented as follows +# +# PROC procName +# call1; +# .... +# ERROR +# call2; +# ... +# ENDPROC +# +# and when indent_error_section = true +# +# PROC procName +# call1; +# ... +# ERROR +# call2; +# ... +# ENDPROC +# +indent_error_section = false +