Skip to content

Commit c52eb93

Browse files
committed
Version 1.25.
1 parent b3aba0c commit c52eb93

File tree

12 files changed

+100
-73
lines changed

12 files changed

+100
-73
lines changed

Inspections.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
| GDXAbbrClass | Use short class name | Notes when a short class name can be used for a standard scene2d.ui class instead of the full class name (libGDX >= 1.9.9). |
44
| GDXDuplicateProperty | Duplicate properties in Skin files | Looks for duplicate properties in Skin files. |
55
| GDXDuplicateResource | Duplicate resource names in Skin files | Looks for duplicate resource name in Skin files. |
6-
| GDXGradlePropertiesTestId | Test/dummy IDs in gradle.properties | Looks for the use of some known test IDs. |
7-
| GDXGradleTestId | Test/dummy IDs in build.gradle | Looks for the use of some known test IDs. |
6+
| GDXGradlePropertiesTestId | Test IDs or dummy IDs in gradle.properties | Looks for the use of some known test IDs and dummy IDs. |
7+
| GDXGradleTestId | Test IDs or dummy IDs in build.gradle | Looks for the use of some known test IDs and dummy IDs. |
88
| GDXInvalidEscape | Invalid escape sequence | Marks invalid escape sequences in libGDX style JSON files. |
99
| GDXJavaAssetsFileError | @GDXAssets problem | Checks for problems related to @GDXAssets annotations |
1010
| GDXJavaFlushInsideLoop | Flushing a batch inside a loop | Looks for the possibility of a flush of a batch or renderer occuring inside a loop, either directly or indirectly. <br />For performance reasons care should be taken to not cause unnecessary flushes, and to limit the number of flushes per frame as much as possible. <br />Note that calling SpriteBatch.draw(..) with a different texture also causes a flush, which is not detected by this inspection. Use a <a href="https://github.com/libgdx/libgdx/wiki/Texture-packer">Texture Atlas</a> instead of many different textures. |
@@ -14,7 +14,7 @@
1414
| GDXJavaNonExistingAsset | Resource doesn't exist | Looks in Java and Kotlin code for usages of resources which don't exist. @GDXAssets annotated elements only. |
1515
| GDXJavaProfilingCode | Profiling code | Looks for profiling code, which should be disabled before release. |
1616
| GDXJavaStaticResource | Static resource | Don't make resources static, unless you take care to properly manage them. Static resources can cause problems on Android, because the life-cycle of a static variable is not necessarily the same as the life-cycle of your application. |
17-
| GDXJavaTestId | Test/dummy IDs | Looks for the use of some known test IDs. |
17+
| GDXJavaTestId | Test IDs or dummy IDs | Looks for the use of some known test IDs and dummy IDs. |
1818
| GDXJavaUnsafeIterator | Use of non-reentrant iterator method | If Collections::allocateIteratorsIterator is false, methods on libGDX collections return the same iterator instance each time the method is called. For nested or multithreaded iteration create a new iterator using the appropriate constructor. |
1919
| GDXJavaUnusedTag | Unused class tag | Looks for unused class tags in GDXTag annotations. |
2020
| GDXJsonDuplicateProperty | Duplicate property | Looks for properties which are defined multiple times in the same object. |
@@ -26,7 +26,7 @@
2626
| GDXKotlinNonExistingAsset | Resource doesn't exist | Looks in Java and Kotlin code for usages of resources which don't exist. @GDXAssets annotated elements only. |
2727
| GDXKotlinProfilingCode | Profiling code | Looks for profiling code, which should be disabled before release. |
2828
| GDXKotlinStaticResource | Static resource | Don't make resources static, unless you take care to properly manage them. Static resources can cause problems on Android, because the life-cycle of a static variable is not necessarily the same as the life-cycle of your application.<br /><br />Note that Kotlin top-level properties and properties of object literals and companion objects are compiled to static properties. |
29-
| GDXKotlinTestId | Test/dummy IDs | Looks for the use of some known test IDs. |
29+
| GDXKotlinTestId | Test IDs or dummy IDs | Looks for the use of some known test IDs and dummy IDs. |
3030
| GDXKotlinUnsafeIterator | Use of non-reentrant iterator method | If Collections::allocateIteratorsIterator is false, methods on libGDX collections return the same iterator instance each time the method is called. For nested or multithreaded iteration create a new iterator using the appropriate constructor. |
3131
| GDXKotlinUnusedTag | Unused class tag | Looks for unused class tags in GDXTag annotations. |
3232
| GDXMalformedColorString | Malformed color string | Looks in Skin files for malformed color strings. |
@@ -40,4 +40,4 @@
4040
| GDXSkinDeprecated | Usage of deprecated class/field | Looks for the use of deprecated classes and fields in Skin files. |
4141
| GDXSkinType | Type errors in Skin files | Looks for type errors in Skin files. |
4242
| GDXToplevel | Invalid toplevel value | The toplevel value of a JSON file should be an object. |
43-
| GDXXmlTestId | Test/dummy IDs | Looks for the use of some known test IDs. |
43+
| GDXXmlTestId | Test IDs or dummy IDs | Looks for the use of some known test IDs and dummy IDs. |

