/
bestpractices.xml
37 lines (33 loc) · 1.35 KB
/
bestpractices.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="Best Practices"
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 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
<description>
Rules which enforce generally accepted best practices.
</description>
<rule name="FunctionNameTooShort"
since="7.0.0"
language="kotlin"
message="Function names should have non-cryptic and clear names."
class="net.sourceforge.pmd.lang.rule.xpath.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_kotlin_bestpractices.html#functionnametooshort">
<description>
Function names should be easy to understand and describe the intention. Makes developers happy.
</description>
<priority>3</priority>
<properties>
<property name="xpath">
<value><![CDATA[
//FunctionDeclaration/SimpleIdentifier/T-Identifier[string-length(@Text) < 3]
]]></value>
</property>
</properties>
<example>
<![CDATA[
fun cl() {} // violation, no unavailable attribute added to the function declaration
fun calculateLayout() // no violation
]]>
</example>
</rule>
</ruleset>