Skip to content

Enabled linting on Firestore #63

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

Merged
merged 5 commits into from
Oct 9, 2018
Merged

Enabled linting on Firestore #63

merged 5 commits into from
Oct 9, 2018

Conversation

ashwinraghav
Copy link
Contributor

@ashwinraghav ashwinraghav commented Oct 6, 2018

This change whitelists errors thrown by linter that we know about and documents why these are reasonable.
We enable linter.

There are types of linting errors that seem worthy of being fixed.
I have adopted some cookie cutter solution to fix two types of errors:
1) Remove usage of asserts that are unsupported in ART
See: https://android.googlesource.com/platform/tools/base/+/master/lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/AssertDetector.java

2) Replace HashMaps with SparseArrays
Which seemed appropriate based on a rudimentary glance.
See: https://stackoverflow.com/questions/25560629/sparsearray-vs-hashmap

If you feel like these replacements are appropriate, I can replace them at a bunch of more places and enable linting
@wilhuff
Copy link
Contributor

wilhuff commented Oct 6, 2018 via email

@wilhuff
Copy link
Contributor

wilhuff commented Oct 8, 2018

Neither of these changes are really OK:

  • The source for the number encoding is shared with the server, internal, and not third_party so every sync will overwrite these changes
  • The listenTargets map you're replacing is known to get to thousands of entries.

@ashwinraghav
Copy link
Contributor Author

  • The source for the number encoding is shared with the server, internal, and not third_party so every sync will overwrite these changes

Is it acceptable to us that the assert statements do not actually work in the Android Runtime ?

@wilhuff
Copy link
Contributor

wilhuff commented Oct 8, 2018

  • The source for the number encoding is shared with the server, internal, and not third_party so every sync will overwrite these changes

Is it acceptable to us that the assert statements do not actually work in the Android Runtime ?

In principle no, but there's a trade-off to be made. Every write on the backend is going through this code so the likelihood of an android client tripping over this is miniscule. On the other side is having to avoid clobbering this with every update we get from the server.

The only way to "fix" these assertions is to rewrite these in the copybara script.

@ashwinraghav
Copy link
Contributor Author

Ok. Given that we have consciously thought through these errors, I have explicitly whitelisted these cases and in general enabled the linter.
Let me know if this looks reasonable.

@ashwinraghav
Copy link
Contributor Author

/test smoke-tests-debug

@ashwinraghav
Copy link
Contributor Author

/test check

@ashwinraghav
Copy link
Contributor Author

/test smoke-tests-release

Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

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

LGTM

@ashwinraghav ashwinraghav merged commit 3304f41 into master Oct 9, 2018
@ashwinraghav ashwinraghav mentioned this pull request Oct 9, 2018
@vkryachko vkryachko deleted the linting branch January 23, 2019 01:15
@firebase firebase locked and limited conversation to collaborators Oct 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants