iec-checker/iec-checker

GitHub: iec-checker/iec-checker

针对 IEC 61131-3 程序提供静态分析,检测编码规范违规与潜在缺陷。

Stars: 98 | Forks: 19

# IEC 检查器 **⚡ [在线试用](https://iec-checker.github.io/playground)** | **📚 [文档](https://iec-checker.github.io/docs/intro)** | **🛡️ [检测器参考](https://iec-checker.github.io/docs/detectors)** | **🔧 [赞助自定义功能](https://iec-checker.github.io/docs/sponsor-development)** IEC 检查器是一个用于 [IEC 61131-3](https://en.wikipedia.org/wiki/IEC_61131-3) 程序的开源静态分析器。它在代码到达 PLC 之前捕获错误并强制执行 [PLCOpen 编码规范](https://plcopen.org/software-construction-guidelines)。 ## 外观示例 ``` $ iec_checker program.st PLCOPEN-CP3: Variable X shall be initialized before being used --> program.st:4:9 See: https://iec-checker.github.io/docs/detectors/PLCOPEN-CP3 PLCOPEN-CP13: POUs shall not call themselves directly or indirectly --> program.st:8:30 See: https://iec-checker.github.io/docs/detectors/PLCOPEN-CP13 ``` ## 功能特性 - 25 项 [PLCOpen 软件构建规范](https://iec-checker.github.io/docs/detectors/plcopen-overview) 检查 - 声明分析、不可达代码检测、未使用变量检测 - 结构化文本、[PLCOpen XML](https://plcopen.org/technical-activities/xml-exchange) 和 [SEL XML](https://selinc.com/products/3530/) 输入格式 - 用于 [CI/CD 集成](https://iec-checker.github.io/docs/ci-cd) 和 [Python 工具](https://iec-checker.github.io/docs/python) 的 JSON 输出 ST 方言与 [matiec](https://github.com/sm1820/matiec) 编译器兼容。如果 `iec-checker` 在您的 PLC 供应商扩展上遇到问题,请[提出问题](https://github.com/jubnzv/iec-checker/issues/new)。 ## 安装 从 [GitHub 发布页](https://github.com/jubnzv/iec-checker/releases) 下载适用于 Linux 或 Windows x86_64 的预构建二进制文件。 ### 从源代码构建 需要 [OCaml](https://ocaml.org/docs/install.html) 5.1+ 和 [opam](https://opam.ocaml.org/doc/Install.html)。 ``` opam install --deps-only . make ``` 请参阅 [安装指南](https://iec-checker.github.io/docs/installation) 获取 Windows 说明和可选的 Python 设置。 ## 用法 ``` iec_checker test/st/*.st # check ST files iec_checker -i xml schemes/*.xml # check PLCOpen XML iec_checker --help # all options ``` 请参阅完整的 [CLI 参考](https://iec-checker.github.io/docs/cli) 以获取选项列表、输出格式和退出代码。
标签:IEC 61131-3, OCaml, PLC, PLCOpen, Python, ST, Web安全扫描, 二进制发布, 云安全监控, 代码规范, 在线工具, 工业安全, 开源, 开源工具, 无后门, 未使用变量, 未初始化变量, 死代码检测, 源码构建, 漏洞数据库, 结构化文本, 编译器, 网络调试, 自动化, 软件构造指南, 逆向工具, 错误基检测, 静态代码分析, 静态分析