Skip to content

Commit

Permalink
Update README and add template (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
OdysseasKr authored Dec 16, 2024
1 parent 22cddf5 commit 113043f
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 10 deletions.
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -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`
Expand All @@ -17,17 +27,11 @@ python -m rapidchecker <path-to-file-or-dir>

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

Expand Down
40 changes: 40 additions & 0 deletions rapidchecker.template.toml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 113043f

Please sign in to comment.