Fix externalInfoURLs in rulesets

This commit is contained in:
Andreas Dangel
2023-03-30 15:05:14 +02:00
parent 65a713a96d
commit 2e21c193fe
4 changed files with 15 additions and 9 deletions

View File

@ -16,6 +16,12 @@
</properties>
<build>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<!-- this needs to run before the ant task -->

View File

@ -10,11 +10,11 @@ Rules which enforce generally accepted best practices.
</description>
<rule name="ProhibitedInterfaceBuilder"
since="7.0"
since="7.0.0"
language="swift"
message="Creating views using Interface Builder should be avoided."
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="http://pmd.github.io/pmd/pmd_rules_swift_bestpractices.html#prohibitedinterfacebuilder">
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_swift_bestpractices.html#prohibitedinterfacebuilder">
<description>
Creating views using Interface Builder should be avoided.
Defining views by code allows the compiler to detect issues that otherwise will be runtime errors.
@ -45,11 +45,11 @@ class ViewController: UIViewController {
</rule>
<rule name="UnavailableFunction"
since="7.0"
since="7.0.0"
language="swift"
message="Unimplemented functions should be marked as unavailable."
class="net.sourceforge.pmd.lang.swift.rule.bestpractices.UnavailableFunctionRule"
externalInfoUrl="http://pmd.github.io/pmd/pmd_rules_swift_bestpractices.html#unavailablefunction">
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_swift_bestpractices.html#unavailablefunction">
<description>
Due to Objective-C and Swift interoperability some functions are often required to be implemented but
aren't really needed. It is extremely common that the sole implementation of the functions consist of throwing

View File

@ -11,10 +11,10 @@
<rule name="ForceCast"
language="swift"
since="7.0"
since="7.0.0"
message="Force casts should be avoided."
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="http://pmd.github.io/pmd/pmd_rules_swift_errorprone.html#forcecast">
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_swift_errorprone.html#forcecast">
<description>
Force casts should be avoided. This may lead to a crash if it's not used carefully.
For example assuming a JSON property has a given type, or your reused Cell has a certain contract.
@ -41,10 +41,10 @@ NSNumber() as? Int // no violation
<rule name="ForceTry"
language="swift"
since="7.0"
since="7.0.0"
message="Force tries should be avoided."
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="http://pmd.github.io/pmd/pmd_rules_swift_errorprone.html#forcetry">
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_swift_errorprone.html#forcetry">
<description>
Force tries should be avoided. If the code being wrapped happens to raise and exception, our application will crash.
Consider using a conditional try and handling the resulting optional, or wrapping the try statement in a do-catch block.

View File

@ -147,7 +147,7 @@ public abstract class AbstractRuleSetFactoryTest {
.append(rule.getName())
.append(" is missing 'externalInfoURL' attribute\n");
} else {
String expectedExternalInfoURL = "https?://pmd.(sourceforge.net|github.io)/.+/pmd_rules_"
String expectedExternalInfoURL = "https://docs.pmd-code.org/.+/pmd_rules_"
+ language.getTerseName() + "_"
+ IOUtil.getFilenameBase(fileName)
+ ".html#"