SONAR6.0 Application III: Integrated Eclipse real-time Code quality analysis (with Eclipse initialization)

Source: Internet
Author: User

Sonar integrates with eclipse in the form of plug-ins to enable real-time code quality analysis, provided the sonar server is working properly.

First, launch eclipse, download and install the Sonar plugin

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M00/89/18/wKiom1gHQ6KDr4TnAAG2PXCmWig302.png "width=" 1017 "height=" 802 "/>

650) this.width=650; "Src=" http://192.168.1.195:8090/download/attachments/8683570/image2016-10-12%2013%3A57% 3a54.png?version=1&modificationdate=1476251901000&api=v2 "alt=" Image2016-10-12%2013%3a57%3a54.png?versi "/>

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M01/89/16/wKioL1gHQ6Pg8obrAABzo9IpjPo088.png "width=" 530 "height=" 899 "/>

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M02/89/16/wKioL1gHQ6Pi9HX2AACG1wjFJqY630.png "width=" 725 "height=" 899 "/>

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M00/89/18/wKiom1gHQ6SSn7LuAAAxeE-RdJc175.png "width=" 536 "height=" 258 "/>

650) this.width=650; "Src=" http://192.168.1.195:8090/download/attachments/8683570/image2016-10-12%2013%3A58% 3a36.png?version=1&modificationdate=1476251942000&api=v2 "alt=" Image2016-10-12%2013%3a58%3a36.png?versi "/>

Restart eclipse after installing the plug-in, and then right-click the item that requires code quality check

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M01/89/18/wKiom1gHQ6bzJGxtAAF8MeCjFVc993.png "width=" 995 "height=" 975 "/>

Configure the sonar server's address, login name, password, and so on.

650) this.width=650; "Src=" http://192.168.1.195:8090/download/attachments/8683570/image2016-10-12%2013%3A58% 3a53.png?version=1&modificationdate=1476251959000&api=v2 "alt=" Image2016-10-12%2013%3a58%3a53.png?versi "/>

650) this.width=650; "Src=" http://192.168.1.195:8090/download/attachments/8683570/image2016-10-12%2013%3A58% 3a59.png?version=1&modificationdate=1476251965000&api=v2 "alt=" Image2016-10-12%2013%3a58%3a59.png?versi "/>

You can search for a project name that has been built on the sonar server to join

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M01/89/18/wKiom1gHQ6axYzDsAABm_eeqXyM599.png "width=" "height=" 449 "/>

Second, configure the command window in eclipse to facilitate real-time code quality check.

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M02/89/16/wKioL1gHQ6iim8wdAAGJ795cCJA092.png "width=" 993 "height=" 943 "/>

Find Sonarlint, check its three components

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M01/89/16/wKioL1gHQ6jwiuKJAABAoQ9EPMc837.png "width=" 349 "height=" 456 "/>

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M01/89/18/wKiom1gHQ6qw4XbYAAGRQtQkl0M964.png "width=" 999 "height=" 954 "/>

You can begin to analyze the quality of your source code.

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M02/89/16/wKioL1gHQ63hELXUAAHzsS2ure4427.png "width=" 1028 "height=" 1018 "/>

Error description

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M00/89/16/wKioL1gHQ66j5o5EAAHcaPoF3ho044.png "width=" 1028 "height=" 1018 "/>

—————————————————————— Split Line: Also joins Eclipse's initialization configuration ———————————————

First, Eclipse initialization configuration

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M02/89/18/wKiom1gHQ6_Agp4hAAC5hFWpltE354.png "width=" 996 "height=" 354 "/>

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M01/89/18/wKiom1gHQ6-Catu2AADTKeLn4Cc136.png "width=" 799 "height=" 716 "/>

Configure the compiler background to your liking, etc.

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M02/89/18/wKiom1gHQ7DwWhcBAACvQQzalMM316.png "width=" 799 "height=" 716 "/>

