Skip to content

Findbugs Code Analysis Tool Enable #282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions config/quality/findbugs/android-exclude-filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@
<Match>
<Class name="~.*\.Manifest\$.*"/>
</Match>

<!--Ignore the static App.java instance initialization-->
<Match>
<Class name="com.mifos.App"/>
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" />
</Match>

<Match>
<Bug pattern="DM_DEFAULT_ENCODING" />
</Match>

<!-- All bugs in test classes, except for JUnit-specific bugs -->
<Match>
<Class name="~.*\.*Test" />
Expand Down
60 changes: 30 additions & 30 deletions config/quality/quality.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

apply plugin: 'checkstyle'
//apply plugin: 'findbugs'
apply plugin: 'findbugs'
apply plugin: 'pmd'

dependencies {
Expand All @@ -21,7 +21,7 @@ dependencies {
def qualityConfigDir = "$project.rootDir/config/quality";
def reportsDir = "$project.buildDir/reports"

check.dependsOn 'checkstyle', 'pmd'
check.dependsOn 'checkstyle', 'findbugs', 'pmd'

task checkstyle(type: Checkstyle, group: 'Verification', description: 'Runs code style checks') {
configFile file("$qualityConfigDir/checkstyle/checkstyle-config.xml")
Expand All @@ -38,34 +38,34 @@ task checkstyle(type: Checkstyle, group: 'Verification', description: 'Runs code
classpath = files( )
}

//task findbugs(type: FindBugs,
// group: 'Verification',
// description: 'Inspect java bytecode for bugs',
// dependsOn: ['compileDebugSources','compileReleaseSources']) {
//
// ignoreFailures = false
// effort = "max"
// reportLevel = "high"
// excludeFilter = new File("$qualityConfigDir/findbugs/android-exclude-filter.xml")
// classes = files("$project.rootDir/app/build/intermediates/classes")
//
// source 'src'
// include '**/*.java'
// exclude '**/gen/**'
//
// reports {
// xml.enabled = true
// html.enabled = false
// xml {
// destination "$reportsDir/findbugs/findbugs.xml"
// }
// html {
// destination "$reportsDir/findbugs/findbugs.html"
// }
// }
//
// classpath = files()
//}
task findbugs(type: FindBugs,
group: 'Verification',
description: 'Inspect java bytecode for bugs',
dependsOn: ['compileDebugSources','compileReleaseSources']) {

ignoreFailures = false
effort = "max"
reportLevel = "high"
excludeFilter = new File("$qualityConfigDir/findbugs/android-exclude-filter.xml")
classes = files("$project.rootDir/mifosng-android/build/intermediates/classes")

source 'src'
include '**/*.java'
exclude '**/gen/**'

reports {
xml.enabled = false
html.enabled = true
xml {
destination "$reportsDir/findbugs/findbugs.xml"
}
html {
destination "$reportsDir/findbugs/findbugs.html"
}
}

classpath = files()
}


task pmd(type: Pmd, group: 'Verification', description: 'Inspect sourcecode for bugs') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public String getMiddlename() {
return middlename;
}

public void setMiddlename(String mobilenumber) {
public void setMiddlename(String middlename) {
this.middlename = middlename;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
*/
public class CollectionListAdapter extends BaseExpandableListAdapter {

public static List<MifosGroup> sMifosGroups = new ArrayList<MifosGroup>();
//Map for RepaymentTransaction<Loan Id, Transaction Amount>
//TODO Check about SparseArray in Android and try to convert Map into SparseArray Implementation
public static Map<Integer, Double> sRepaymentTransactions = new HashMap<Integer, Double>();
public static final Map<Integer, Double> sRepaymentTransactions = new HashMap<Integer,
Double>();
public static List<MifosGroup> sMifosGroups = new ArrayList<MifosGroup>();
Context context;
LayoutInflater layoutInflater;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
public class LoanAccountApproval extends DialogFragment implements MFDatePicker.OnDatePickListener {

public static final String TAG = "LoanAccountApproval";
public static int loanAccountNumber;
public int loanAccountNumber;
View rootView;
@InjectView(R.id.tv_loan_approval_dates)
TextView tv_loan_approval_dates;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
public class LoanAccountDisbursement extends DialogFragment implements MFDatePicker
.OnDatePickListener {

public static int loanAccountNumber;
public final String LOG_TAG = getClass().getSimpleName();
public int loanAccountNumber;
View rootView;
SafeUIBlockingUtility safeUIBlockingUtility;
@InjectView(R.id.tv_loan_disbursement_dates)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public class SavingsAccountApproval extends DialogFragment implements MFDatePick
.OnDatePickListener {

public static final String TAG = "SavingsAccountApproval";
public static int savingsAccountNumber;
public static DepositType savingsAccountType;
public int savingsAccountNumber;
public DepositType savingsAccountType;
View rootView;
@InjectView(R.id.et_s_approval_date)
TextView et_s_approval_date;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ public class ClientDetailsFragment extends ProgressableFragment implements Googl
public static final int CONNECTION_FAILURE_RESOLUTION_REQUEST = 9000;
// Intent response codes. Each response code must be a unique integer.
private static final int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 1;
public static int clientId;
public static List<DataTable> clientDataTables = new ArrayList<>();
private final String TAG = ClientDetailsFragment.class.getSimpleName();
public int clientId;
public List<DataTable> clientDataTables = new ArrayList<>();
List<Charges> chargesList = new ArrayList<Charges>();
@InjectView(R.id.tv_fullName)
TextView tv_fullName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@
*/
public class GroupDetailsFragment extends ProgressableFragment {

public static int groupId;
public static List<DataTable> clientDataTables = new ArrayList<>();
public final String LOG_TAG = getClass().getSimpleName();
private final String TAG = GroupDetailsFragment.class.getSimpleName();
public int groupId;
public List<DataTable> clientDataTables = new ArrayList<>();
@InjectView(R.id.tv_groupsName)
TextView tv_fullName;
@InjectView(R.id.tv_groupexternalId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public class LoanAccountSummaryFragment extends ProgressableFragment {
private static final int ACTION_APPROVE_LOAN = 0;
private static final int ACTION_DISBURSE_LOAN = 1;
private static final int TRANSACTION_REPAYMENT = 2;
public static int loanAccountNumber;
public static List<DataTable> loanDataTables = new ArrayList<DataTable>();
public int loanAccountNumber;
public List<DataTable> loanDataTables = new ArrayList<DataTable>();
@InjectView(R.id.view_status_indicator)
View view_status_indicator;
@InjectView(R.id.tv_clientName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public class SavingsAccountSummaryFragment extends ProgressableFragment {
public static final int MENU_ITEM_DOCUMENTS = 1004;
private static final int ACTION_APPROVE_SAVINGS = 4;
private static final int ACTION_ACTIVATE_SAVINGS = 5;
public static int savingsAccountNumber;
public static DepositType savingsAccountType;
public static List<DataTable> savingsAccountDataTables = new ArrayList<DataTable>();
public int savingsAccountNumber;
public DepositType savingsAccountType;
public List<DataTable> savingsAccountDataTables = new ArrayList<DataTable>();
@InjectView(R.id.tv_clientName)
TextView tv_clientName;
@InjectView(R.id.quickContactBadge_client)
Expand Down