Skip to content

Commit

Permalink
Fix lint issue by fixing manifest of cli jar (#646)
Browse files Browse the repository at this point in the history
  • Loading branch information
kageiit authored May 1, 2018
1 parent bf9687f commit 0689a90
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ java_binary(
name='okbuck_lint',
deps=map(lambda x: ":" + x, jars),
blacklist=[
'META-INF',
'org.jetbrains.annotations',
'META-INF/.*\.SF',
'META-INF/.*\.DSA',
'META-INF/.*\.RSA',
],
visibility = ['PUBLIC'],
)
1 change: 0 additions & 1 deletion config/lint/lint.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="LintError" severity="ignore"/>
<issue id="HardcodedDebugMode" severity="ignore"/>
</lint>
6 changes: 3 additions & 3 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
def versions = [
androidPlugin : "3.1.1",
androidTools : "26.0.1",
androidPlugin : "3.1.2",
androidTools : "26.1.2",
butterKnife : "9.0.0-20180416.155017-37",
butterKnifeCompiler: "9.0.0-20180416.155025-37",
butterKnifePlugin : "9.0.0-20180416.155029-37",
dagger : "2.15",
kotlin : "1.2.31",
kotlin : "1.2.40",
leakCanary : "1.5.4",
rocker : "0.23.0",
support : "27.1.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.uber.lint;

import com.android.annotations.NonNull;
import com.android.annotations.Nullable;
import com.android.tools.lint.detector.api.Category;
import com.android.tools.lint.detector.api.Detector;
Expand All @@ -9,17 +8,16 @@
import com.android.tools.lint.detector.api.JavaContext;
import com.android.tools.lint.detector.api.Scope;
import com.android.tools.lint.detector.api.Severity;
import com.intellij.psi.PsiMethod;
import org.jetbrains.uast.UCallExpression;

import java.util.Collections;
import java.util.List;

import lombok.ast.AstVisitor;
import lombok.ast.MethodInvocation;

/**
* Custom Lint Check to prevent useage of System.currentTimeMillis.
*/
public class SystemCurrentTimeMillisDetector extends Detector implements Detector.JavaScanner {
public class SystemCurrentTimeMillisDetector extends Detector implements Detector.UastScanner {

public static final String CHECK_METHOD_TO_EXCLUDE = "currentTimeMillis";
public static final String CHECK_PACKAGE_TO_EXCLUDE = "java.lang.System";
Expand Down Expand Up @@ -50,13 +48,12 @@ public List<String> getApplicableMethodNames() {
* Check that the currentTimeMillis() came from the System package, if so raise an error.
*
* @param context
* @param visitor
* @param node
* @param method
*/
@Override
public void visitMethod(@NonNull JavaContext context, @Nullable AstVisitor visitor,
@NonNull MethodInvocation node) {
public void visitMethod(JavaContext context, UCallExpression node, PsiMethod method) {
String message = "System.currentTimeMillis() should not be used as this can't be easily mocked and tested.";
context.report(ISSUE, node, context.getLocation(node.astName()), message);
context.report(ISSUE, node, context.getLocation(node), message);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.uber.okbuck.kotlin

import android.annotation.SuppressLint
import android.os.Parcelable
import kotlinx.android.parcel.Parcelize

@SuppressLint("ParcelCreator") // https://youtrack.jetbrains.com/issue/KT-19300
@Parcelize
class KotlinParcelable(val name: String) : Parcelable

0 comments on commit 0689a90

Please sign in to comment.