Annotations to code (JAVADOC) and the specification of spaces

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M00/89/18/wKiom1gHQ7GglmHfAAD5uM1YLpE159.png "width=" 799 "height=" 845 "/>

Jave annotation specification, can be defined by themselves, you can also import

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m01/89/18/wkiom1ghq7pzhvfjaadpeah__t0382.png "width=" 799 "height=" 845 "/>

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M01/89/16/wKioL1gHQ7PDjWx2AAChNqvwnus160.png "width=" 964 "height=" 544 "/>

Re-enactment of formatter rules

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M01/89/18/wKiom1gHQ7XhMJyUAAFiusFRZuk910.png "width=" 1027 "height=" 848 "/>

(Import specification in attachment)

Install the operating environment.

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m02/89/16/wkiol1ghq7jdw-buaacf76kwjmy061.png "width=" 657 "height=" 686 "/>

Second, plug-in installation

1. Installing the Anti-compilation tool

Restart eclipse after you have copied the Net.sf.jadclipse_3.3.0.jar file to the Eclipse\plugins directory in Eclipse.

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M00/89/18/wKiom1gHQ7nT-xaTAAEVSvPo_F0789.png "width=" 953 "height=" 443 "/>

This appears after restarting Eclipse, editing the anti-compilation path

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m01/89/18/wkiom1ghq7nztij4aac2gu5icks829.png "width=" 749 "height=" 812 "/>

2, Installation Ermaster

After you copy the Org.insightech.er_1.0.0.v20150619-0219.jar file into the Eclipse\plugins directory, restart Eclipse, open perference

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M00/89/18/wKiom1gHQ7qA--LaAADgD-5iGpg621.png "width=" 949 "height=" 385 "/>

The database connection tool is updated when it is used.

650) this.width=650; "title=" image "style=" border-right-width:0px;background-image:none;border-bottom-width:0px; padding-top:0px;padding-left:0px;padding-right:0px;border-top-width:0px; "border=" 0 "alt=" image "src=" http:// S3.51cto.com/wyfs02/m01/89/18/wkiom1ghq7ua_99caac5g3lhm9g301.png "width=" 853 "height=" 686 "/>

3. Install Log for Eclipse

Help–>install new software

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M02/89/18/wKiom1gHQ7vT5-qwAADYEn21fnI111.png "height=" 445 "/>

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M02/89/16/wKioL1gHQ7zg-f-_AACa5CAi6Og571.png "height=" 731 "/>

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M02/89/16/wKioL1gHQ7zwqsezAACxoHxfJss906.png "height=" 747 "/>

Then all the way next or agree only to the installation is complete.

Put the file log4e-profiles.xml into workspace/.metadata/.plugins/de.jayefem.log4e to replace the file and restart Eclipse.

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M00/89/18/wKiom1gHQ72gTLscAACFQEVB2Hg321.png "height=" 395 "/>

Set after startup to change style to: my log4j 2

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M01/89/18/wKiom1gHQ72C8kNsAACQjCabKm8594.png "height=" 566 "/>

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M01/89/16/wKioL1gHQ76iTtJVAADNFWuFI1g638.png "height=" 754 "/>

You can print the method parameters normally by setting it in Eclipse settings.

4. Import JDK Source code

Window–>perference

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M02/89/16/wKioL1gHQ76j88DbAADGeeSw71U001.png "height=" 754 "/>

650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;background-image:none;border-bottom:0 px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "border=" 0 "alt=" image "src=" Http://s3.51cto.com/wyfs02/M00/89/16/wKioL1gHQ8CifqeaAAFPoc3U2vA043.png "height=" 754 "/>

You can see the source.

This article from the "Strong Technical communication blog," Please be sure to keep this source http://newthink.blog.51cto.com/872263/1863560

SONAR6.0 Application III: Integrated Eclipse real-time Code quality analysis (with Eclipse initialization)

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.