static code analysis

本文列举了多种静态代码分析工具,覆盖多种编程语言,如C/C++、Java、JavaScript等,并介绍了部分工具如何帮助开发者提高代码质量。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

List of tools for static code analysis


http://docs.oclint.org/en/dev/intro/tutorial.html (oclint) for objective-c

From Wikipedia, the free encyclopedia
Jump to:  navigationsearch

This is a list of tools for static code analysis.

Contents

Historical

  • Lint — The original static code analyzer of C code.

By language

Multi-language

  • Axivion Bauhaus Suite — A tool for Ada, C, C++, C#, and Java code that comprises various analyses such as architecture checking, interface analyses, and clone detection.
  • Black Duck Suite — Analyze the composition of software source code and binary files, search for reusable code, manage open source and third-party code approval, honor the legal obligations associated with mixed-origin code, and monitor related security vulnerabilities.
  • BugScout — Detects security flaws in Java, PHP, ASP and C# web applications.
  • CAST Application Intelligence Platform — Detailed, audience-specific dashboards to measure quality and productivity. 30+ languages, C/C++, Java, .NET, Oracle, PeopleSoft, SAP, Siebel, Spring, Struts, Hibernate and all major databases.
  • ChecKing — Integrated software quality portal that allows manage the quality of all phases of software development. It includes static code analyzers for Java, JSP, Javascript, HTML, XML, .NET (C#, ASP.NET, VB.NET, etc.), PL/SQL, embedded SQL, SAP ABAP IV, Natural/Adabas, C/C++, Cobol, JCL, PowerBuilder.
  • Coverity SAVE — Coverity® Static Analysis Verification Engine (Coverity SAVE™) is a static code analysis tool for C, C++, C# and Java source code. Coverity commercialized a research tool for finding bugs through static analysis, the Stanford Checker, which used abstract interpretation to identify defects in source code.
  • DMS Software Reengineering Toolkit — Supports custom analysis of C, C++, C#, Java, COBOL, PHP, VisualBasic and many other languages. Also COTS tools for clone analysis, dead code analysis, and style checking.
  • HP Fortify Source Code Analyzer — Helps developers identify software security vulnerabilities in C/C++, Java, JSP, .NET, ASP.NET, ColdFusion, classic ASP, PHP, Visual Basic 6, VBScript, JavaScript, PL/SQL, T-SQL, Python and COBOL and configuration files.
  • IBM Rational AppScan Source Edition — Analyzes source code to identify security vulnerabilities while integrating security testing with software development processes and systems. Supports C/C++, .NET, Java, JSP, JavaScript, ColdFusion, Classic ASP, PHP, Perl, VisualBasic 6, PL/SQL, T-SQL, and COBOL
  • Imagix 4D — Identifies problems in variable use, task interaction and concurrency, especially in embedded applications, as part of an overall system for understanding, improving and documenting C, C++ and Java code.
  • JustCode — Visual Studio code analysis and refactoring productivity tool by Telerik for C#, VB.NET, XAML, ASP.NET, JavaScript, HTML, XML, CSS, Razor, WinRT and Metro apps
  • LDRA Testbed — A software analysis and testing tool suite for C, C++, Ada83, Ada95 and Assembler (Intel, Freescale, Texas Instruments).
  • MALPAS; A software static analysis toolset for a variety of languages including Ada, C, Pascal and Assembler (Intel, PowerPC and Motorola). Used primarily for safety critical applications in Nuclear and Aerospace industries.
  • McCabe IQ — static and dynamic analysis tool for Ada, ASM86, C, C#, C++.NET, C++, COBOL, FORTRAN, JAVA, JSP, Perl, PL1, VB and VB.NET. It objectively measures software quality through advanced static analysis and visualizes the architecture, using interactive, visual environment to highligh the most complex areas of the code base to identify bugs and security vulnerabilities.
  • Moose — Moose started as a software analysis platform with many tools to manipulate, assess or visualize software. It can evolve to a more generic data analysis platform. Supported languages are C/C++, Java, Smalltalk, .NET, more may be added.
  • Copy/Paste Detector (CPD) — PMDs duplicate code detection for (e.g.) JavaJSPCC++ColdFusion,PHP and JavaScript[1] code.
  • Polyspace — Uses abstract interpretation to detect and prove the absence of certain run time errors insource code for C, C++, and Ada
  • Protecode — Analyzes the composition of software source code and binary files, searches for open source and third party code and their associated licensing obligations. Can also detect secuity vulnerabilities.
  • ResourceMiner — Architecture down to details multipurpose analysis and metrics, develop own rules for masschange and generator development. Supports 30+ legacy and modern languages and all major databases.
  • Semmle - supports Java, C, C++, C#.
  • SofCheck Inspector — Static detection of logic errors, race conditions, and redundant code for Ada andJava; automatically extracts pre/postconditions from code.
  • Sonar — A continuous inspection engine to manage the technical debt: unit tests, complexity, duplication, design, comments, coding standards and potential problems. Supports languages: ABAP, C, Cobol, C#, Flex, Forms, Groovy, Java, JavaScript, Natural, PHP, PL/SQL, Visual Basic 6, Web, XML, Python.
  • Sotoarc/Sotograph — Architecture and quality in-depth analysis and monitoring for C, C++, C#, Java
  • Understand — Analyzes Ada, C, C++, C#, COBOL, CSS, Delphi, Fortran, HTML, Java, JavaScript, Jovial, Pascal, PHP, PL/M, Python, VHDL, and XML — reverse engineering of source, code navigation, and metrics tool.
  • VCG - Free tool that locates security flaws in C++, Java and PL/SQL and gives pie chart breakdown of code/whitespace/comments/etc. Configuration files allow for additional searches for dangerous functions to be specified and options settings allow user to specify which levels of severity of vulnerabilities to search for.
  • Veracode — Finds security flaws in application binaries and bytecode without requiring source. Supported languages include C, C++, .NET (C#, C++/CLI, VB.NET, ASP.NET), Java, JSP, ColdFusion,PHPRuby on Rails, and Objective-C, including mobile applications on the Windows MobileBlackBerry,Android, and iOS platforms.
  • Visual Studio Team System — Analyzes C++, C# source codes. only available in team suite and development edition.
  • Yasca — Yet Another Source Code Analyzer, a plugin-based framework to scan arbitrary file types, with plugins for C/C++, Java, JavaScript, ASP, PHP, HTML/CSS, ColdFusion, COBOL, and other file types. It integrates with other scanners, including FindBugsPMD, and Pixy.

.NET

  • CodeIt.Right — Combines static code analysis and automatic refactoring to best practices which allows automatically correct code errors and violations; supports C# and VB.NET.
  • CodeRush — A plugin for Visual Studio, it addresses a multitude of shortcomings with the popular IDE. Including alerting users to violations of best practices by using static code analysis.
  • FxCop — Free static analysis for Microsoft .NET programs that compile to CIL. Standalone and integrated in some Microsoft Visual Studio editions; by Microsoft.
  • JustCode — Add-on for Visual Studio 2005/2008/2010 by Telerik for real-time, system-wide code analysis for C#, VB.NET, ASP.NET, XAML, JavaScript, HTML, Razor, CSS and multi-language systems.
  • Kalistick — Mixing from the Cloud: static code analysis with best practice tips and collaborative tools for Agile teams.
  • NDepend — Simplifies managing a complex .NET code base by analyzing and visualizing code dependencies, by defining design rules, by doing impact analysis, and by comparing different versions of the code. Integrates into Visual Studio.
  • Parasoft dotTEST — A static analysis, unit testing, and code review plugin for Visual Studio; works with languages for Microsoft .NET Framework and .NET Compact Framework, including C#, VB.NET, ASP.NET and Managed C++.
  • ReSharper — Plug-in to Visual Studio 2003/2005/2008/2010/2012 from the creators of IntelliJ IDEA, which executes over 1300 real-time static code inspections of C#, VB.NET, ASP.NET, ASP.NET MVC, JavaScript, XAML, XML, CSS, and HTML code.
  • StyleCop — Analyzes C# source code to enforce a set of style and consistency rules. It can be run from inside of Microsoft Visual Studio or integrated into an MSBuild project. Free download from Microsoft.

ActionScript

  • Apparat — A language manipulation and optimization framework consisting of intermediate representations for ActionScript.

Ada

C/C++

  • Astrée; exhaustive search for runtime errors and assertion violations by abstract interpretation; tailored towards critical code (avionics)
  • BLAST — (Berkeley Lazy Abstraction Software verification Tool) — A software model checker for C programs based on lazy abstraction.
  • Cppcheck — Open-source tool that checks for several types of errors, including use of STL.
  • cpplint - An open-source tool that checks for compliance with Google's style guide for C++ coding
  • Clang — A compiler that includes a static analyzer.
  • Coccinelle — Source code pattern matching and transformation
  • ECLAIR — A platform for the automatic analysis, verification, testing and transformation of C and C++ programs.
  • Eclipse (software) — An IDE that includes a static code analyzer (CODAN).
  • Fluctuat — Abstract interpreter for the validation of numerical properties of programs.
  • Frama-C — A static analysis framework for C.
  • Goanna — A software analysis tool for C/C++.
  • Lint — The original static code analyzer for C.
  • LDRA Testbed — A software analysis and testing tool suite for C/C++.
  • Parasoft C/C++test— A C/C++ tool that does static analysis, unit testing, code review, and runtime error detection; plugins available for Visual Studio and Eclipse-based IDEs.
  • PC-Lint — A software analysis tool for C/C++.
  • Polyspace — Uses abstract interpretation to detect and prove the absence of certain run time errors insource code
  • PVS-Studio — A software analysis tool for C/C++/.
  • QA-C (and QA-C++) — Deep static analysis of C/C++ for quality assurance and guideline enforcement.
  • SLAM project — a project of Microsoft Research for checking that software satisfies critical behavioral properties of the interfaces it uses.
  • Sparse — A tool designed to find faults in the Linux kernel.
  • Splint — An open source evolved version of Lint, for C.

Java

  • AgileJ StructureViews — Reverse engineered Java class diagrams with an emphasis on filtering
  • Checkstyle — Besides some static code analysis, it can be used to show violations of a configured coding standard.
  • FindBugs — An open-source static bytecode analyzer for Java (based on Jakarta BCEL) from the University of Maryland.
  • Hammurapi — Versatile code review program; free for non-commercial use.
  • PMD — A static ruleset based Java source code analyzer that identifies potential problems.
  • Soot — A language manipulation and optimization framework consisting of intermediate languages for Java.
  • Squale — A platform to manage software quality (also available for other languages, using commercial analysis tools though).
  • Jtest — Testing and static code analysis product by Parasoft.
  • LDRA Testbed — A software analysis and testing tool suite for Java.
  • SemmleCode — Object oriented code queries for static program analysis.
  • SonarJ — Monitors conformance of code to intended architecture, also computes a wide range of software metrics.
  • Kalistick — A Cloud-based platform to manage and optimize code quality for Agile teams with DevOps spirit

JavaScript

  • Closure Compiler — JavaScript optimizer that rewrites code to be faster and smaller, and checks use of native JavaScript functions.
  • JSLint — JavaScript syntax checker and validator.
  • JSHint — A community driven fork of JSLint.

Objective-C

  • Clang — The free Clang project includes a static analyzer. As of version 3.2, this analyzer is included inXcode.[2]
  • OCLint — A static code analysis tool for improving quality and reducing defects by inspecting Objective-C/C++/C code.

Perl

  • Perl::Critic - A tool to help enforce common best practices for programming in Perl. Most best practices are based on Damian Conway's Perl Best Practices book.
  • PerlTidy - Program that act as a syntax checker and tester/enforcer for coding practices in Perl.
  • Padre - An IDE for Perl that also provides static code analysis to check for common beginner errors.

Python

  • Pychecker — A source code checking tool.
  • Pylint — Static code analyzer.

Formal methods tools

Tools that use a formal methods approach to static analysis (e.g., using static program assertions):

See also

References

  1. ^ "PMD - Browse /pmd/5.0.0 at SourceForge.net". Retrieved Sun Dec 09 2012.
  2. ^ "Static Analysis in Xcode". Apple. Retrieved 2009-09-03.
  3. ^ Cousot, Patrick (2007). "The Role of Abstract Interpretation in Formal Methods". IEEE International Conference on Software Engineering and Formal Methods. Retrieved 2010-11-08.

External links

### 什么是 Code AnalysisCode Analysis(代码分析)是一种在软件开发过程中用于检测源代码中潜在问题的技术。它通过静态分析的方式,在不执行程序的前提下,对代码的结构、语法、语义以及编码规范等方面进行检查。其目的是提高代码质量、减少运行时错误、增强可维护性,并确保代码符合最佳实践和团队约定。 Code Analysis 可以识别多种类型的问题,包括但不限于: - **语法错误**:违反编程语言规范的代码。 - **逻辑缺陷**:可能导致运行时异常或不符合预期行为的代码模式。 - **安全漏洞**:如缓冲区溢出、SQL 注入等潜在风险。 - **性能问题**:低效的算法、不必要的资源占用等。 - **编码规范违规**:与项目或公司制定的代码风格不一致的地方。 在现代集成开发环境(IDE)中,例如 IntelliJ IDEA,Code Analysis 是一个内置功能,可以在提交代码前自动执行,帮助开发者尽早发现问题并修复。例如,在 IntelliJ IDEA 中启用 Code Analysis 后,如果检测到警告或错误,系统会提供详细的报告,包括问题的具体位置、严重程度及建议的修复方法[^1]。 这种方式不仅提升了代码审查的效率,还减少了因人为疏忽造成的质量问题,是实现持续集成和高质量交付的重要工具之一。 ### 示例:IntelliJ IDEA 中的 Code Analysis 报告 ```java public class Example { public static void main(String[] args) { int a = 10; if (a == 10) { System.out.println("Value is 10"); } } } ``` 在上述代码中,如果 `System.out.println` 被标记为过时 API 或存在更高效的替代方式,Code Analysis 将生成一条警告信息,提示开发者进行修改。 ### Code Analysis 的用途 - **早期缺陷检测**:在编译或测试阶段之前发现潜在问题,降低后期修复成本。 - **统一编码规范**:确保团队成员遵循相同的代码风格,提升可读性和一致性。 - **提升安全性**:识别常见的安全漏洞模式,防止恶意攻击。 - **优化性能**:建议更高效的实现方式,减少资源消耗。 - **辅助代码审查**:为人工代码评审提供结构化支持,聚焦真正需要关注的部分[^1]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值