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

refactor: Kotlin - fix nullability #12047

Merged
merged 1 commit into from
Aug 19, 2022

Conversation

david-allison
Copy link
Member

This is useful before converting 'Utils.java'

Collection:

  • setUserFlag
  • genCards
  • cardCount
  • emptyCardReport
  • updateFieldCache

BaseSched:

  • remFromDyn

Anki2Importer:

  • _writeDstMedia

How Has This Been Tested?

Unit tested

Checklist

  • You have not changed whitespace unnecessarily (it makes diffs hard to read)
  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • Your code follows the style of the project (e.g. never omit braces in if statements)
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@lukstbit
Copy link
Member

@david-allison All checks are failing.

@lukstbit lukstbit added the Needs Author Reply Waiting for a reply from the original author label Aug 17, 2022
This is before converting 'Utils.java'

**Collection:**

* setUserFlag
* genCards
* cardCount
* emptyCardReport
* updateFieldCache

**BaseSched:**
* remFromDyn

**Anki2Importer:**
* _writeDstMedia
@david-allison david-allison removed the Needs Author Reply Waiting for a reply from the original author label Aug 17, 2022
import com.ichi2.utils.HashUtil
import com.ichi2.utils.HtmlUtils
import com.ichi2.utils.JSONObject
import com.ichi2.utils.*
Copy link
Member

Choose a reason for hiding this comment

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

Seems like this was done by Android Studio, do you want to revert it?

Copy link
Member

Choose a reason for hiding this comment

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

This is apparently a really contentious area.
I read through a couple threads, and this one (with a focus around here pinterest/ktlint#48 (comment)) was informative for me.
It appears that star imports are actually a more Kotlin-y thing (IntelliJ / Android Studio add them by default, the language implementation uses them, and the package is the "unit" of import in Kotlin more than a single file like Java)

So I'm leaning towards not caring about star imports, and ktlint in it's default configuration also does not care, so I'll let this go.

Note that I'm injecting opinion here, it's a matter of taste. Feel free to disagree. If most people disagree, it's possible to configure ktlint to disallow star imports from what I understand, and that's the thing to do so these rules are enforced by tooling not convention

Copy link
Member

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

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

LGTM - long comment on star imports which I'm willing to defer to now - it either gets put into our tooling or we allow them (which would be fine by me)

Passes local re-integration

@mikehardy mikehardy merged commit 8ce99c0 into ankidroid:main Aug 19, 2022
@github-actions github-actions bot added this to the 2.16 release milestone Aug 19, 2022
@david-allison david-allison deleted the fix-utils-deps branch April 7, 2024 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants