Skip to content

Commit b537f7d

Browse files
PHEE-307 Applied formatting and styling (#72)
* Resolved conflicts * Applied formatting and styling Added licence file * Added license file
1 parent b894895 commit b537f7d

83 files changed

Lines changed: 2414 additions & 1412 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
# - slack/notify:
2323
# event: pass
2424
# template: basic_success_1
25-
- run: ./gradlew clean bootJar
25+
- run: ./gradlew clean bootJar
2626
- aws-ecr/build-and-push-image:
2727
aws-access-key-id: AWS_ACCESS_KEY_ID
2828
aws-secret-access-key: AWS_SECRET_ACCESS_KEY
@@ -33,7 +33,7 @@ jobs:
3333
repo: phee-bulk-processor
3434
repo-scan-on-push: true
3535
role-arn: arn:aws:iam::419830066942:role/CustomAdmin
36-
tag: latest
36+
tag: latest
3737
# - run: ./gradlew cucumberCli
3838
# run tests! Slack Success/Fail Notification Step
3939
#- run: ./gradlew test
@@ -44,4 +44,3 @@ workflows:
4444
context:
4545
- AWS
4646
- slack
47-

LICENSE.md

Lines changed: 373 additions & 0 deletions
Large diffs are not rendered by default.

build.gradle

Lines changed: 158 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ plugins {
66
id 'java'
77
id 'maven-publish'
88
id 'eclipse'
9+
id 'checkstyle'
910
id 'org.springframework.boot' version '2.6.2'
11+
id 'com.diffplug.spotless' version '6.19.0'
12+
id 'com.github.hierynomus.license' version '0.16.1'
13+
id 'com.github.jk1.dependency-license-report' version '2.1'
1014
}
1115

1216
repositories {
1317
// mavenLocal()
1418
maven {
1519
url = uri('https://repo.maven.apache.org/maven2')
16-
1720
}
1821
maven {
1922
url "https://fynarfin.jfrog.io/artifactory/fyn-libs-release-local"
@@ -24,6 +27,53 @@ repositories {
2427
}
2528
}
2629

30+
apply plugin:'com.diffplug.spotless'
31+
spotless {
32+
format 'misc', {
33+
target '**/*.md', '**/*.properties', '**/.gitignore', '**/.openapi-generator-ignore', '**/*.yml', '**/*.xml', '**/**.json', '**/*.sql'
34+
targetExclude '**/build/**', '**/bin/**', '**/.settings/**', '**/.idea/**', '**/.gradle/**', '**/gradlew.bat', '**/licenses/**', '**/banner.txt', '.vscode/**'
35+
indentWithSpaces(4)
36+
endWithNewline()
37+
trimTrailingWhitespace()
38+
}
39+
40+
groovyGradle {
41+
target '*.gradle', '**/*.gradle'
42+
targetExclude '**/build/**'
43+
greclipse()
44+
indentWithSpaces(4)
45+
endWithNewline()
46+
trimTrailingWhitespace()
47+
}
48+
lineEndings 'UNIX'
49+
}
50+
// Configuration for Gradle license plug-in
51+
// https://github.com/hierynomus/license-gradle-plugin
52+
license {
53+
header rootProject.file("$rootDir/LICENSE.md")
54+
excludes([
55+
"**/gradlew*",
56+
"**/git.properties",
57+
"**/*.html",
58+
"**/templates/**",
59+
"**/features/**",
60+
"**/results/**",
61+
"**/package-info.java",
62+
"**/keystore.jks",
63+
"**/legacy-docs/**",
64+
"**/banner.txt",
65+
"**/build.gradle.mustache",
66+
"**/pom.mustache",
67+
"**/avro/**/*.java",
68+
"**/org/apache/fineract/client/**/*.java"
69+
])
70+
strictCheck true
71+
}
72+
73+
licenseReport {
74+
outputDir = "$projectDir/licenses"
75+
}
76+
2777
ext {
2878
camelVersion = '3.4.0'
2979
springBootVersion = '2.6.2'
@@ -72,12 +122,119 @@ dependencies {
72122
implementation 'org.apache.commons:commons-io:1.3.2'
73123
implementation "org.projectlombok:lombok:$lambokVersion"
74124
annotationProcessor "org.projectlombok:lombok:$lambokVersion"
125+
checkstyle 'com.puppycrawl.tools:checkstyle:10.9.3'
126+
checkstyle 'com.github.sevntu-checkstyle:sevntu-checks:1.44.1'
127+
implementation 'com.diffplug.gradle.spotless:spotless:2.4.1'
75128

76129
// miscellaneous test dependency
77130
testImplementation "com.google.truth:truth:1.1.3"
78131
testImplementation 'com.google.code.gson:gson:2.9.0'
79132
}
80133

134+
configure(this) {
135+
// NOTE: order matters!
136+
apply plugin: 'java'
137+
apply plugin: 'idea'
138+
apply plugin: 'eclipse'
139+
apply plugin: 'checkstyle'
140+
apply plugin: 'com.diffplug.spotless'
141+
apply plugin: 'com.github.hierynomus.license'
142+
apply plugin: 'project-report'
143+
apply plugin: 'com.github.jk1.dependency-license-report'
144+
configurations {
145+
implementation.setCanBeResolved(true)
146+
api.setCanBeResolved(true)
147+
}
148+
tasks.withType(JavaCompile) {
149+
options.compilerArgs += [
150+
"-Xlint:unchecked",
151+
"-Xlint:cast",
152+
"-Xlint:auxiliaryclass",
153+
"-Xlint:deprecation",
154+
"-Xlint:dep-ann",
155+
"-Xlint:divzero",
156+
"-Xlint:empty",
157+
"-Xlint:exports",
158+
"-Xlint:fallthrough",
159+
"-Xlint:finally",
160+
"-Xlint:module",
161+
"-Xlint:opens",
162+
"-Xlint:options",
163+
"-Xlint:overloads",
164+
"-Xlint:overrides",
165+
"-Xlint:path",
166+
"-Xlint:processing",
167+
"-Xlint:removal",
168+
"-Xlint:requires-automatic",
169+
"-Xlint:requires-transitive-automatic",
170+
"-Xlint:try",
171+
"-Xlint:varargs",
172+
"-Xlint:preview",
173+
"-Xlint:static",
174+
// -Werror needs to be disabled because EclipseLink's static weaving doesn't generate warning-free code
175+
// and during an IntelliJ recompilation, it fails
176+
//"-Werror",
177+
"-Xmaxwarns",
178+
1500,
179+
"-Xmaxerrs",
180+
1500
181+
]
182+
options.deprecation = true
183+
}
184+
// Configuration for the spotless plugin
185+
// https://github.com/diffplug/spotless/tree/main/plugin-gradle
186+
spotless {
187+
java {
188+
targetExclude '**/build/**', '**/bin/**', '**/out/**'
189+
importOrder() //sort imports alphabetically
190+
removeUnusedImports()
191+
eclipse().configFile "$rootDir/config/bulk-formatter.xml"
192+
endWithNewline()
193+
trimTrailingWhitespace()
194+
// Enforce style modifier order
195+
custom 'Modifier ordering', {
196+
def modifierRanking = [
197+
public : 1,
198+
protected : 2,
199+
private : 3,
200+
abstract : 4,
201+
default : 5,
202+
static : 6,
203+
final : 7,
204+
transient : 8,
205+
volatile : 9,
206+
synchronized: 10,
207+
native : 11,
208+
strictfp : 12]
209+
// Find any instance of multiple modifiers. Lead with a non-word character to avoid
210+
// accidental matching against for instance, "an alternative default value"
211+
it.replaceAll(/\W(?:public |protected |private |abstract |default |static |final |transient |volatile |synchronized |native |strictfp ){2,}/, {
212+
// Do not replace the leading non-word character. Identify the modifiers
213+
it.replaceAll(/(?:public |protected |private |abstract |default |static |final |transient |volatile |synchronized |native |strictfp ){2,}/, {
214+
// Sort the modifiers according to the ranking above
215+
it.split().sort({ modifierRanking[it] }).join(' ') + ' '
216+
}
217+
)
218+
}
219+
)
220+
}
221+
}
222+
lineEndings 'UNIX'
223+
}
224+
// If we are running Gradle within Eclipse to enhance classes,
225+
// set the classes directory to point to Eclipse's default build directory
226+
if (project.hasProperty('env') && project.getProperty('env') == 'eclipse') {
227+
sourceSets.main.java.outputDir = file("$projectDir/bin/main")
228+
}
229+
// Configuration for the Checkstyle plugin
230+
// https://docs.gradle.org/current/userguide/checkstyle_plugin.html
231+
dependencies {
232+
checkstyle 'com.puppycrawl.tools:checkstyle:10.3.1'
233+
checkstyle 'com.github.sevntu-checkstyle:sevntu-checks:1.42.0'
234+
}
235+
}
236+
237+
81238
group = 'org.mifos'
82239
version = '0.0.1-SNAPSHOT'
83240
description = 'ph-ee-processor-bulk'

config/bulk-cleanup.xml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
3+
<profiles version="2">
4+
<profile kind="CleanUpProfile" name="bulkprofile" version="2">
5+
<setting id="cleanup.use_autoboxing" value="false"/>
6+
<setting id="cleanup.qualify_static_method_accesses_with_declaring_class" value="false"/>
7+
<setting id="cleanup.always_use_this_for_non_static_method_access" value="false"/>
8+
<setting id="cleanup.organize_imports" value="true"/>
9+
<setting id="cleanup.remove_trailing_whitespaces_ignore_empty" value="false"/>
10+
<setting id="cleanup.use_directly_map_method" value="false"/>
11+
<setting id="cleanup.format_source_code_changes_only" value="false"/>
12+
<setting id="cleanup.qualify_static_field_accesses_with_declaring_class" value="false"/>
13+
<setting id="cleanup.add_generated_serial_version_id" value="false"/>
14+
<setting id="cleanup.remove_redundant_semicolons" value="false"/>
15+
<setting id="cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class" value="true"/>
16+
<setting id="cleanup.remove_redundant_type_arguments" value="false"/>
17+
<setting id="cleanup.remove_unused_imports" value="true"/>
18+
<setting id="cleanup.insert_inferred_type_arguments" value="false"/>
19+
<setting id="cleanup.make_private_fields_final" value="true"/>
20+
<setting id="cleanup.use_lambda" value="true"/>
21+
<setting id="cleanup.simplify_lambda_expression_and_method_ref" value="false"/>
22+
<setting id="cleanup.always_use_blocks" value="true"/>
23+
<setting id="cleanup.use_this_for_non_static_field_access_only_if_necessary" value="false"/>
24+
<setting id="cleanup.sort_members_all" value="false"/>
25+
<setting id="cleanup.remove_trailing_whitespaces_all" value="true"/>
26+
<setting id="cleanup.add_missing_annotations" value="true"/>
27+
<setting id="cleanup.remove_unnecessary_array_creation" value="false"/>
28+
<setting id="cleanup.always_use_this_for_non_static_field_access" value="true"/>
29+
<setting id="cleanup.make_parameters_final" value="true"/>
30+
<setting id="cleanup.sort_members" value="false"/>
31+
<setting id="cleanup.remove_private_constructors" value="true"/>
32+
<setting id="cleanup.always_use_parentheses_in_expressions" value="false"/>
33+
<setting id="cleanup.remove_unused_local_variables" value="false"/>
34+
<setting id="cleanup.convert_to_enhanced_for_loop" value="false"/>
35+
<setting id="cleanup.remove_unused_private_fields" value="true"/>
36+
<setting id="cleanup.remove_redundant_modifiers" value="false"/>
37+
<setting id="cleanup.never_use_blocks" value="false"/>
38+
<setting id="cleanup.number_suffix" value="false"/>
39+
<setting id="cleanup.add_missing_deprecated_annotations" value="true"/>
40+
<setting id="cleanup.use_this_for_non_static_field_access" value="true"/>
41+
<setting id="cleanup.remove_unnecessary_nls_tags" value="true"/>
42+
<setting id="cleanup.qualify_static_member_accesses_through_instances_with_declaring_class" value="true"/>
43+
<setting id="cleanup.add_missing_nls_tags" value="false"/>
44+
<setting id="cleanup.remove_unnecessary_casts" value="true"/>
45+
<setting id="cleanup.use_unboxing" value="false"/>
46+
<setting id="cleanup.use_blocks_only_for_return_and_throw" value="false"/>
47+
<setting id="cleanup.format_source_code" value="true"/>
48+
<setting id="cleanup.convert_functional_interfaces" value="false"/>
49+
<setting id="cleanup.add_default_serial_version_id" value="true"/>
50+
<setting id="cleanup.remove_unused_private_methods" value="true"/>
51+
<setting id="cleanup.remove_trailing_whitespaces" value="true"/>
52+
<setting id="cleanup.make_type_abstract_if_missing_method" value="false"/>
53+
<setting id="cleanup.add_serial_version_id" value="false"/>
54+
<setting id="cleanup.use_this_for_non_static_method_access" value="true"/>
55+
<setting id="cleanup.use_this_for_non_static_method_access_only_if_necessary" value="true"/>
56+
<setting id="cleanup.use_anonymous_class_creation" value="false"/>
57+
<setting id="cleanup.add_missing_override_annotations_interface_methods" value="true"/>
58+
<setting id="cleanup.remove_unused_private_members" value="false"/>
59+
<setting id="cleanup.make_local_variable_final" value="true"/>
60+
<setting id="cleanup.add_missing_methods" value="true"/>
61+
<setting id="cleanup.never_use_parentheses_in_expressions" value="true"/>
62+
<setting id="cleanup.qualify_static_member_accesses_with_declaring_class" value="true"/>
63+
<setting id="cleanup.push_down_negation" value="false"/>
64+
<setting id="cleanup.use_parentheses_in_expressions" value="false"/>
65+
<setting id="cleanup.add_missing_override_annotations" value="true"/>
66+
<setting id="cleanup.use_blocks" value="true"/>
67+
<setting id="cleanup.make_variable_declarations_final" value="true"/>
68+
<setting id="cleanup.correct_indentation" value="true"/>
69+
<setting id="cleanup.remove_unused_private_types" value="true"/>
70+
</profile>
71+
</profiles>

0 commit comments

Comments
 (0)