Skip to content

Commit 43776fd

Browse files
committed
Update gradle
1 parent 70d5eeb commit 43776fd

File tree

18 files changed

+312
-306
lines changed

18 files changed

+312
-306
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
google()
55
}
66
dependencies {
7-
classpath 'com.android.tools.build:gradle:3.3.2'
7+
classpath 'com.android.tools.build:gradle:3.4.1'
88
}
99
}
1010

config/pmd-ruleset.xml

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,42 @@
44
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
55
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd">
66

7-
<description>Custom ruleset for ribot Android application</description>
7+
<description>Custom rules to this project</description>
88

99
<exclude-pattern>.*/R.java</exclude-pattern>
1010
<exclude-pattern>.*/gen/.*</exclude-pattern>
1111

12-
<rule ref="rulesets/java/android.xml" />
13-
<rule ref="rulesets/java/clone.xml" />
14-
<rule ref="rulesets/java/finalizers.xml" />
15-
<rule ref="rulesets/java/imports.xml">
16-
<!-- Espresso is designed this way !-->
17-
<exclude name="TooManyStaticImports" />
18-
</rule>
19-
<rule ref="rulesets/java/logging-java.xml">
20-
<!-- This rule wasn't working properly and given errors in every var call info -->
21-
<exclude name="GuardLogStatementJavaUtil" />
22-
</rule>
23-
<rule ref="rulesets/java/braces.xml">
24-
<!-- We allow single line if's without braces -->
25-
<exclude name="IfStmtsMustUseBraces" />
26-
</rule>
27-
<rule ref="rulesets/java/strings.xml" >
28-
<!-- Exclude because causes problems with SQL Strings that usually require duplication -->
29-
<exclude name="AvoidDuplicateLiterals"/>
12+
<!-- Excluded temporarily -->
13+
<exclude-pattern>.*/*Test.java</exclude-pattern>
14+
<exclude-pattern>.*/*Stub.java</exclude-pattern>
15+
16+
<rule ref="category/java/errorprone.xml">
17+
<!-- Excluded temporarily -->
18+
<exclude name="AvoidDuplicateLiterals" />
19+
<exclude name="DataflowAnomalyAnalysis" />
20+
<exclude name="AvoidLiteralsInIfCondition" />
21+
<exclude name="CompareObjectsWithEquals" />
3022
</rule>
31-
<rule ref="rulesets/java/basic.xml" />
32-
<rule ref="rulesets/java/naming.xml">
33-
<exclude name="AbstractNaming" />
23+
<rule ref="category/java/bestpractices.xml" />
24+
<rule ref="category/java/codestyle.xml">
25+
<exclude name="TooManyStaticImports" />
3426
<exclude name="LongVariable" />
35-
<exclude name="ShortMethodName" />
36-
<exclude name="ShortVariable" />
37-
<exclude name="ShortClassName" />
3827
<exclude name="VariableNamingConventions" />
28+
<exclude name="OnlyOneReturn" />
29+
</rule>
30+
<rule ref="category/java/performance.xml" />
31+
<rule ref="category/java/multithreading.xml" />
32+
<rule ref="category/java/design.xml">
33+
<exclude name="TooManyFields" />
34+
<exclude name="TooManyMethods" />
35+
<exclude name="ExcessivePublicCount" />
36+
<exclude name="AvoidThrowingNullPointerException" />
37+
38+
<!-- Excluded temporarily -->
39+
<exclude name="CyclomaticComplexity" />
40+
<exclude name="NPathComplexity" />
41+
<exclude name="ExcessiveClassLength" />
42+
<exclude name="GodClass" />
43+
<exclude name="LawOfDemeter" />
3944
</rule>
4045
</ruleset>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Oct 19 13:58:29 CEST 2018
1+
#Mon May 20 17:36:56 IST 2019
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

library/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ android {
2323
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2424
}
2525
}
26+
lintOptions {
27+
abortOnError true
28+
ignoreWarnings false
29+
}
2630
}
2731

