Sync docs from master to gh-pages
This commit is contained in:
54
multi/multi__checkstyle.html
Normal file
54
multi/multi__checkstyle.html
Normal file
@@ -0,0 +1,54 @@
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>2. Checkstyle</title><link rel="stylesheet" type="text/css" href="css/manual-multipage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="multi_spring-cloud-build.html" title="Spring Cloud Build"><link rel="up" href="multi_spring-cloud-build.html" title="Spring Cloud Build"><link rel="prev" href="multi__building_and_deploying.html" title="1. Building and Deploying"><link rel="next" href="multi__contributing.html" title="3. Contributing"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">2. Checkstyle</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="multi__building_and_deploying.html">Prev</a> </td><th width="60%" align="center"> </th><td width="20%" align="right"> <a accesskey="n" href="multi__contributing.html">Next</a></td></tr></table><hr></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="_checkstyle" href="#_checkstyle"></a>2. Checkstyle</h1></div></div></div><p>Spring Cloud Build comes with a set of checkstyle rules. You can find them in the <code class="literal">spring-cloud-build-tools</code> module. The most notable files under the module are:</p><p><b>spring-cloud-build-tools/. </b>
|
||||
</p><pre class="screen">└── src
|
||||
├── checkstyle
|
||||
│ └── checkstyle-suppressions.xml <a name="CO1-1" href="#CO1-1"></a><span><img src="images/callouts/1.png" alt="1" border="0"></span>
|
||||
└── main
|
||||
└── resources
|
||||
├── checkstyle-header.txt <a name="CO1-2" href="#CO1-2"></a><span><img src="images/callouts/2.png" alt="2" border="0"></span>
|
||||
├── checkstyle.xml <a name="CO1-3" href="#CO1-3"></a><span><img src="images/callouts/3.png" alt="3" border="0"></span>
|
||||
└── intellij
|
||||
├── Intellij_Project_Defaults.xml <a name="CO1-4" href="#CO1-4"></a><span><img src="images/callouts/4.png" alt="4" border="0"></span>
|
||||
└── Intellij_Spring_Boot_Java_Conventions.xml <a name="CO1-5" href="#CO1-5"></a><span><img src="images/callouts/5.png" alt="5" border="0"></span></pre><p>
|
||||
</p><div class="calloutlist"><table border="0" summary="Callout list"><tr><td width="5%" valign="top" align="left"><p><a href="#CO1-3"><span><img src="images/callouts/3.png" alt="3" border="0"></span></a> </p></td><td valign="top" align="left"><p>Default Checkstyle rules</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#CO1-2"><span><img src="images/callouts/2.png" alt="2" border="0"></span></a> </p></td><td valign="top" align="left"><p>File header setup</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#CO1-1"><span><img src="images/callouts/1.png" alt="1" border="0"></span></a> </p></td><td valign="top" align="left"><p>Default suppression rules</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#CO1-4"><span><img src="images/callouts/4.png" alt="4" border="0"></span></a> </p></td><td valign="top" align="left"><p>Project defaults for Intellij that apply most of Checkstyle rules</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#CO1-5"><span><img src="images/callouts/5.png" alt="5" border="0"></span></a> </p></td><td valign="top" align="left"><p>Project style conventions for Intellij that apply most of Checkstyle rules</p></td></tr></table></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_checkstyle_configuration" href="#_checkstyle_configuration"></a>2.1 Checkstyle configuration</h2></div></div></div><p>Checkstyle rules are <span class="strong"><strong>disabled by deafult</strong></span>. To add checkstyle to your project just define the following properties and plugins.</p><p><b>pom.xml. </b>
|
||||
</p><pre class="screen"><properties>
|
||||
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError> <a name="CO2-1" href="#CO2-1"></a><span><img src="images/callouts/1.png" alt="1" border="0"></span>
|
||||
<maven-checkstyle-plugin.failsOnViolation>true
|
||||
</maven-checkstyle-plugin.failsOnViolation> <a name="CO2-2" href="#CO2-2"></a><span><img src="images/callouts/2.png" alt="2" border="0"></span>
|
||||
<maven-checkstyle-plugin.includeTestSourceDirectory>true
|
||||
</maven-checkstyle-plugin.includeTestSourceDirectory> <a name="CO2-3" href="#CO2-3"></a><span><img src="images/callouts/3.png" alt="3" border="0"></span>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin> <a name="CO2-4" href="#CO2-4"></a><span><img src="images/callouts/4.png" alt="4" border="0"></span>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin> <a name="CO2-5" href="#CO2-5"></a><span><img src="images/callouts/5.png" alt="5" border="0"></span>
|
||||
<groupId>io.spring.javaformat</groupId>
|
||||
<artifactId>spring-javaformat-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin> <a name="CO2-6" href="#CO2-6"></a><span><img src="images/callouts/6.png" alt="6" border="0"></span>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
</build></pre><p>
|
||||
</p><div class="calloutlist"><table border="0" summary="Callout list"><tr><td width="5%" valign="top" align="left"><p><a href="#CO2-1"><span><img src="images/callouts/1.png" alt="1" border="0"></span></a> </p></td><td valign="top" align="left"><p>Fails the build upon Checkstyle errors</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#CO2-2"><span><img src="images/callouts/2.png" alt="2" border="0"></span></a> </p></td><td valign="top" align="left"><p>Fails the build upon Checkstyle violations</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#CO2-3"><span><img src="images/callouts/3.png" alt="3" border="0"></span></a> </p></td><td valign="top" align="left"><p>Checkstyle analyzes also the test sources</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#CO2-4"><span><img src="images/callouts/4.png" alt="4" border="0"></span></a> <a href="#CO2-6"><span><img src="images/callouts/6.png" alt="6" border="0"></span></a> </p></td><td valign="top" align="left"><p>Add checkstyle plugin to your build and reporting phases</p></td></tr><tr><td width="5%" valign="top" align="left"><p><a href="#CO2-5"><span><img src="images/callouts/5.png" alt="5" border="0"></span></a> </p></td><td valign="top" align="left"><p>Add the Spring Java Format plugin that will reformat your code to pass most of the Checkstyle formatting rules</p></td></tr></table></div><p>If you need to suppress some rules (e.g. line length needs to be longer), then it’s enough for you to define a file under <code class="literal">${project.root}/src/checkstyle/checkstyle-suppressions.xml</code> with your suppressions. Example:</p><p><b>projectRoot/src/checkstyle/checkstyle-suppresions.xml. </b>
|
||||
</p><pre class="screen"><?xml version="1.0"?>
|
||||
<!DOCTYPE suppressions PUBLIC
|
||||
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
|
||||
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
|
||||
<suppressions>
|
||||
<suppress files=".*ConfigServerApplication\.java" checks="HideUtilityClassConstructor"/>
|
||||
<suppress files=".*ConfigClientWatch\.java" checks="LineLengthCheck"/>
|
||||
</suppressions></pre><p>
|
||||
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="multi__building_and_deploying.html">Prev</a> </td><td width="20%" align="center"> </td><td width="40%" align="right"> <a accesskey="n" href="multi__contributing.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">1. Building and Deploying </td><td width="20%" align="center"><a accesskey="h" href="multi_spring-cloud-build.html">Home</a></td><td width="40%" align="right" valign="top"> 3. Contributing</td></tr></table></div></body></html>
|
||||
Reference in New Issue
Block a user