Skip to content

Commit

Permalink
squid:S2184 Math operands should be cast before assignment
Browse files Browse the repository at this point in the history
squid:AssignmentInSubExpressionCheck Assignments should not be made from within sub-expressions
squid:SwitchLastCaseIsDefaultCheck 'switch' statements should end with a 'default' clause
squid:S2325 'private' methods that don't access instance data should be 'static'
  • Loading branch information
zeeshanasghar committed Mar 17, 2016
1 parent 72d3708 commit 153c338
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class LogWriter {
private static final Object SAVE_DELETE_LOCK = new Object();
private static final SimpleDateFormat FILE_NAME_FORMATTER = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss.SSS");
private static final SimpleDateFormat TIME_FORMATTER = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static final long OBSOLETE_DURATION = 2 * 24 * 3600 * 1000;
private static final long OBSOLETE_DURATION = 2 * 24 * 3600 * 1000L;

/**
* Save log to file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public static String myProcessName() {
if (sProcessName != null) {
return sProcessName;
}
return sProcessName = obtainProcessName(BlockCanaryCore.getContext().getContext());
sProcessName = obtainProcessName(BlockCanaryCore.getContext().getContext());
return sProcessName;
}
}

Expand Down
6 changes: 4 additions & 2 deletions demo/src/main/java/com/example/blockcanary/DemoFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@ public void onClick(View v) {
double result = compute();
System.out.println(result);
break;
default:
break;
}
}

private double compute() {
private static double compute() {
double result = 0;
for (int i = 0; i < 1000000; ++i) {
result += Math.acos(Math.cos(i));
Expand All @@ -95,7 +97,7 @@ private double compute() {
return result;
}

private void readFile() {
private static void readFile() {
FileInputStream reader = null;
try {
reader = new FileInputStream("/proc/stat");
Expand Down

0 comments on commit 153c338

Please sign in to comment.