2832
dependencies {

library/build_files/android-release-aar.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ task zipRelease(type: Zip) {
4242
archiveName "release-${version}.zip"
4343
}
4444

45-
task generateRelease << {
46-
println "Release ${version} can be found at ${localReleaseDest}/"
47-
println "Release ${version} zipped can be found ${buildDir}/release-${version}.zip"
45+
task generateRelease {
46+
doLast {
47+
println "Release ${version} can be found at ${localReleaseDest}/"
48+
println "Release ${version} zipped can be found ${buildDir}/release-${version}.zip"
49+
}
4850
}
4951

5052
generateRelease.dependsOn(uploadArchives)
Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
apply plugin: 'checkstyle'
22
apply plugin: 'pmd'
3-
apply plugin: 'findbugs'
43

5-
check.dependsOn 'checkstyle', 'pmd', 'findbugs'
4+
check.dependsOn 'checkstyle', 'pmd'
65

76
task checkstyle(type: Checkstyle) {
87
description 'Checks if the code adheres to a coding standard'
@@ -32,26 +31,6 @@ task pmd(type: Pmd) {
3231
}
3332
}
3433

35-
task findbugs(type: FindBugs, dependsOn:"assembleDebug") {
36-
description 'Looks for bugs'
37-
group 'verification'
38-
39-
effort = "max"
40-
reportLevel = "high"
41-
42-
classes = files("$project.buildDir/intermediates/javac/debug/compileDebugJavaWithJavac/classes/")
43-
classpath = files()
44-
45-
source 'src'
46-
include '**/*.java'
47-
exclude '**/gen/**'
48-
49-
reports {
50-
xml.enabled = false
51-
html.enabled = true
52-
}
53-
}
54-
5534
dependencies {
56-
checkstyle "com.puppycrawl.tools:checkstyle:8.17"
35+
checkstyle "com.puppycrawl.tools:checkstyle:8.18"
5736
}

library/src/main/java/io/github/luizgrp/sectionedrecyclerviewadapter/Section.java

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* Abstract Section to be used with {@link SectionedRecyclerViewAdapter}.
1010
*/
11-
@SuppressWarnings({"WeakerAccess", "PMD.AvoidFieldNameMatchingMethodName"})
11+
@SuppressWarnings("WeakerAccess")
1212
public abstract class Section {
1313

1414
public enum State {
@@ -22,7 +22,9 @@ public enum State {
2222

2323
private boolean visible = true;
2424

25+
@SuppressWarnings({"PMD.BeanMembersShouldSerialize", "PMD.AvoidFieldNameMatchingMethodName"})
2526
private boolean hasHeader;
27+
@SuppressWarnings({"PMD.BeanMembersShouldSerialize", "PMD.AvoidFieldNameMatchingMethodName"})
2628
private boolean hasFooter;
2729

2830
@LayoutRes
@@ -49,7 +51,7 @@ public enum State {
4951
*
5052
* @param sectionParameters section parameters
5153
*/
52-
public Section(SectionParameters sectionParameters) {
54+
public Section(final SectionParameters sectionParameters) {
5355
this.itemResourceId = sectionParameters.itemResourceId;
5456
this.headerResourceId = sectionParameters.headerResourceId;
5557
this.footerResourceId = sectionParameters.footerResourceId;
@@ -63,16 +65,16 @@ public Section(SectionParameters sectionParameters) {
6365
this.failedViewWillBeProvided = sectionParameters.failedViewWillBeProvided;
6466
this.emptyViewWillBeProvided = sectionParameters.emptyViewWillBeProvided;
6567

66-
this.hasHeader = (this.headerResourceId != null) || this.headerViewWillBeProvided;
67-
this.hasFooter = (this.footerResourceId != null) || this.footerViewWillBeProvided;
68+
this.hasHeader = this.headerResourceId != null || this.headerViewWillBeProvided;
69+
this.hasFooter = this.footerResourceId != null || this.footerViewWillBeProvided;
6870
}
6971

7072
/**
7173
* Set the State of this Section.
7274
*
7375
* @param state state of this section
7476
*/
75-
public final void setState(State state) {
77+
public final void setState(final State state) {
7678
switch (state) {
7779
case LOADING:
7880
if (loadingResourceId == null && !loadingViewWillBeProvided) {
@@ -120,7 +122,7 @@ public final boolean isVisible() {
120122
*
121123
* @param visible true if this Section is visible
122124
*/
123-
public final void setVisible(boolean visible) {
125+
public final void setVisible(final boolean visible) {
124126
this.visible = visible;
125127
}
126128

@@ -138,7 +140,7 @@ public final boolean hasHeader() {
138140
*
139141
* @param hasHeader true if this Section has a header
140142
*/
141-
public final void setHasHeader(boolean hasHeader) {
143+
public final void setHasHeader(final boolean hasHeader) {
142144
this.hasHeader = hasHeader;
143145
}
144146

@@ -156,7 +158,7 @@ public final boolean hasFooter() {
156158
*
157159
* @param hasFooter true if this Section has a footer
158160
*/
159-
public final void setHasFooter(boolean hasFooter) {
161+
public final void setHasFooter(final boolean hasFooter) {
160162
this.hasFooter = hasFooter;
161163
}
162164

@@ -286,7 +288,7 @@ public final Integer getEmptyResourceId() {
286288
* @param holder ViewHolder for the Content of this Section
287289
* @param position position of the item in the Section, not in the RecyclerView
288290
*/
289-
public final void onBindContentViewHolder(RecyclerView.ViewHolder holder, int position) {
291+
public final void onBindContentViewHolder(final RecyclerView.ViewHolder holder, final int position) {
290292
switch (state) {
291293
case LOADING:
292294
onBindLoadingViewHolder(holder);
@@ -348,7 +350,7 @@ public final int getSectionItemsTotal() {
348350
* @param parent The parent view. Note that there is no need to attach the new view.
349351
* @return View for an Item of this Section.
350352
*/
351-
public View getItemView(@SuppressWarnings("unused") ViewGroup parent) {
353+
public View getItemView(@SuppressWarnings("unused") final ViewGroup parent) {
352354
throw new UnsupportedOperationException(
353355
"You need to implement getItemView() if you set itemViewWillBeProvided");
354356
}
@@ -376,7 +378,7 @@ public View getItemView(@SuppressWarnings("unused") ViewGroup parent) {
376378
* @param parent The parent view. Note that there is no need to attach the new view.
377379
* @return View for the Header of this Section.
378380
*/
379-
public View getHeaderView(@SuppressWarnings("unused") ViewGroup parent) {
381+
public View getHeaderView(@SuppressWarnings("unused") final ViewGroup parent) {
380382
throw new UnsupportedOperationException(
381383
"You need to implement getHeaderView() if you set headerViewWillBeProvided");
382384
}
@@ -387,7 +389,7 @@ public View getHeaderView(@SuppressWarnings("unused") ViewGroup parent) {
387389
* @param view View inflated by resource returned by getHeaderResourceId
388390
* @return ViewHolder for the Header of this Section
389391
*/
390-
public RecyclerView.ViewHolder getHeaderViewHolder(View view) {
392+
public RecyclerView.ViewHolder getHeaderViewHolder(final View view) {
391393
return new SectionedRecyclerViewAdapter.EmptyViewHolder(view);
392394
}
393395

@@ -396,7 +398,8 @@ public RecyclerView.ViewHolder getHeaderViewHolder(View view) {
396398
*
397399
* @param holder ViewHolder for the Header of this Section
398400
*/
399-
public void onBindHeaderViewHolder(RecyclerView.ViewHolder holder) {
401+
@SuppressWarnings("PMD.EmptyMethodInAbstractClassShouldBeAbstract")
402+
public void onBindHeaderViewHolder(final RecyclerView.ViewHolder holder) {
400403
// Nothing to bind here.
401404
}
402405

@@ -407,7 +410,7 @@ public void onBindHeaderViewHolder(RecyclerView.ViewHolder holder) {
407410
* @param parent The parent view. Note that there is no need to attach the new view.
408411
* @return View for the Footer of this Section.
409412
*/
410-
public View getFooterView(@SuppressWarnings("unused") ViewGroup parent) {
413+
public View getFooterView(@SuppressWarnings("unused") final ViewGroup parent) {
411414
throw new UnsupportedOperationException(
412415
"You need to implement getFooterView() if you set footerViewWillBeProvided");
413416
}
@@ -418,7 +421,7 @@ public View getFooterView(@SuppressWarnings("unused") ViewGroup parent) {
418421
* @param view View inflated by resource returned by getFooterResourceId
419422
* @return ViewHolder for the Footer of this Section
420423
*/
421-
public RecyclerView.ViewHolder getFooterViewHolder(View view) {
424+
public RecyclerView.ViewHolder getFooterViewHolder(final View view) {
422425
return new SectionedRecyclerViewAdapter.EmptyViewHolder(view);
423426
}
424427

@@ -427,7 +430,8 @@ public RecyclerView.ViewHolder getFooterViewHolder(View view) {
427430
*
428431
* @param holder ViewHolder for the Footer of this Section
429432
*/
430-
public void onBindFooterViewHolder(RecyclerView.ViewHolder holder) {
433+
@SuppressWarnings("PMD.EmptyMethodInAbstractClassShouldBeAbstract")
434+
public void onBindFooterViewHolder(final RecyclerView.ViewHolder holder) {
431435
// Nothing to bind here.
432436
}
433437

@@ -438,7 +442,7 @@ public void onBindFooterViewHolder(RecyclerView.ViewHolder holder) {
438442
* @param parent The parent view. Note that there is no need to attach the new view.
439443
* @return View for the Loading state of this Section.
440444
*/
441-
public View getLoadingView(@SuppressWarnings("unused") ViewGroup parent) {
445+
public View getLoadingView(@SuppressWarnings("unused") final ViewGroup parent) {
442446
throw new UnsupportedOperationException(
443447
"You need to implement getLoadingView() if you set loadingViewWillBeProvided");
444448
}
@@ -449,7 +453,7 @@ public View getLoadingView(@SuppressWarnings("unused") ViewGroup parent) {
449453
* @param view View inflated by resource returned by getItemResourceId
450454
* @return ViewHolder for the Loading state of this Section
451455
*/
452-
public RecyclerView.ViewHolder getLoadingViewHolder(View view) {
456+
public RecyclerView.ViewHolder getLoadingViewHolder(final View view) {
453457
return new SectionedRecyclerViewAdapter.EmptyViewHolder(view);
454458
}
455459

@@ -458,8 +462,8 @@ public RecyclerView.ViewHolder getLoadingViewHolder(View view) {
458462
*
459463
* @param holder ViewHolder for the Loading state of this Section
460464
*/
461-
@SuppressWarnings("EmptyMethod")
462-
public void onBindLoadingViewHolder(RecyclerView.ViewHolder holder) {
465+
@SuppressWarnings({"EmptyMethod", "PMD.EmptyMethodInAbstractClassShouldBeAbstract"})
466+
public void onBindLoadingViewHolder(final RecyclerView.ViewHolder holder) {
463467
// Nothing to bind here.
464468
}
465469

@@ -470,7 +474,7 @@ public void onBindLoadingViewHolder(RecyclerView.ViewHolder holder) {
470474
* @param parent The parent view. Note that there is no need to attach the new view.
471475
* @return View for the Failed state of this Section.
472476
*/
473-
public View getFailedView(@SuppressWarnings("unused") ViewGroup parent) {
477+
public View getFailedView(@SuppressWarnings("unused") final ViewGroup parent) {
474478
throw new UnsupportedOperationException(
475479
"You need to implement getFailedView() if you set failedViewWillBeProvided");
476480
}
@@ -481,7 +485,7 @@ public View getFailedView(@SuppressWarnings("unused") ViewGroup parent) {
481485
* @param view View inflated by resource returned by getItemResourceId
482486
* @return ViewHolder for the Failed of this Section
483487
*/
484-
public RecyclerView.ViewHolder getFailedViewHolder(View view) {
488+
public RecyclerView.ViewHolder getFailedViewHolder(final View view) {
485489
return new SectionedRecyclerViewAdapter.EmptyViewHolder(view);
486490
}
487491

@@ -490,8 +494,8 @@ public RecyclerView.ViewHolder getFailedViewHolder(View view) {
490494
*
491495
* @param holder ViewHolder for the Failed state of this Section
492496
*/
493-
@SuppressWarnings("EmptyMethod")
494-
public void onBindFailedViewHolder(RecyclerView.ViewHolder holder) {
497+
@SuppressWarnings({"EmptyMethod", "PMD.EmptyMethodInAbstractClassShouldBeAbstract"})
498+
public void onBindFailedViewHolder(final RecyclerView.ViewHolder holder) {
495499
// Nothing to bind here.
496500
}
497501

@@ -502,7 +506,7 @@ public void onBindFailedViewHolder(RecyclerView.ViewHolder holder) {
502506
* @param parent The parent view. Note that there is no need to attach the new view.
503507
* @return View for the Empty state of this Section.
504508
*/
505-
public View getEmptyView(@SuppressWarnings("unused") ViewGroup parent) {
509+
public View getEmptyView(@SuppressWarnings("unused") final ViewGroup parent) {
506510
throw new UnsupportedOperationException(
507511
"You need to implement getEmptyView() if you set emptyViewWillBeProvided");
508512
}
@@ -513,7 +517,7 @@ public View getEmptyView(@SuppressWarnings("unused") ViewGroup parent) {
513517
* @param view View inflated by resource returned by getItemResourceId
514518
* @return ViewHolder for the Empty of this Section
515519
*/
516-
public RecyclerView.ViewHolder getEmptyViewHolder(View view) {
520+
public RecyclerView.ViewHolder getEmptyViewHolder(final View view) {
517521
return new SectionedRecyclerViewAdapter.EmptyViewHolder(view);
518522
}
519523

@@ -522,8 +526,8 @@ public RecyclerView.ViewHolder getEmptyViewHolder(View view) {
522526
*
523527
* @param holder ViewHolder for the Empty state of this Section
524528
*/
525-
@SuppressWarnings("EmptyMethod")
526-
public void onBindEmptyViewHolder(RecyclerView.ViewHolder holder) {
529+
@SuppressWarnings({"EmptyMethod", "PMD.EmptyMethodInAbstractClassShouldBeAbstract"})
530+
public void onBindEmptyViewHolder(final RecyclerView.ViewHolder holder) {
527531
// Nothing to bind here.
528532
}
529533
}

0 commit comments

Comments
 (0)