| Crates.io | plceye |
| lib.rs | plceye |
| version | 0.7.1 |
| created_at | 2025-12-03 13:24:32.012015+00 |
| updated_at | 2025-12-14 17:14:11.154534+00 |
| description | PLC code smell detector and static analyzer for L5X and PLCopen files |
| homepage | https://plceye.com |
| repository | https://github.com/radevgit/plc |
| max_upload_size | |
| id | 1964010 |
| size | 188,834 |
A static analyzer and code smell detector for PLC files.
plceye.tomlcargo install plceye
# Analyze a single file
plceye project.L5X
# Analyze PLCopen XML file
plceye project.xml
# Analyze multiple files
plceye *.L5X
# Use custom configuration
plceye --config plceye.toml project.L5X
# Set minimum severity level
plceye --severity warning project.L5X
# Show file statistics (no rule detection)
plceye --stats project.L5X
plceye --stats project.xml # PLCopen stats show language usage
# Generate default configuration
plceye init
Create a plceye.toml file to customize detection:
[general]
# Minimum severity to report: "info", "warning", "error"
min_severity = "info"
[unused_tags]
enabled = true
# Ignore tags matching these patterns (glob-style)
ignore_patterns = ["_*", "HMI_*"]
# Ignore tags in these scopes
ignore_scopes = []
[undefined_tags]
enabled = true
# Ignore undefined tags matching these patterns
ignore_patterns = ["Local:*"]
[empty_routines]
enabled = true
ignore_patterns = []
[unused_aois]
enabled = true
[unused_datatypes]
enabled = true
[complexity]
enabled = true
max_complexity = 10
[nesting]
enabled = true
max_depth = 5
=== project.L5X ===
[info] S0001: Controller - Tag 'Spare_01' is defined but never used (Spare_01)
[warning] S0002: Program:Main - Tag 'Unknown' is referenced but not defined (Unknown)
[info] M0001: Program:Main - Routine 'ComplexLogic' has cyclomatic complexity of 15 (max: 10) (ComplexLogic)
Found 3 issue(s) in 1 file(s).
| Code | Name | Description | Default Severity |
|---|---|---|---|
| S0001 | unused-tag | Tag/variable defined but never referenced | info |
| S0002 | undefined-tag | Tag referenced but not defined | warning |
| S0003 | empty-block | Routine/POU with no executable logic | info |
| S0004 | unused-aoi | AOI defined but never called | info |
| S0005 | unused-datatype | User-defined type never used | info |
| M0001 | cyclomatic-complexity | ST routine complexity exceeds threshold | info |
| M0003 | deep-nesting | Control structure nesting too deep | info |
use plceye::{RuleDetector, LoadedProject};
let project = LoadedProject::from_file("project.L5X")?;
let detector = RuleDetector::new();
let report = detector.analyze(&project)?;
for rule in report.rules() {
println!("{}", rule);
}
// Get statistics
let stats = detector.get_stats(&project)?;
println!("ST Routines: {}", stats.st_routines);
println!("Max Complexity: {}", stats.st_max_complexity);
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.
MIT License - see LICENSE for details.