Skip to content
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

style: code formatting and checks in the CI #1120

Merged
merged 13 commits into from Oct 13, 2021
Merged

style: code formatting and checks in the CI #1120

merged 13 commits into from Oct 13, 2021

Conversation

azlekov
Copy link
Contributor

@azlekov azlekov commented Oct 11, 2021

New Pull Request Checklist

Issue Description

Related issue: #1119

Approach

Added Spotless formatter for most types of files in the project (eg. .java, .kt, .xml, .gradle).
Spotless is configured to use ktlint for Kotlin and Google Code Style AOSP for Java.

TODOs before merging

  • Add tests
  • Add changes to documentation (guides, repository pages, in-code descriptions)
  • A changelog entry is created automatically using the pull request title (do not manually add a changelog entry)

@parse-github-assistant
Copy link

parse-github-assistant bot commented Oct 11, 2021

Thanks for opening this pull request!

  • 🎉 We are excited about your hands-on contribution!

@azlekov azlekov changed the title Code formatting and checks in the CI style-ci: code formatting and checks in the CI Oct 11, 2021
@azlekov azlekov changed the title style-ci: code formatting and checks in the CI style: code formatting and checks in the CI Oct 11, 2021
@azlekov azlekov closed this Oct 11, 2021
@azlekov azlekov reopened this Oct 11, 2021
@mtrezza mtrezza closed this Oct 11, 2021
@mtrezza mtrezza reopened this Oct 11, 2021
@codecov
Copy link

codecov bot commented Oct 11, 2021

Codecov Report

Merging #1120 (7d10d58) into master (dd9a9e6) will increase coverage by 0.21%.
The diff coverage is 65.51%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1120      +/-   ##
============================================
+ Coverage     65.06%   65.28%   +0.21%     
- Complexity     2208     2218      +10     
============================================
  Files           122      122              
  Lines          9463     9957     +494     
  Branches       1317     1337      +20     
============================================
+ Hits           6157     6500     +343     
- Misses         2799     2945     +146     
- Partials        507      512       +5     
Impacted Files Coverage Δ
.../src/main/java/com/parse/CacheQueryController.java 5.76% <0.00%> (-1.05%) ⬇️
...c/main/java/com/parse/KnownParseObjectDecoder.java 50.00% <ø> (ø)
parse/src/main/java/com/parse/Lists.java 90.00% <ø> (ø)
parse/src/main/java/com/parse/LocalIdManager.java 68.00% <0.00%> (ø)
...arse/src/main/java/com/parse/LocationNotifier.java 0.00% <0.00%> (ø)
parse/src/main/java/com/parse/LockSet.java 0.00% <0.00%> (ø)
...arse/src/main/java/com/parse/NoObjectsEncoder.java 75.00% <ø> (ø)
parse/src/main/java/com/parse/Numbers.java 19.51% <ø> (ø)
...rc/main/java/com/parse/OfflineQueryController.java 100.00% <ø> (ø)
parse/src/main/java/com/parse/PLog.java 76.66% <ø> (ø)
... and 148 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd9a9e6...7d10d58. Read the comment docs.

@azlekov
Copy link
Contributor Author

azlekov commented Oct 11, 2021

@mtrezza this is now done. Pipeline will fail if the source code is not formatting well. I have update the CONTRIBUTING.md so newcomers are guided what to run to eliminate ping-pong. All the source code is formatted to Google AOSP style guide for Java and ktlint for Kotlin.

.github/workflows/ci.yml Outdated Show resolved Hide resolved
@azlekov azlekov requested a review from mtrezza October 12, 2021 07:25
@azlekov
Copy link
Contributor Author

azlekov commented Oct 12, 2021

@mtrezza whenever your okay and ready feel free to merge.

@mtrezza mtrezza merged commit 2945b30 into parse-community:master Oct 13, 2021
Copy link
Member

@mtrezza mtrezza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@mtrezza mtrezza mentioned this pull request Oct 13, 2021
3 tasks
@azlekov azlekov deleted the issue/1119-add-lint-check-to-ci branch October 13, 2021 12:34
@@ -13,22 +13,53 @@ buildscript {
classpath "org.jacoco:org.jacoco.core:$jacocoVersion"
classpath "com.dicedmelon.gradle:jacoco-android:0.1.5"
classpath "io.freefair.gradle:android-gradle-plugins:4.2.0-m1"
classpath "com.diffplug.spotless:spotless-plugin-gradle:5.16.0"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need this here if it's already defined as plugin below?


task clean(type: Delete) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have you removed the clean task?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spotless which we are using for formatting is defining it.
diffplug/spotless#521

@@ -37,3 +68,13 @@ ext {
minSdkVersion = 16
targetSdkVersion = 30
}

task createSpotlessPreCommitHook() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't compile on my end:

Cannot run program "bash": CreateProcess error=2 The system cannot find the file...

@mobilekosmos
Copy link

Cannot commit in Android Studio after this changes:

Running spotless check > Task :spotlessJava > Task :spotlessJavaApply > Task :spotlessKotlin FAILED Step 'ktlint' found problem in 'ktx\src\main\java\com\parse\ktx\ParseQuery.kt': Error on line: 4, column: 1 Wildcard import java.lang.AssertionError: Error on line: 4, column: 1 Wildcard import at

@parseplatformorg
Copy link

🎉 This pull request has been released in version 2.0.1

@parseplatformorg parseplatformorg added the state:released Released as stable version label Oct 14, 2021
@parseplatformorg
Copy link

🎉 This pull request has been released in version 2.0.1

1 similar comment
@parseplatformorg
Copy link

🎉 This pull request has been released in version 2.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released Released as stable version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants