Skip to content

Replace ktlint with ktfmt #699

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

Closed
wants to merge 525 commits into from

Conversation

itsandreramon
Copy link

Closes #116

Description

Replaces ktlint with ktfmt + detekt to keep existing lint checks in place.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Test Plan

Tested manually using Detekt's Gradle task.

Checklist:

Before submitting your PR, please review and check all of the following:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my change is effective
  • New and existing unit tests pass locally with my changes

eyalgu and others added 30 commits April 29, 2020 10:31
* Support non exception errors from fetcher

* revert parital changes to store builder to reduce noise

* finish off diff

* Allow to create a FetcherResult.Error without a Throwable. Add tests

* Add missing funcion and more tests

* lint

* unflake RxFlowableStoreTest

* try to rename FakeFetcher to FakeRxFetcher to (maybe) solve missing codcov

* move SourceOfTruth out of impl package

* Rename accidental change of RxStoreBuilder.fromMaybe back to formSingle

* Introduce Fetcher from MobileNativeFoundation#139

* fix Rx artifact

* delete legacy presistor factory

* fix api file

* move fetcher to be a typealias

* code review comments + clean up documentation

* code review comments

* Update store/src/main/java/com/dropbox/android/external/store4/Fetcher.kt

Co-Authored-By: Yigit Boyar <[email protected]>

* Revert "Update sample app's build.gradle to refer to the externally released version of Store (MobileNativeFoundation#159)"

This reverts commit fc8da86.

* update releasing.md

Co-authored-by: Yigit Boyar <[email protected]>
* Update Kotlin, Coroutines, Rx2, OkHttp, Okio, Gradle.

* Clean up @FlowPreview @ExperimentalCoroutinesApi which are no longer required.
…obileNativeFoundation#181)

* Move Fetcher factories into companion

Fetcher factories were global methods, which made them hard
to discover since IDE cannot easily auto-complete.

This PR moves them into the companion of Fetcher while also
making Fetcher a real interface instead of a typealias.

Even though it is a bit more code for the developer, now they
can easily discover how to create a Fetcher by typing Fetcher.

Fixes: MobileNativeFoundation#167

* make rx methods start w/ from too for consistency

* Rename fether factories to be more clear, hopefully :/

* remove fetch method, use invoke instead

* Make Fetcher.from the one that receives a suspend fun.
Create Fetcher.fromFlow for the flowing version.

Rename both SourceOfTruth builder methods to . Rely on param names to disambiguate

* use .of instead, this seems better to me.

We should probably get rid of StoreBuilder.from and make it
Store.builder()

* fix jvm name for SourceOfTruth.of with flow function

* fix RxSourceOfTruth name to match original class

* specify bounds for FactoryFetcher

* updates per PR review

* update graph per SoT rename

* update rxjava3 APIs as well

These appeared after i rebased, missed them completely.
Also fixed some tests, appearantly IJ parameter name refactor does
not always work

* supress wrong unnecessary cast warning

without this, multicaster cannot resolve to the base StoreResponse type

* upgade gradle, try to fix build by disabling caching

* split subscribers

* resubscribe

Co-authored-by: miken <[email protected]>

Co-authored-by: miken <[email protected]>
…MobileNativeFoundation#180)

* reproduce MobileNativeFoundation#177 and fix reader errors

* dispatch write errors to receiver

Now source of truth can unblock reader while also letting them
know that an error happened while writing. This forces readers
to first dispatch the error then whatever data they have.

I've also added new public WriteException/ReadException classes
to SourceOfTruth so that it is easy to diagnose these problems
when it hits to the developer's code
It currently breaks consumers compiling with Kotlin
1.4-M3 (not sure why).

Added some TODOs to revert back to using Duration.INFINITE
once Store is compiled with Kotlin 1.4

Closes MobileNativeFoundation#188
…n#190)

* Minor cleanup in RealStore.diskNetworkCombined

* add missing comment

* one more if-else -> when

* lint
MobileNativeFoundation#199)

Fix memory leak caused by capturing the user's coroutine context when creating a fetcher
…#194)

* Add StoreResult.NoNewData for empty fetchers.

* handle no SoT case

* update comments
….INFINITE (MobileNativeFoundation#195)

* Update to Kotlin 1.4.0-rc and Coroutines 1.3.8-1.4.0-rc, fix type inference issues.

* Kotlin 1.4.0.

* Coroutines 1.3.9.
renovate bot and others added 13 commits February 22, 2025 15:27
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…veFoundation#683)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…n#684)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…obileNativeFoundation#686)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…to v1.9.20 (MobileNativeFoundation#687)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…o v0.6.2 (MobileNativeFoundation#688)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@itsandreramon
Copy link
Author

I haven't run ktfmt yet, this is just for the setup. need to discuss indent size first

@itsandreramon
Copy link
Author

we should also consider reviewing and enabling some lint rules step by step, as some functions have insane complexities. i had to disable a lot of detekt rules for this to pass.

@matt-ramotar
Copy link
Collaborator

@itsandreramon Thanks for getting this up so quickly! Awesome to see.

  • I don't have an initial preference for google-style vs kotlinlang-style. Can you run with google first and we'll reconsider?
  • Let's introduce Detekt in baseline mode. This PR shouldn't include any logic changes

@itsandreramon
Copy link
Author

we use detekt baseline actually, i just had to disable some rules in order for it to pass. i can remove it though, but detekt will not pass with the current codebase in baseline mode

@itsandreramon itsandreramon marked this pull request as ready for review February 26, 2025 14:00
@matt-ramotar
Copy link
Collaborator

@itsandreramon I don't see any changes to any of the existing baseline.xml files. You went through this? https://detekt.dev/docs/introduction/baseline/

@itsandreramon
Copy link
Author

got you @matt-ramotar

@itsandreramon
Copy link
Author

messed up my branch, created a new PR #700

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Switch from ktlint -> ktfmt