Skip to content

Commit

Permalink
Format HTML and XML files (wpilibsuite#944)
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul authored and PeterJohnson committed May 16, 2018
1 parent adb6098 commit d8c8643
Show file tree
Hide file tree
Showing 7 changed files with 633 additions and 503 deletions.
478 changes: 268 additions & 210 deletions styleguide/checkstyle.xml

Large diffs are not rendered by default.

486 changes: 273 additions & 213 deletions styleguide/checkstyleExamples.xml

Large diffs are not rendered by default.

97 changes: 48 additions & 49 deletions styleguide/pmd-ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,58 @@
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<rule ref="rulesets/java/basic.xml" />
<rule ref="rulesets/java/braces.xml" />
<rule ref="rulesets/java/empty.xml" />
<rule ref="rulesets/java/empty.xml/EmptyCatchBlock">
<properties>
<property name="allowCommentedBlocks" value="true"/>
</properties>
</rule>
<rule ref="rulesets/java/imports.xml" />
<rule ref="rulesets/java/junit.xml">
<exclude name="JUnitTestContainsTooManyAsserts" />
</rule>
<rule ref="rulesets/java/strings.xml">
<exclude name="AvoidDuplicateLiterals" />
</rule>
<rule ref="rulesets/java/unnecessary.xml" />
<rule ref="rulesets/java/unusedcode.xml" />
<rule ref="rulesets/java/unusedcode.xml/UnusedFormalParameter">
<properties>
<property name="checkAll" value="true"/>
</properties>
</rule>

<!-- Custom Rules -->

<rule name="UseRequireNonNull"
message="Use Objects.requireNonNull() instead of throwing a NullPointerException yourself."
language="java"
class="net.sourceforge.pmd.lang.rule.XPathRule">
<description>
Use Objects.requireNonNull() instead of throwing a NullPointerException yourself.
</description>
<properties>
<property name="xpath">
<value>
<![CDATA[
<rule ref="rulesets/java/basic.xml" />
<rule ref="rulesets/java/braces.xml" />
<rule ref="rulesets/java/empty.xml" />
<rule ref="rulesets/java/empty.xml/EmptyCatchBlock">
<properties>
<property name="allowCommentedBlocks"
value="true" />
</properties>
</rule>
<rule ref="rulesets/java/imports.xml" />
<rule ref="rulesets/java/junit.xml">
<exclude name="JUnitTestContainsTooManyAsserts" />
</rule>
<rule ref="rulesets/java/strings.xml">
<exclude name="AvoidDuplicateLiterals" />
</rule>
<rule ref="rulesets/java/unnecessary.xml" />
<rule ref="rulesets/java/unusedcode.xml" />
<rule ref="rulesets/java/unusedcode.xml/UnusedFormalParameter">
<properties>
<property name="checkAll"
value="true" />
</properties>
</rule>
<!-- Custom Rules -->
<rule name="UseRequireNonNull"
message="Use Objects.requireNonNull() instead of throwing a NullPointerException yourself."
language="java"
class="net.sourceforge.pmd.lang.rule.XPathRule">
<description>Use Objects.requireNonNull() instead of throwing a
NullPointerException yourself.</description>
<properties>
<property name="xpath">
<value>
<![CDATA[
//IfStatement[child::Expression//NullLiteral]/Statement//ThrowStatement/Expression/PrimaryExpression/PrimaryPrefix/AllocationExpression/ClassOrInterfaceType[@Image='NullPointerException']
]]>
</value>
</property>
</properties>
<priority>3</priority>
<example>
<![CDATA[
</value>
</property>
</properties>
<priority>3</priority>
<example>
<![CDATA[
public class Example {
public Example(Object example) {
if (example == null) {
throw new NullPointerException();
}
}
public Example(Object example) {
if (example == null) {
throw new NullPointerException();
}
}
}
]]>
</example>
</rule>

</example>
</rule>
</ruleset>
13 changes: 7 additions & 6 deletions styleguide/suppressions.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0"?>

<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<!DOCTYPE
suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress files=".*sim.*" checks="[a-zA-Z0-9]*"/>
<suppress files="edu.wpi.first.wpilibj.util.WPILibVersion" checks="[a-zA-Z0-9]*"/>
<suppress files=".*sim.*"
checks="[a-zA-Z0-9]*" />
<suppress files="edu.wpi.first.wpilibj.util.WPILibVersion"
checks="[a-zA-Z0-9]*" />
</suppressions>
3 changes: 3 additions & 0 deletions tidy-html.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
indent: yes
indent-spaces: 2
wrap: 80
4 changes: 4 additions & 0 deletions tidy-xml.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
indent: yes
indent-spaces: 2
indent-attributes: yes
literal-attributes: yes
55 changes: 30 additions & 25 deletions wpilibj/src/main/java/edu/wpi/first/wpilibj/package.html
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>WPI Robotics library</title>
<meta http-equiv="Content-Type" content="text/html; charset=MacRoman">
</head>
<body>
The WPI Robotics library (WPILibJ) is a set of Java classes that interfaces to the hardware in the
FRC control system and your robot. There are classes to handle sensors, motors, the driver
station, and a number of other utility functions like timing and field management.
The library is designed to:
<ul>
<li>Deal with all the low level interfacing to these components so you can concentrate on
solving this year's "robot problem". This is a philosophical decision to let you focus
on the higher-level design of your robot rather than deal with the details of the
processor and the operating system.
</li>
<li>Understand everything at all levels by making the full source code of the library
available. You can study (and modify) the algorithms used by the gyro class for
oversampling and integration of the input signal or just ask the class for the current
robot heading. You can work at any level.
</li>
</ul>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>
WPI Robotics library
</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
The WPI Robotics library (WPILibJ) is a set of Java classes that interfaces
to the hardware in the FRC control system and your robot. There are classes
to handle sensors, motors, the driver station, and a number of other
utility functions like timing and field management. The library is designed
to:
<ul>
<li>Deal with all the low level interfacing to these components so you
can concentrate on solving this year's "robot problem". This is a
philosophical decision to let you focus on the higher-level design of
your robot rather than deal with the details of the processor and the
operating system.
</li>
<li>Understand everything at all levels by making the full source code of
the library available. You can study (and modify) the algorithms used by
the gyro class for oversampling and integration of the input signal or
just ask the class for the current robot heading. You can work at any
level.
</li>
</ul>
</body>
</html>

0 comments on commit d8c8643

Please sign in to comment.