src/main/kotlin/com/gmail/blueboxware/libgdxplugin/filetypes/skin/editor/SkinCompletionContributor.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,12 @@ internal class SkinCompletionContributor : CompletionContributor() {
318318

319319
if (elementClass != null && elementClassName != "java.lang.Boolean") {
320320

321-
skinFile.getResources(elementClass, null, stringLiteral, isParentProperty, isParentProperty)
321+
skinFile.getResources(
322+
elementClass,
323+
beforeElement = stringLiteral,
324+
includingSuperClasses = isParentProperty,
325+
includeAll = isParentProperty
326+
)
322327
.forEach { resource ->
323328

324329
val icon =

src/main/kotlin/com/gmail/blueboxware/libgdxplugin/inspections/gradle/GradlePropertiesTestIdsInspection.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.gmail.blueboxware.libgdxplugin.inspections.gradle
22

33
import com.gmail.blueboxware.libgdxplugin.message
44
import com.gmail.blueboxware.libgdxplugin.utils.TEST_ID_MAP
5+
import com.gmail.blueboxware.libgdxplugin.utils.TEST_ID_PREFIXES_MAP
56
import com.gmail.blueboxware.libgdxplugin.utils.isInGradlePropertiesFile
67
import com.intellij.codeInspection.ProblemsHolder
78
import com.intellij.lang.properties.psi.Property
@@ -40,8 +41,8 @@ internal class GradlePropertiesTestIdsInspection : LibGDXGradlePropertiesBaseIns
4041
}
4142

4243
element.value?.let { str ->
43-
for ((key, value) in TEST_ID_MAP) {
44-
if (str.contains(key)) {
44+
for ((key, value) in TEST_ID_MAP + TEST_ID_PREFIXES_MAP) {
45+
if (str.startsWith(key) || str.drop(1).startsWith(key)) {
4546
holder.registerProblem(element, message("testid.problem.descriptor") + ": " + value)
4647
}
4748
}

src/main/kotlin/com/gmail/blueboxware/libgdxplugin/inspections/gradle/GradleTestIdsInspection.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package com.gmail.blueboxware.libgdxplugin.inspections.gradle
22

33
import com.gmail.blueboxware.libgdxplugin.message
4-
import com.gmail.blueboxware.libgdxplugin.utils.TEST_ID_MAP
54
import com.gmail.blueboxware.libgdxplugin.utils.isInGradleBuildFile
5+
import com.gmail.blueboxware.libgdxplugin.utils.isTestId
66
import com.intellij.codeInspection.ProblemsHolder
77
import com.intellij.psi.PsiElementVisitor
88
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor
@@ -39,10 +39,10 @@ internal class GradleTestIdsInspection : LibGDXGradleBaseInspection() {
3939
}
4040

4141
(literal.value as? String)?.let { value ->
42-
if (TEST_ID_MAP.containsKey(value)) {
42+
isTestId(value)?.let {
4343
holder.registerProblem(
4444
literal,
45-
message("testid.problem.descriptor") + ": " + TEST_ID_MAP[value]
45+
message("testid.problem.descriptor") + ": " + it
4646
)
4747
}
4848
}

src/main/kotlin/com/gmail/blueboxware/libgdxplugin/inspections/java/JavaTestIdsInspection.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
package com.gmail.blueboxware.libgdxplugin.inspections.java
1717

1818
import com.gmail.blueboxware.libgdxplugin.message
19-
import com.gmail.blueboxware.libgdxplugin.utils.TEST_ID_MAP
2019
import com.gmail.blueboxware.libgdxplugin.utils.isStringType
20+
import com.gmail.blueboxware.libgdxplugin.utils.isTestId
2121
import com.intellij.codeInspection.ProblemsHolder
2222
import com.intellij.psi.JavaElementVisitor
2323
import com.intellij.psi.PsiLiteralExpression
@@ -35,10 +35,10 @@ internal class JavaTestIdsInspection : LibGDXJavaBaseInspection() {
3535
if (expression is PsiLiteralExpressionImpl && expression.type.isStringType(expression)) {
3636

3737
PsiLiteralUtil.getStringLiteralContent(expression)?.trim().let { value ->
38-
if (TEST_ID_MAP.containsKey(value)) {
38+
isTestId(value)?.let {
3939
holder.registerProblem(
4040
expression,
41-
message("testid.problem.descriptor") + ": " + TEST_ID_MAP[value]
41+
message("testid.problem.descriptor") + ": " + it
4242
)
4343
}
4444
}

src/main/kotlin/com/gmail/blueboxware/libgdxplugin/inspections/kotlin/KotlinTestIdsInspection.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package com.gmail.blueboxware.libgdxplugin.inspections.kotlin
1717

1818
import com.gmail.blueboxware.libgdxplugin.message
19-
import com.gmail.blueboxware.libgdxplugin.utils.TEST_ID_MAP
19+
import com.gmail.blueboxware.libgdxplugin.utils.isTestId
2020
import com.intellij.codeInspection.ProblemsHolder
2121
import org.jetbrains.kotlin.psi.KtLiteralStringTemplateEntry
2222
import org.jetbrains.kotlin.psi.KtVisitorVoid
@@ -30,8 +30,8 @@ internal class KotlinTestIdsInspection : LibGDXKotlinBaseInspection() {
3030
override fun visitLiteralStringTemplateEntry(entry: KtLiteralStringTemplateEntry) {
3131

3232
entry.text.trim().let { value ->
33-
if (TEST_ID_MAP.containsKey(value)) {
34-
holder.registerProblem(entry, message("testid.problem.descriptor") + ": " + TEST_ID_MAP[value])
33+
isTestId(value)?.let {
34+
holder.registerProblem(entry, message("testid.problem.descriptor") + ": " + it)
3535
}
3636
}
3737

src/main/kotlin/com/gmail/blueboxware/libgdxplugin/inspections/xml/XmlTestIdsInspection.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
package com.gmail.blueboxware.libgdxplugin.inspections.xml
1717

1818
import com.gmail.blueboxware.libgdxplugin.message
19-
import com.gmail.blueboxware.libgdxplugin.utils.TEST_ID_MAP
19+
import com.gmail.blueboxware.libgdxplugin.utils.isTestId
2020
import com.intellij.codeInspection.ProblemsHolder
2121
import com.intellij.psi.XmlElementVisitor
2222
import com.intellij.psi.xml.XmlTag
@@ -32,8 +32,8 @@ internal class XmlTestIdsInspection : LibGDXXmlBaseInspection() {
3232

3333
tag.value.trimmedText.let { content ->
3434

35-
if (TEST_ID_MAP.containsKey(content)) {
36-
holder.registerProblem(tag, message("testid.problem.descriptor") + ": " + TEST_ID_MAP[content])
35+
isTestId(content)?.let {
36+
holder.registerProblem(tag, message("testid.problem.descriptor") + ": " + it)
3737
}
3838

3939
}

src/main/kotlin/com/gmail/blueboxware/libgdxplugin/utils/GradleUtils.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import com.intellij.psi.PsiElement
2323
internal fun PsiElement.isInGradleBuildFile() =
2424
FileUtilRt.extensionEquals(containingFile.name, "gradle")
2525

26+
@Suppress("unused")
2627
internal fun PsiElement.isInGradleKotlinBuildFile() =
2728
FileUtilRt.extensionEquals(containingFile.name, "gradle.kts") ||
2829
(FileUtilRt.extensionEquals(containingFile.name, "gradle.kt")

src/main/kotlin/com/gmail/blueboxware/libgdxplugin/utils/TestIdMap.kt

Lines changed: 62 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -15,56 +15,72 @@
1515
*/
1616
package com.gmail.blueboxware.libgdxplugin.utils
1717

18-
val TEST_ID_MAP = mapOf(
18+
fun isTestId(string: String?): String? {
19+
if (string in TEST_ID_MAP) {
20+
return TEST_ID_MAP[string]
21+
}
22+
for ((prefix, description) in TEST_ID_PREFIXES_MAP) {
23+
if (string?.startsWith(prefix) == true) {
24+
return description
25+
}
26+
}
27+
return null
28+
}
1929

20-
"app185a7e71e1714831a49ec7" to "AdColony app id",
21-
"vz06e8c32a037749699e7050" to "AdColony zone id",
22-
"appbdee68ae27024084bb334a" to "AdColony app id",
23-
"vzf8fb4670a60e4a139d01b5" to "AdColony zone id",
24-
"ca-app-pub-3940256099942544/1033173712" to "AdMob interstitial test ad",
25-
"ca-app-pub-3940256099942544/6300978111" to "AdMob banner test ad",
26-
"ca-app-pub-3940256099942544/2247696110" to "AdMob native test ad",
27-
"ca-app-pub-3940256099942544/4411468910" to "AdMob interstitial test ad",
28-
"ca-app-pub-3940256099942544/2934735716" to "AdMob banner test ad",
29-
"ca-app-pub-3940256099942544/3986624511" to "AdMob native test ad",
30-
"4f7b433509b6025804000002" to "ChartBoost app id",
31-
"dd2d41b69ac01b80f443f5b6cf06096d457f82bd" to "ChartBoost app signature",
32-
"4f21c409cd1cb2fb7000001b" to "ChartBoost app id",
30+
31+
internal val TEST_ID_PREFIXES_MAP = mapOf(
32+
33+
"ca-app-pub-3940256099942544/" to "AdMob test ad ID",
34+
"ca-app-pub-3940256099942544~" to "AdMob sample app ID"
35+
)
36+
37+
internal val TEST_ID_MAP = mapOf(
38+
39+
"0ac59b0996d947309c33f59d6676399f" to "MoPub banner unit ID",
40+
"11a17b188668469fb0412708c3d16813" to "MoPub native unit ID",
41+
"12345678901234567890123456789012" to "InMobi account ID",
42+
"1234567890qwerty0987654321qwerty12345" to "InMobi account ID",
43+
"123456789abcdfghjiukljnm09874" to "InMobi account ID",
44+
"12346789pqrstuvwxy987654321pqwr" to "InMobi account ID",
45+
"plid-1431977751489005" to "InMobi placement ID from example code",
46+
"15173ac6d3e54c9389b9a5ddca69b34b" to "MoPub rewarded rich media unit ID",
47+
"1a19654b05694a2385448499f03f48df" to "InMobi account ID",
48+
"23b49916add211e281c11231392559e4" to "MoPub banner unit ID",
49+
"24534e1901884e398f1253216226017e" to "MoPub interstitial unit ID",
50+
"252412d5e9364a05ab77d9396346d73d" to "MoPub mrect unit ID",
51+
"2aae44d2ab91424d9850870af33e5af7" to "MoPub mrect unit ID",
52+
"3aba0056add211e281c11231392559e4" to "MoPub interstitial unit ID",
53+
"4028cb8b2c3a0b45012c406824e800ba" to "InMobi account ID",
54+
"4f117153f5c24fa6a3a92b818a5eb630" to "MoPub interstitial unit ID",
55+
"33BE2250B43518CCDA7DE426D04EE231" to "Dummy test device ID from example code",
56+
"4f21c409cd1cb2fb7000001b" to "ChartBoost app ID",
57+
"4f7b433509b6025804000002" to "ChartBoost app ID",
58+
"58fe200484fbd5b9670000e3" to "Vungle app ID",
59+
"5916309cb46f6b5a3e00009c" to "Vungle app ID",
60+
"76a3fefaced247959582d2d2df6f4757" to "MoPub native unit ID",
61+
"8f000bd5e00246de9c789eed39ff6096" to "MoPub rewarded video unit ID",
62+
"920b6145fb1546cf8b5cf2ac34638bb7" to "MoPub rewarded video unit ID",
3363
"92e2de2fd7070327bdeb54c15a5295309c6fcd2d" to "ChartBoost app signature",
34-
"df19afdaf27f4fb4a2c2b85e2c10bc6a" to "InMobi account id",
35-
"4028cb8b2c3a0b45012c406824e800ba" to "InMobi account id",
36-
"123456789abcdfghjiukljnm09874" to "InMobi account id",
37-
"1234567890qwerty0987654321qwerty12345" to "InMobi account id",
38-
"1a19654b05694a2385448499f03f48df" to "InMobi account id",
39-
"12345678901234567890123456789012" to "InMobi account id",
40-
"12346789pqrstuvwxy987654321pqwr" to "InMobi account id",
64+
"98c29e015e7346bd9c380b1467b33850" to "MoPub rewarded rich media unit ID",
65+
"DEFAULT32590" to "Vungle placement ID",
66+
"DEFAULT87043" to "Vungle placement ID",
4167
"E621E1F8-C36C-495A-93FC-0C247A3E6E5F" to "MillennialMedia advertising identifier",
42-
"b195f8dd8ded45fe847ad89ed1d016da" to "MoPub banner unit id",
43-
"252412d5e9364a05ab77d9396346d73d" to "MoPub mrect unit id",
44-
"a8919cca19784497872ae69d48f678e1" to "MoPub leaderboard unit id",
45-
"24534e1901884e398f1253216226017e" to "MoPub interstitial unit id",
46-
"920b6145fb1546cf8b5cf2ac34638bb7" to "MoPub rewarded video unit id",
47-
"15173ac6d3e54c9389b9a5ddca69b34b" to "MoPub rewarded rich media unit id",
48-
"11a17b188668469fb0412708c3d16813" to "MoPub native unit id",
49-
"0ac59b0996d947309c33f59d6676399f" to "MoPub banner unit id",
50-
"23b49916add211e281c11231392559e4" to "MoPub banner unit id",
51-
"2aae44d2ab91424d9850870af33e5af7" to "MoPub mrect unit id",
52-
"d456ea115eec497ab33e02531a5efcbc" to "MoPub leaderboard unit id",
53-
"4f117153f5c24fa6a3a92b818a5eb630" to "MoPub interstitial unit id",
54-
"3aba0056add211e281c11231392559e4" to "MoPub interstitial unit id",
55-
"8f000bd5e00246de9c789eed39ff6096" to "MoPub rewarded video unit id",
56-
"98c29e015e7346bd9c380b1467b33850" to "MoPub rewarded rich media unit id",
57-
"76a3fefaced247959582d2d2df6f4757" to "MoPub native unit id",
58-
"b2b67c2a8c0944eda272ed8e4ddf7ed4" to "MoPub native video unit id",
68+
"PLMT02I05269" to "Vungle placement ID",
69+
"PLMT03R77999" to "Vungle placement ID",
70+
"TESTINT07107" to "Vungle placement ID",
71+
"TESTREW28799" to "Vungle placement ID",
72+
"a8919cca19784497872ae69d48f678e1" to "MoPub leaderboard unit ID",
73+
"app185a7e71e1714831a49ec7" to "AdColony app ID",
74+
"appbdee68ae27024084bb334a" to "AdColony app ID",
75+
"b195f8dd8ded45fe847ad89ed1d016da" to "MoPub banner unit ID",
76+
"b2b67c2a8c0944eda272ed8e4ddf7ed4" to "MoPub native video unit ID",
77+
"d456ea115eec497ab33e02531a5efcbc" to "MoPub leaderboard unit ID",
78+
"dd2d41b69ac01b80f443f5b6cf06096d457f82bd" to "ChartBoost App signature",
79+
"df19afdaf27f4fb4a2c2b85e2c10bc6a" to "InMobi account ID",
5980
"tPdB5-ZZSAu6xC_VxPrC0QEBW5ww3pQYyCbXihbJCEYAxh2VOmrGWxaxWqqe" to "Tapjoy SDK key",
60-
"5916309cb46f6b5a3e00009c" to "Vungle app id",
61-
"DEFAULT32590" to "Vungle placement id",
62-
"TESTREW28799" to "Vungle placement id",
63-
"TESTINT07107" to "Vungle placement id",
64-
"58fe200484fbd5b9670000e3" to "Vungle app id",
65-
"DEFAULT87043" to "Vungle placement id",
66-
"PLMT02I05269" to "Vungle placement id",
67-
"PLMT03R77999" to "Vungle placement id"
81+
"vz06e8c32a037749699e7050" to "AdColony zone ID",
82+
"vzf8fb4670a60e4a139d01b5" to "AdColony zone ID",
83+
"00000000-0000-0000-0000-000000000000" to "Tapjoy app ID from example code"
6884

6985
)
7086

src/main/resources/libgdxplugin.properties

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,11 @@ static.resources.problem.descriptor=Using static resource
164164
static.resources.html.description=Don't make resources static, unless you take care to properly manage them. Static resources can cause problems on Android, because the life-cycle of a static variable is not necessarily the same as the life-cycle of your application.
165165
static.resources.html.description.kotlin.note=<br /><br />Note that Kotlin top-level properties and properties of object literals and companion objects are compiled to static properties.
166166

167-
testid.name=Test/dummy IDs
168-
testid.name.build.gradle=Test/dummy IDs in build.gradle
169-
testid.name.gradle.properties=Test/dummy IDs in gradle.properties
170-
testid.problem.descriptor=This is a test/dummy ID
171-
testid.html.description=Looks for the use of some known test IDs.
167+
testid.name=Test IDs or dummy IDs
168+
testid.name.build.gradle=Test IDs or dummy IDs in build.gradle
169+
testid.name.gradle.properties=Test IDs or dummy IDs in gradle.properties
170+
testid.problem.descriptor=This is a test ID or dummy ID
171+
testid.html.description=Looks for the use of some known test IDs and dummy IDs.
172172

173173
no.opengl.directive.display.name=Missing OpenGL ES directive
174174
no.opengl.directive.problem.descriptor=Missing appropriate OpenGL ES directive

0 commit comments

Comments
 (0)