plceye
A static analyzer and code smell detector for PLC files.
Supported Formats
- L5X - Rockwell Automation Studio 5000 Logix Designer
- PLCopen XML - IEC 61131-3 standard exchange format
Features
- Unused Tags/Variables (P00001) - Detect tags that are defined but never referenced
- Undefined Tags (P00002) - Find tags referenced in code but not declared
- Empty Routines/POUs (P00003) - Identify routines with no logic
- Configurable - Customize detection via
plceye.toml
Installation
Usage
# Analyze a single file
# Analyze PLCopen XML file
# Analyze multiple files
# Use custom configuration
# Set minimum severity level
# Generate default configuration
Configuration
Create a plceye.toml file to customize detection:
[]
# Minimum severity to report: "info", "warning", "error"
= "info"
[]
= true
# Ignore tags matching these patterns (glob-style)
= ["_*", "HMI_*"]
# Ignore tags in these scopes
= []
[]
= true
# Ignore undefined tags matching these patterns
= ["Local:*"]
[]
= true
= []
Output
=== project.L5X ===
[info] P00001: Controller - Tag 'Spare_01' is defined but never used (Spare_01)
[warning] P00002: Program:Main - Tag 'Unknown' is referenced but not defined (Unknown)
Found 2 issue(s) in 1 file(s).
Rule Codes
| Code | Name | Description | Default Severity |
|---|---|---|---|
| P00001 | unused-tag | Tag/variable defined but never referenced | info |
| P00002 | undefined-tag | Tag referenced but not defined | warning |
| P00003 | empty-block | Routine/POU with no executable logic | info |
Library Usage
use ;
let project = from_file?;
let detector = new;
let report = detector.analyze?;
for smell in report.smells
Disclaimer
This is an independent open-source project and is not affiliated with, endorsed by, or associated with Rockwell Automation, Inc.
"Rockwell Automation", "Allen-Bradley", "Studio 5000", and "Logix Designer" are trademarks of Rockwell Automation, Inc.
License
MIT License - see LICENSE for details.