aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsagar shah <sms2sagar94@gmail.com>2017-03-13 21:02:45 +0530
committerrnveach <rveach02@gmail.com>2017-04-09 08:44:12 -0400
commitd876c652c5fcb43522f49747a63844b49c92c89a (patch)
tree02d09f1b08af306ba8f2b67a0733ff6046fde648 /src
parent460c185287512b7b07cf14e23fee70cb41d10915 (diff)
downloadcheckstyle-d876c652c5fcb43522f49747a63844b49c92c89a.tar.gz
Issue #3902: Formatting issue in documentation
Diffstat (limited to 'src')
-rw-r--r--src/site/resources/css/site.css13
-rw-r--r--src/xdocs/beginning_development.xml18
-rw-r--r--src/xdocs/cmdline.xml.vm50
-rw-r--r--src/xdocs/writingchecks.xml14
-rw-r--r--src/xdocs/writingjavadocchecks.xml.vm8
5 files changed, 51 insertions, 52 deletions
diff --git a/src/site/resources/css/site.css b/src/site/resources/css/site.css
index 78e262eca..4d3f5d0bf 100644
--- a/src/site/resources/css/site.css
+++ b/src/site/resources/css/site.css
@@ -49,3 +49,16 @@ h2:hover .anchor {
.anchor {
display: none;
}
+
+.source {
+ width: 90%;
+ overflow-x: auto;
+ white-space: nowrap;
+}
+
+.wrap-content {
+ white-space: pre-wrap !important;
+ white-space: -moz-pre-wrap !important;
+ white-space: -o-pre-wrap !important;
+ word-wrap: break-word !important;
+}
diff --git a/src/xdocs/beginning_development.xml b/src/xdocs/beginning_development.xml
index 1c2cd3c64..9e8cf084c 100644
--- a/src/xdocs/beginning_development.xml
+++ b/src/xdocs/beginning_development.xml
@@ -30,11 +30,11 @@
<a href="https://help.github.com/articles/fork-a-repo/"> here</a><br/>
3. Checkout the current source code from: https://github.com/you_user_name/checkstyle/<br/>
by running
- <source>
+ <source class="wrap-content">
git clone git@github.com:you_user_name/checkstyle.git
</source>
Attention for Windows users, command should be:
- <source>
+ <source class="wrap-content">
git config --global core.autocrlf true
git clone git@github.com:you_user_name/checkstyle.git
</source>
@@ -52,37 +52,37 @@ git clone git@github.com:you_user_name/checkstyle.git
<p>
Follow these instructions of Git usage and creating a Pull Request:<br/>
1) Configure remotes:
- <source>
+ <source class="wrap-content">
git remote add main https://github.com/checkstyle/checkstyle
</source>
2) Create a branch for a new check:
- <source>
+ <source class="wrap-content">
git checkout -b my-new-check
</source>
3) Commit changes to my-new-check branch:
- <source>
+ <source class="wrap-content">
git add .
git commit -m "commit message"
</source>
4) Push branch to GitHub, to allow your mentor to review your code:
- <source>
+ <source class="wrap-content">
git push origin my-new-check
</source>
5) Repeat steps 3-4 till development is complete<br/>
6) Update current branch and local master by pulling changes that were done<br/>
by other contributors:
- <source>
+ <source class="wrap-content">
git pull --rebase main master
</source>
7) In the process of the rebase, it may discover conflicts.<br/>
In that case it will stop and allow you to fix the conflicts.<br/>
After fixing conflicts, use git add . to update the index with those contents,<br/>
and then just run:
- <source>
+ <source class="wrap-content">
git rebase --continue
</source>
8) Push branch to GitHub (with all your final changes and actual code of Checkstyle):
- <source>
+ <source class="wrap-content">
git push --force origin my-new-check
</source>
9) Only after all content is finished and testing is done - send a <a href="https://help.github.com/articles/using-pull-requests/">Pull Request</a>
diff --git a/src/xdocs/cmdline.xml.vm b/src/xdocs/cmdline.xml.vm
index ebcd4ab7e..4fb7f76d3 100644
--- a/src/xdocs/cmdline.xml.vm
+++ b/src/xdocs/cmdline.xml.vm
@@ -140,7 +140,7 @@ java -D&lt;property&gt;=&lt;value&gt; \
the <code>-jar</code> option. Download latest <a href="http://downloads.sourceforge.net/project/checkstyle/checkstyle/${projectVersion}/checkstyle-${projectVersion}-all.jar">
checkstyle-${projectVersion}-all.jar</a>.
An example of run would be:
- <source>
+ <source class="wrap-content">
java -jar checkstyle-${projectVersion}-all.jar -c /sun_checks.xml MyClass.java
java -jar checkstyle-${projectVersion}-all.jar -c /google_checks.xml MyClass.java
</source>
@@ -153,7 +153,7 @@ java -jar checkstyle-${projectVersion}-all.jar -c /google_checks.xml MyClass.jav
the <code>-jar</code> option. Download latest <a href="http://downloads.sourceforge.net/project/checkstyle/checkstyle/${projectVersion}/checkstyle-${projectVersion}-all.jar">
checkstyle-${projectVersion}-all.jar</a>.
An example of run would be (path to java file is optional):
- <source>
+ <source class="wrap-content">
java -cp checkstyle-${projectVersion}-all.jar com.puppycrawl.tools.checkstyle.gui.Main MyClass.java
</source>
</p>
@@ -162,24 +162,22 @@ java -cp checkstyle-${projectVersion}-all.jar com.puppycrawl.tools.checkstyle.gu
<section name="Run after compilation">
<p>
Download and compile:
- <source>
+ <source class="wrap-content">
git clone https://github.com/checkstyle/checkstyle.git
cd checkstyle
mvn clean compile
</source>
Run validation with arguments:
- <source>
-mvn exec:java -Dexec.mainClass="com.puppycrawl.tools.checkstyle.Main" \
- -Dexec.args="-c /sun_checks.xml src/main/java "
+ <source class="wrap-content">
+mvn exec:java -Dexec.mainClass="com.puppycrawl.tools.checkstyle.Main" -Dexec.args="-c /sun_checks.xml src/main/java "
</source>
Run UI application for file :
- <source>
- mvn exec:java -Dexec.mainClass="com.puppycrawl.tools.checkstyle.gui.Main" \
- -Dexec.args="src/main/java/com/puppycrawl/tools/checkstyle/Checker.java"
+ <source class="wrap-content">
+ mvn exec:java -Dexec.mainClass="com.puppycrawl.tools.checkstyle.gui.Main" -Dexec.args="src/main/java/com/puppycrawl/tools/checkstyle/Checker.java"
</source>
Build all jars, and launch CLI from new build:
- <source>
+ <source class="wrap-content">
mvn clean package -Passembly
java -jar target/checkstyle-X.X-SNAPSHOT-all.jar -c /sun_checks.xml MyClass.java
</source>
@@ -203,9 +201,8 @@ java -jar target/checkstyle-X.X-SNAPSHOT-all.jar -c /sun_checks.xml MyClass.java
<code>docs/sun_checks.xml</code> on a filesystem
</b>
</p>
- <source>
-java com.puppycrawl.tools.checkstyle.Main -c docs/sun_checks.xml \
- Check.java
+ <source class="wrap-content">
+java com.puppycrawl.tools.checkstyle.Main -c docs/sun_checks.xml Check.java
</source>
<p>
@@ -214,9 +211,8 @@ java com.puppycrawl.tools.checkstyle.Main -c docs/sun_checks.xml \
<code>docs/sun_checks.xml</code> on all Java files in a directory
</b>
</p>
- <source>
-java com.puppycrawl.tools.checkstyle.Main -c docs/sun_checks.xml \
- src/
+ <source class="wrap-content">
+java com.puppycrawl.tools.checkstyle.Main -c docs/sun_checks.xml src/
</source>
<p>
@@ -226,10 +222,8 @@ java com.puppycrawl.tools.checkstyle.Main -c docs/sun_checks.xml \
property
</b>
</p>
- <source>
-java -Dcheckstyle.cache.file=target/cachefile \
- com.puppycrawl.tools.checkstyle.Main -c docs/sun_checks.xml \
- Check.java
+ <source class="wrap-content">
+java -Dcheckstyle.cache.file=target/cachefile com.puppycrawl.tools.checkstyle.Main -c docs/sun_checks.xml Check.java
</source>
<p>
@@ -239,9 +233,8 @@ java -Dcheckstyle.cache.file=target/cachefile \
file
</b>
</p>
- <source>
-java com.puppycrawl.tools.checkstyle.Main -c docs/sun_checks.xml \
- -p myCheckstyle.properties Check.java
+ <source class="wrap-content">
+java com.puppycrawl.tools.checkstyle.Main -c docs/sun_checks.xml -p myCheckstyle.properties Check.java
</source>
<p>
@@ -251,9 +244,8 @@ java com.puppycrawl.tools.checkstyle.Main -c docs/sun_checks.xml \
XML format
</b>
</p>
- <source>
-java com.puppycrawl.tools.checkstyle.Main -c docs/sun_checks.xml \
- -f xml -o build/checkstyle_errors.xml Check.java
+ <source class="wrap-content">
+java com.puppycrawl.tools.checkstyle.Main -c docs/sun_checks.xml -f xml -o build/checkstyle_errors.xml Check.java
</source>
<p>
@@ -262,10 +254,8 @@ java com.puppycrawl.tools.checkstyle.Main -c docs/sun_checks.xml \
(Root module, Checks, etc)</a> in configuration file:
</b>
</p>
- <source>
-java -classpath MyCustom.jar;checkstyle-${projectVersion}-all.jar \
- com.puppycrawl.tools.checkstyle.Main \
- -c config.xml Check.java
+ <source class="wrap-content">
+java -classpath MyCustom.jar;checkstyle-${projectVersion}-all.jar com.puppycrawl.tools.checkstyle.Main -c config.xml Check.java
</source>
<p>
<b>Note</b>: Custom modules should be specified with the class'
diff --git a/src/xdocs/writingchecks.xml b/src/xdocs/writingchecks.xml
index 8b5d2ae65..9035e28c8 100644
--- a/src/xdocs/writingchecks.xml
+++ b/src/xdocs/writingchecks.xml
@@ -183,7 +183,7 @@ CLASS_DEF -> CLASS_DEF [5:0]
Still with us? Great, you have mastered the basic theory so here
is your reward - a GUI that displays the structure of a Java source file. To run it type
</p>
- <source>
+ <source class="wrap-content">
java -cp checkstyle-${projectVersion}-all.jar com.puppycrawl.tools.checkstyle.gui.Main
</source>
@@ -581,17 +581,13 @@ public class MethodLimitCheck extends AbstractCheck
</p>
<p>For Linux/Unix OS:</p>
- <source>
-java -classpath mycompanychecks.jar:checkstyle-${projectVersion}-all.jar \
- com.puppycrawl.tools.checkstyle.Main
- -c config.xml myproject
+ <source class="wrap-content">
+java -classpath mycompanychecks.jar:checkstyle-${projectVersion}-all.jar com.puppycrawl.tools.checkstyle.Main-c config.xml myproject
</source>
<p>For Windows OS:</p>
- <source>
-java -classpath mycompanychecks.jar;checkstyle-${projectVersion}-all.jar \
- com.puppycrawl.tools.checkstyle.Main
- -c config.xml myproject
+ <source class="wrap-content">
+java -classpath mycompanychecks.jar;checkstyle-${projectVersion}-all.jar com.puppycrawl.tools.checkstyle.Main-c config.xml myproject
</source>
<p>
diff --git a/src/xdocs/writingjavadocchecks.xml.vm b/src/xdocs/writingjavadocchecks.xml.vm
index 363680608..514d5c0db 100644
--- a/src/xdocs/writingjavadocchecks.xml.vm
+++ b/src/xdocs/writingjavadocchecks.xml.vm
@@ -149,7 +149,7 @@ public class MyClass {
}
]]></source>
<p>Command:</p>
- <source>java -jar checkstyle-X.XX-all.jar -J MyClass.java</source>
+ <source class="wrap-content">java -jar checkstyle-X.XX-all.jar -J MyClass.java</source>
<p>Output:</p>
<source><![CDATA[
CLASS_DEF -> CLASS_DEF [5:0]
@@ -204,7 +204,7 @@ CLASS_DEF -> CLASS_DEF [5:0]
* @see AbstractClass
]]></source>
<p>Command:</p>
- <source>java -jar checkstyle-X.XX-all.jar -j MyJavadocComment.javadoc</source>
+ <source class="wrap-content">java -jar checkstyle-X.XX-all.jar -j MyJavadocComment.javadoc</source>
<p>Output:</p>
<source><![CDATA[
JAVADOC -> * My <b>class</b>.\r\n * @see AbstractClass<EOF> [0:0]
@@ -343,7 +343,7 @@ JAVADOC -> <audio><source src="horse.ogg" type="audio/ogg"/></audio><EOF> [0:0]
Input:
<source>&lt;audio&gt;test</source>
Output:
- <source>[ERROR:0] Javadoc comment at column 1 has parse error. Missed HTML close tag 'audio'. Sometimes it means that close tag missed for one of previous tags.</source>
+ <source class="wrap-content">[ERROR:0] Javadoc comment at column 1 has parse error. Missed HTML close tag 'audio'. Sometimes it means that close tag missed for one of previous tags.</source>
As you see Javadoc parser prints error and doesn't build AST if unknown HTML tag doesn't have matching end tag. If that a case please create an issue against Checkstyle to upgrade parser.
</p>
@@ -474,7 +474,7 @@ JAVADOC -> <p> First </p>\r\n<p> Second </p><EOF> [0:0]
<p>
Checkstyle GUI allows to showing javadoc tree in java files. To run in use
</p>
- <source>
+ <source class="wrap-content">
java -cp checkstyle-${projectVersion}-all.jar com.puppycrawl.tools.checkstyle.gui.Main
</source>
<p>