How to integrate an external code inspector into the Eclipse CDT

Source: Internet
Author: User

Codan is a code analysis framework that performs code checks on C/s + + projects. Since 2011, Codan has become part of the Eclipse CDT, which not only provides all the infrastructure needed to perform static code analysis, but also provides useful, Ready-to-use question Checker (see Resources).

Codan was updated in June 2012 with Eclipse Juno, enabling developers to automate external code analysis tools in Eclipse. This is an encouraging improvement for both the Eclipse CDT and C + + developers. Although the previously provided problem checker has performed well, it still needs to provide more Codan functionality that is in line with existing external code analysis tools. Codan can now easily integrate with mature external tools such as Cppcheck and Clang_check.

The ability to integrate external code analysis tools with Eclipse CDT can provide more and better code checks than developers can use Codan alone, and greatly improve the overall development productivity. We can now configure the external Code analysis tool from the Codan Preferences page. Once integrated with Codan, the tool can be automatically invoked to display its output in the form of an editor tag.

In this article, you will be shown how to integrate your favorite Code analyzer into your Eclipse C + + development environment using Java code and a little XML. My example is based on Cppcheck and Codan integration, but the process should also apply to the tools you choose.

Installing Eclipse Juno and CDT

To follow the examples in this article, you will need to install the Eclipse Juno and CDT. If you have not installed Eclipse, you can install a version with the CDT preinstallation program. To do this, simply select the Eclipse IDE for C + + developers from the Eclipse downloads page.

If you have installed an Eclipse that does not include the CDT, follow these instructions to update your development environment:

In Eclipse, select Menu Help > Install New Software ....

In the Install dialog box, select Juno from the Drop-down list.

In the Programming Languages directory, select the C + + Development Tools SDK.

Figure 1. Installing the CDT

In addition to the CDT, you need to install standard GNU/C + + development tools to compile, build, and debug your code.

Start Codan

Most Codan code inspectors are enabled by default. You can configure Codan code checking separately from the Preferences or project property pages of Eclipse in either the workspace or the projects layer.

In the Preferences page of Codan, as shown in Figure 2, you can see all the code inspectors that are provided and the code issues reported on each inspector.

Figure 2. Codan The Code inspector on the Preferences page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.