OCLint – static code analysis for C, C++ and Objective-C

OCLint is a static code analysis tool that examines C, C++ and Objective-C source code to identify potential defects and maintainability problems. It concentrates on issues that compilers may not flag, such as unnecessarily complicated code, redundant statements and questionable programming practices.

The software provides a collection of rules covering different aspects of code quality. These include excessive method complexity, unused variables, long parameter lists and empty conditional statements.

OCLint uses the Clang compiler infrastructure to analyse source code. Developers can configure its checks and generate reports in several formats, making it suitable for local development and automated quality assurance.

This is free and open source software.

Key Features

  • Static analysis of C, C++ and Objective-C source code.
  • Detects suspicious constructs such as empty conditional statements and exception handlers.
  • Identifies unused local variables and function parameters.
  • Measures cyclomatic complexity and NPath complexity.
  • Reports methods that exceed configured complexity or length thresholds.
  • Detects excessively long parameter lists and other code smells.
  • Identifies redundant conditional statements and unnecessary parentheses.
  • Flags questionable programming practices, including parameter reassignment.
  • Configurable analysis rules and reporting thresholds.
  • Options for enabling or disabling individual checks.
  • Text, HTML, XML, JSON and PMD-compatible report formats.
  • Integration with Clang-based build environments and automated development workflows.
  • Cross-platform support – runs on Linux and macOS.

Website: github.com/oclint/oclint
Support:
Developer: Ryuichi Intellectual Property and OCLint contributors
License: BSD 3-Clause “New” or “Revised” License

OCLint is written in C++. Learn C++ with our recommended free books and free tutorials.

Related Software

C and C++ Linters
OCLintStatic code analysis tool for improving quality and reducing defects
cpplintStatic code checker for C++
CodeCheckerPlatform for running static analysers and managing code defects
UncrustifySource code beautifer
InferStatic analyser that detects bugs in Java, C and C++ code
Include What You UseSource analysis tool for C and C++ projects built on Clang
CppcheckStatic analysis tool for C/C++ code
flawfinderScans C and C++ source code for potential security weaknesses
clazyQt-focused static analyser that catches common C++ mistakes
ClangFormatCode formatting tool
Clang-TidyClang-based C++ “linter” tool
SmatchStatic analysis tool for finding defects in C code
CoccinelleSemantic patching tool for analysing and transforming C code

Read our verdict in the software roundup.


Best Free and Open Source Software LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.

We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more.

Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion.

Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted