Skip to content

Commit 43696e6

Browse files
authored
Added Timber library checks (#1)
1 parent 3f47a34 commit 43696e6

17 files changed

+169
-1
lines changed

src/main/resources/org/sonar/l10n/androidlint/rules/Android_lint_profile.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,14 @@
313313
"RtlCompat",
314314
"RtlSymmetry",
315315
"RtlHardcoded",
316-
"RtlEnabled"
316+
"RtlEnabled",
317+
"LogNotTimber",
318+
"StringFormatInTimber",
319+
"ThrowableNotAtBeginning",
320+
"BinaryOperationInTimber",
321+
"TimberArgCount",
322+
"TimberArgTypes",
323+
"TimberTagLength",
324+
"TimberExceptionLogging"
317325
]
318326
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<p>
2+
Since Timber handles String#format() automatically, use this instead of String concatenation.
3+
</p>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"sqKey": "BinaryOperationInTimber",
3+
"title": "Use String#format()",
4+
"type": "CODE_SMELL",
5+
"tags": [
6+
"android",
7+
"timber",
8+
"correctness#messages"
9+
],
10+
"defaultSeverity": "MINOR",
11+
"remediation": {
12+
"func": "Constant\\/Issue",
13+
"constantCost": "5min"
14+
},
15+
"status": "ready",
16+
"scope": "All"
17+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<p>
2+
Since Timber is included in the project, it is likely that calls to Log should instead be going to Timber.
3+
</p>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"sqKey": "LogNotTimber",
3+
"title": "Logging call to Log instead of Timber",
4+
"type": "CODE_SMELL",
5+
"tags": [
6+
"android",
7+
"timber",
8+
"correctness#messages"
9+
],
10+
"defaultSeverity": "MINOR",
11+
"remediation": {
12+
"func": "Constant\\/Issue",
13+
"constantCost": "5min"
14+
},
15+
"status": "ready",
16+
"scope": "All"
17+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<p>
2+
Since Timber handles String.format automatically, you may not use String#format().
3+
</p>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"sqKey": "StringFormatInTimber",
3+
"title": "Logging call with Timber contains String#format()",
4+
"type": "CODE_SMELL",
5+
"tags": [
6+
"android",
7+
"timber",
8+
"correctness#messages"
9+
],
10+
"defaultSeverity": "MINOR",
11+
"remediation": {
12+
"func": "Constant\\/Issue",
13+
"constantCost": "5min"
14+
},
15+
"status": "ready",
16+
"scope": "All"
17+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<p>
2+
In Timber you have to pass a Throwable at the beginning of the call.
3+
</p>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"sqKey": "ThrowableNotAtBeginning",
3+
"title": "Exception in Timber not at the beginning",
4+
"type": "CODE_SMELL",
5+
"tags": [
6+
"android",
7+
"timber",
8+
"correctness#messages"
9+
],
10+
"defaultSeverity": "MINOR",
11+
"remediation": {
12+
"func": "Constant\\/Issue",
13+
"constantCost": "5min"
14+
},
15+
"status": "ready",
16+
"scope": "All"
17+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<p>
2+
When a formatted string takes arguments, you need to pass at least that amount of arguments to the formatting call.
3+
</p>

0 commit comments

Comments
 (0)