Alibaba coding protocol compliance

background

At the Yunqi Conference in Hangzhou on October 14, 2017, the Alibaba coding protocol plug-in was premiered worldwide.
Afterwards, the client asked us to comply with the code, and designated me to implement it.
Install the plug-in, scan the code, a total of 24 categories were checked, and 7806 problems were found. This is a big number!
The project team itself also has development specifications, which also require that these problems be avoided, but it seems to have no effect.
Something must have gone wrong: or did not comply with the specification? Or no code review?
If all is done and there are so many problems, is there a problem with the mechanism itself?
Is the traditional one-paper development specification + requirements + code review really effective?
These questions are very important, but cleaning up the problem is more urgent.

solution

There are two stages: clear first, then standardize.
Write a picture description here

milestone

  • On October 23, 2017, the plan and implementation plan were reviewed and approved
  • On November 7, 2017, the rectification was completed

Pipelined

  • Check the code before submitting it , integrate the Alibaba coding protocol plug-in into the IDE. Before submitting the code, scan and clear the problem.
  • In the continuous integration, the coding protocol check is added . In the recently released version of the Jenkins plugin FireLine Plugin, the Alibaba coding protocol has been implemented.
  • Before the release of the version, check the coding protocol as the check item before the release of the version for final verification.
  • Related to individual performance , the results of the coding specifications checked during the continuous integration and version release stages are included in the individual performance.

Operating practice

  • Using Alibaba encoding protocol plug-in in Android Studio
  • Alibaba coding protocol plug-in used in Eclipse
  • Using FireLine plugin in jenkins for Alibaba coding protocol check

Using Alibaba encoding protocol plug-in in Android Studio

  • Install Alibaba Java Coding Guidelines plugin
    Write a picture description here
  • Project right-click> Coding protocol scanning
    Write a picture description here
  • Find the Inspection Results tab in the console area to view the results
    Write a picture description here

Alibaba coding protocol plug-in used in Eclipse

  • Install Alibaba Java Coding Guidelines plugin, plugin address https://p3c.alibaba.com/plugin/eclipse/update
    Write a picture description here
  • Project right-click> Ali coding protocol scanning
    Write a picture description here
  • Find the P3C Results tab in the console area to view the results
    Write a picture description here

Using FireLine plugin in jenkins for Alibaba coding protocol check

  • Plug-in management> Install FireLine Plugin
    Write a picture description here
  • Build> Add build step Execute FireLine
    Write a picture description here
  • Post-build operations> Publish HTML reports, HTML Publisher Plugin is required
    Write a picture description here
  • View report
    Write a picture description here
  • Note: In the new Jenkins version, the HTML Publisher Plugin plug-in will result in the failure to load CSS and click buttons in the opened webpage. It is due to the CSP (Content Security Policy) and can be executed in the Jenkins console:
    System.setProperty ("Hudson.model.DirectoryBrowserSupport.CSP", "") to solve this problem.
Published 5 original articles · Like1 · Visits 10,000+

Guess you like

Origin blog.csdn.net/cheerfor2008/article/details/78797644