OCLint静态语法分析工具(安装使用步骤)
来源:互联网 发布:linux sap systemcopy 编辑:程序博客网 时间:2024/05/16 14:59
Brief Introduction:
homepage
OCLint is a static code analysis tool for improving quality and reducing defects by inspecting C, C++ and Objective-C code and looking for potential problems like:
- Possible bugs - empty if/else/try/catch/finally statements
- Unused code - unused local variables and parameters
- Complicated code - high cyclomatic complexity, NPath complexity and high NCSS
- Redundant code - redundant if statement and useless parentheses
- Code smells - long method and long parameter list
- Bad practices - inverted logic and parameter reassignment
Get OCLint
You can get the latest version by building from source code or downloading pre-compiled binaries.
Installation¶
Both pre-compiled binary distribution and local build bundle should end up with an OCLint release with which file tree similar to this:
oclint-release|-bin|-lib|---clang|-----3.4|-------include|-------lib|---oclint|-----rules|-----reporters
Even without installation, oclint is able to be invoked directly from bin directory now.
In order to ease the invocation, it’s recommended to add OCLint’s bin folder to system PATH, the environment variable that tells system which directories to search for executable files.
(即使没有安装,oclint能够直接从bin目录调用。
为了缓解调用,它建议添加OCLint的bin文件夹到系统路径,环境变量,告诉系统目录来搜索可执行文件。)
Option 1: Directly Adding to PATH¶
Following code snippet is an example for the .bashrc or .bash_profile file that is sourced when terminal launches.
OCLINT_HOME=/path/to/oclint-releaseexport PATH=$OCLINT_HOME/bin:$PATH
Option 2: Copying OCLint to System PATH¶
A few directories are supposed to be in the system PATH already, to mention a few, /usr/local/bin, /usr/bin, /bin, etc. Therefore, it’s also possible to copy the OCLint binaries into one of these folders, and move the dependencies over. As an example, presumes /usr/local/bin is in the PATH (may require root permission).
- cp bin/oclint* /usr/local/bin/
- cp -rp lib/* /usr/local/lib/
Dependency libraries are required to be put into appropriate directory, because oclint executable searches $(/path/to/bin/oclint)/../lib/clang,$(/path/to/bin/oclint)/../lib/oclint/rules and $(/path/to/bin/oclint)/../lib/oclint/reporters for builtin headers and dynamic libraries by default.
Verifying Installation¶
Open a new terminal prompt, and execute oclint directly from there and expect message similar to below:
$ oclintoclint: Not enough positional command line arguments specified!Must specify at least 1 positional arguments: See: oclint -help
That’s it – if OCLint is pretty new to you, tutorial would lead you by applying the tool to a sample code, and explaining a few concepts along the way.
- OCLint静态语法分析工具(安装使用步骤)
- OCLint 安装与使用
- OCLint 安装与使用
- OCLint安装与使用
- OCLint 安装与使用
- [OCLint]OCLint安装
- OCLint:静态代码分析工具(C、C++和Objective-C)
- 使用自动化语法分析工具BISON
- iOS项目的静态代码扫描之OClint安装
- iOS项目的静态代码扫描之OClint使用
- 使用OClint进行iOS项目的静态代码扫描
- 静态代码扫描--OCLint
- oclint-xcodebuild 的使用
- SCanDroid静态分析工具使用(一)安装配置
- HL7工具安装步骤
- [OCLint]iOS项目中使用OCLint指导手册
- Redy语法分析--语法分析工具yacc
- 代码圈复杂度(Cyclomatic Complexity,CC)和Oclint工具 介绍
- ORA-01439: column to be modified must be empty to change datatype
- 教你如何用Qt做透明的窗体,setMask,Qt,Opacity
- VS2008安装WTL项目模板
- POSTGIS简介
- jQuery select操作控制方法
- OCLint静态语法分析工具(安装使用步骤)
- MyEclipse的安装和汉化过程
- BroswerMode/DocumentMode/CompatMode/ 浏览器模式,文档模式,渲染模式
- 通向架构师的道路(第四天)之Tomcat性能调优-让小猫飞奔
- 物理DG日常管理
- linux调试MCX314AL过程
- 汉码科技仓储管理信息化解决方案,助力生产企业提升仓储管理水平,提升企业竞争力,提升产品形象
- 资费的修改(struts2+jsp)
- HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation