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

Port app.get() check from errorprone to lint #4434

Merged
merged 2 commits into from
Dec 8, 2022
Merged

Conversation

vkryachko
Copy link
Member

Motivation: Make sure the check works for kotlin, not only java.

Motivation: Make sure the check works for kotlin, not only java.
@google-oss-bot
Copy link
Contributor

1 Warning
⚠️ Did you forget to add a changelog entry? (Add the 'no-changelog' label to the PR to silence this warning.)

Generated by 🚫 Danger

@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2022

buildSrc Test Results

18 tests   18 ✔️  1m 21s ⏱️
  4 suites    0 💤
  4 files      0

Results for commit 8104bc7.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2022

Unit Test Results

   398 files  ±0     398 suites  ±0   19m 31s ⏱️ +30s
4 752 tests +4  4 729 ✔️ +4  22 💤 ±0  1 ±0 
4 768 runs  +4  4 745 ✔️ +4  22 💤 ±0  1 ±0 

For more details on these failures, see this check.

Results for commit 8104bc7. ± Comparison against base commit eb7480b.

@google-oss-bot
Copy link
Contributor

@google-oss-bot
Copy link
Contributor

Coverage Report 1

Affected Products

  • firebase-database

    Overall coverage changed from 50.22% (eb7480b) to 50.16% (271a1a1) by -0.05%.

    FilenameBase (eb7480b)Merge (271a1a1)Diff
    ViewProcessor.java92.10%91.79%-0.30%
    WebsocketConnection.java35.03%32.77%-2.26%
  • firebase-firestore

    Overall coverage changed from 44.52% (eb7480b) to 44.53% (271a1a1) by +0.00%.

    FilenameBase (eb7480b)Merge (271a1a1)Diff
    DeleteMutation.java90.48%95.24%+4.76%
  • firebase-messaging

    Overall coverage changed from 85.29% (eb7480b) to 85.22% (271a1a1) by -0.08%.

    FilenameBase (eb7480b)Merge (271a1a1)Diff
    FirebaseMessaging.java75.77%77.09%+1.32%
    Metadata.java61.90%57.14%-4.76%
    RequestDeduplicator.java90.00%80.00%-10.00%
  • firebase-storage

    Overall coverage changed from ? (eb7480b) to 85.99% (271a1a1) by ?.

    46 individual files with coverage change

    FilenameBase (eb7480b)Merge (271a1a1)Diff
    ActivityLifecycleListener.java?74.14%?
    AdaptiveStreamBuffer.java?84.62%?
    CancelException.java?100.00%?
    CancellableTask.java?100.00%?
    ControllableTask.java?100.00%?
    DeleteNetworkRequest.java?100.00%?
    DeleteStorageTask.java?100.00%?
    ExponentialBackoffSender.java?86.00%?
    FileDownloadTask.java?80.00%?
    FirebaseStorage.java?83.67%?
    FirebaseStorageComponent.java?100.00%?
    GetDownloadUrlTask.java?96.77%?
    GetMetadataNetworkRequest.java?100.00%?
    GetMetadataTask.java?85.19%?
    GetNetworkRequest.java?100.00%?
    HttpURLConnectionFactory.java?0.00%?
    HttpURLConnectionFactoryImpl.java?50.00%?
    ListNetworkRequest.java?100.00%?
    ListResult.java?100.00%?
    ListTask.java?85.71%?
    NetworkRequest.java?86.60%?
    OnPausedListener.java?0.00%?
    OnProgressListener.java?0.00%?
    ResumableNetworkRequest.java?100.00%?
    ResumableUploadByteRequest.java?90.91%?
    ResumableUploadCancelRequest.java?100.00%?
    ResumableUploadQueryRequest.java?100.00%?
    ResumableUploadStartRequest.java?95.24%?
    Slashes.java?88.24%?
    Sleeper.java?0.00%?
    SleeperImpl.java?100.00%?
    SmartHandler.java?87.50%?
    StorageException.java?65.45%?
    StorageMetadata.java?86.34%?
    StorageReference.java?89.94%?
    StorageReferenceUri.java?100.00%?
    StorageRegistrar.java?100.00%?
    StorageTask.java?84.29%?
    StorageTaskManager.java?100.00%?
    StorageTaskScheduler.java?100.00%?
    StreamDownloadTask.java?88.89%?
    TaskListenerImpl.java?100.00%?
    UpdateMetadataNetworkRequest.java?100.00%?
    UpdateMetadataTask.java?82.14%?
    UploadTask.java?81.79%?
    Util.java?73.24%?

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/FrSX3yRzlr.html

override fun getApplicableMethodNames(): List<String> = listOf("get")

override fun visitMethodCall(context: JavaContext, call: UCallExpression, method: PsiMethod) {
if (!isFirebaseAppGet(method)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

probably as readable as a single conditional (with the one below)

if (withinGetInstance(call)) {
return
}
call.getParentOfType<UMethod>() ?: return
Copy link
Collaborator

Choose a reason for hiding this comment

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

if we only want to check if it exists, IMO it would be easier to read inside an if statement

@rlazo
Copy link
Collaborator

rlazo commented Dec 8, 2022

Besides a couple of nits, LGTM

@google-oss-bot
Copy link
Contributor

Startup Time Report 1

The report is too large (117,070 chars) to be displayed on GitHub. Please check this report on GCS.

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/AGp9EWm8gS/index.html

@vkryachko vkryachko merged commit fa88eee into master Dec 8, 2022
@vkryachko vkryachko deleted the vk.app_get_port branch December 8, 2022 16:40
danasilver added a commit that referenced this pull request Dec 22, 2022
* return exception if modelname is empty (#4226)

* Add "create release PR" github action (#4236)

This implementation:

- Creates the base branch (name is based in user input)
- Creates the release branch (name is based in user input)
- Creates the release.cfg file in the release branch without adding
  any SDK (module) to it.

It can create the branches based on any existing branch of the repo.

* Sync spec tests from web SDK to Android SDK (#4230)

* Update versions (#4238)

* Update versions

* Exclude .github dir from `firebaseContinuousIntegration` paths (#4239)

* Performing IN expansion (#4221)

* WIP: `in` expansion.

* Add composite filter in-expansion test.

* Fix formatting.

* Run in-expansion as part of DNF computation and add tests.

* Add test with nested IN filters with CSI.

* Add tests for other cases.

* typo fix (#4237)

* Firestore: Add test that verifies count query error message when missing index (#4232)

* refactor(functions): update firebase-iid to 21.1.0 (#4225)

* refactor(functions): update firebase-iid to 21.1.0

* Update CHANGELOG.md

* Update CHANGELOG.md

* bump firebase-iid-interop to 17.1.0

* exclude firebase-components from firebase-iid dependency

* Fix Firestore failing to return empty results from the local cache (#4207)

* Remove plexus-utils from firebase-database's test dependency (#4233)

firebase-database only uses StringUtils#repeat in test code, and it is
easy to port repeat method to test file and remove plexus-utils
from test dependency.

Signed-off-by: utzcoz <utzcoz@outlook.com>

Signed-off-by: utzcoz <utzcoz@outlook.com>

* test(functions): fix instrumentation tests (#4249)

* test(functions): fix instrumentation tests

* fix java format

* Fix flakiness in MessagingAnalyticsRoboTest.java (#4259)

Properly reset SharedPreferences test state in between each test.

* Update CHANGELOG entries across several sdks (#4240)

* Fix FAILED_PRECONDITION when writing to a deleted document in a transaction (#4257)

* Fix Javadoc link generation in Dackka (#4258)

* Remove redundant package list

* Implement fix for link transformations

* Set reference path in DackkaPlugin

* Removed accidental dackka diff script

* Remove GenericTypeIndicator in error messages (#4268)

* Early return in getDocumentsMatchingTarget (#4272)

* Early return in getDocumentsMatchingTarget

* Address Feedback

* Upgrade GRPC tp 1.50.2 (#4277)

* Upgrade GRPC tp 1.50.2

* Add changelog for Upgrade GRPC tp 1.50.2

* Add links to changelog

* Add Dackka transform to remove leading groupId in Javadocs (#4278)

* Add groupId removal transform

* Add bug link for dackka exposing the configuration

* Add @CanIgnoreReturnValue to MockInputStreamHelper.injectExceptionAt(int) (#4275)

* Remove `@Deprecated` annotations. (#4289)

* Fix FrameMetrics NPE (#4284)

* Initial version of the build release artifacts workflow. (#4287)

* Initial version of the build release artifacts workflow.

This version of the workflow hardcodes the list of sdks to release to
include Firestore only. Also, generated javadoc is not yet equivalent
to what's generated by the regular release process.

* Prepend 'releases/' to the name of the release branches (#4291)

This will make it easier to identify them and apply restrictions on them.

* Add androidx.annotation package (#4286)

* Add support of macrobenchmark result analysis in fireci (#4285)

* Fix broken code elements in docs (#4292)

* Fix code blocks

* Fix linting in firebase-database

* Fix FirebaseMLDownloader linting

* [Fireperf][AASA] Additional experiments for `_experiment_as_ttid` (#4283)

* predraw and uptimeMillis

* fix send event

* fix dangling variable and naming

* copyright

* fix test

* onStop

* test

* better readability

* comments

* reduce code

* reset

* Deflake `AppStateMonitorTest` (#4294)

* fix flaky test

* word smithing

* Add executor documentation (#4298)

* Wrap &lt and &gt symbols in code blocks (#4299)

* Add action to show a message when merging to the main branch (#4301)

* Add action to show a message when merging to the main branch

* Fail if label 'merge-main-ack' is not present

* Fix multiline hyperlink renders (#4307)

* Replace trace hyperlink with direct link

* Replace timestamp link with non multiline variant

* Add transform to rectify hyperlink bugs in see blocks

* Fix ndk build. (#4311)

* Fix ndk build.

Due to AGP upgrade the crashlytics-trampoline.so file stopped being
included in the resulting AAR, this causes issues on devices with api
29+.

* fix filename

* Revert "Add support of macrobenchmark result analysis in fireci (#4285)" (#4312)

This reverts commit 00d8c72.

* Update executors.md (#4306)

* Switch from ktlint to ktfmt (#4318)

Additionally upgrade google-java-format to latest version.

* Merge executors to master (#4322)

* Add qualifier support to firebase components. (#3180)

* Add qualifier support to firebase components.

Details: go/firebase-component-qualifiers

* fix errorprone error.

* change copyright year.

* Register executors as components. (#4288)

* Register executors as components.

The intent for those is to be used by all Firebase SDKs and forbid
creating their own at will.

* Add copyrights.

* add more copyrights

* ktlintformat

* gJF

* ktlint

* Address review comments.

* Adds generally useful executors (#4305)

Namely, SequentialExecutor and directExecutor.

* Enable strict mode for executors. (#4303)

Any violations would kill the app in debug builds of firebase-common,
and log a warning in release builds. This is done to fail tests that
incorrectly use executors while not affecting 3p apps in release builds.

Additionally correctly set thread priorities in an Android specific way.

* Enable thread pool linter check. (#4297)

* Enable thread pool linter check.

All violations are now suppressed, bugs filed to fix each product.

* ktlint

* Remove init

* Fix copyright

* Replace Doclava with Dackka (#4324)

* Remove restriction on Dackka's Javadoc

* Refactor release plugin to use dackka

* Add support of macrobenchmark result analysis in fireci (#4323)

* Avoid throwing in ForcedSender.sendBlocking (#4293)

* Make ForcedSender.sendBlocking do nothing, instead of throw, when given a wrong Transport type.

This will make it easier to mock Transport in tests. This method is best-effort anyway, so doing nothing instead of throwing is fine.

* Log warning when given wrong type.

* Fix deadlock when handling simultaneous messages. (#4327)

#4315
* Released sendWakefulServiceIntent()'s WakeLock on the main thread instead of within WithinAppServiceConnection to prevent a deadlock trying to acquire the WakeLockHolder.syncObject.

* Update build-release-artifacts.yml (#4354)

Remove unnecessary zip extension

* Improve fireci CLI for macrobenchmark (#4359)

- Output more analysis results
- Close figure after saving to file
- Switch to `redfin` for more consistent results

* Fix warnings in the linter. (#4360)

* Add action to create bom (#4352)

* Add action to create bom

* Use ubuntu-latest

* Update versions and changelogs (#4343)

* Update versions

* Update changelogs

* Update functions changelog

* Update firestore changelog

* update fireperf changelog

* update messaging changelog

* Migrate functions off of UI thread for continuations. (#4364)

* Migrate functions off of UI thread for continuations.

* fixes

* Add changelog

* fix

* fix dep

* Enable dead code elimination for vendored deps. (#4368)

* Set jvm target for kotlin to jvm11 to match java. (#4369)

* Set jvm target for kotlin to jvm11 to match java.

* Fix typo

* Changed protobuf-java to latest version 3.21.9 (#4373)

* Changed protoc and protobuf-java to latest version 3.21.9

* changed protoc version back and only target protobuf-java

* Use dagger in functions. (#4366)

This simplifies injection of firebase components so they don't have to be passed all the way from the registrar into classes that actually use components.

This change adds `+4.22 kB` to the size of the sdk, but is a small enough increase compared to the advantages it provides

* Migrate fireperf content provider to component (#4242)

* Migrate fireperf content provider to component

* Resolve comments

* Collect startup time from init provider

* Limit startup time usage to during init provider initialization

* Pass in startup time in private constructor

* Component dependencies and names

* Ensure FirebasePerfEarly gets initialized before FirebasePerf

* Actually fix merge

* Adjust tests

* Resolve cli tests

* Resolve nullability

* Actually resolving nullability lints

* Formatting

* Adjust privacy and docs

* Hide startup time in the init provider

* Fix error with getting optional component from ComponentContainer

* Fix error with getting optional component from ComponentContainer

* Hide one more method

* Migrate ml to dagger DI. (#4370)

This simplifies injection of firebase components so they don't have to be passed all the way from the registrar into classes that actually use components.

This change adds `+6.58 kB` to the size of the sdk, but is a small enough increase compared to the advantages it provides

* Add examples for new Flow operators in firestore-ktx (#4078)

* Set ndkVersion for Crashlytics NDK SDK. (#4310)

* Remove custom NDK installations (#4378)

* Add documentation, and address/remove some TODOs. (#4274)

* Fix ci tests presubmit to work on all branches. (#4381)

* Add lint check that detects UI thread continuations. (#4363)

* Add lint check that detects UI thread continuations.

* Suppress lint failures pending actual fixes by product teams.

* Fix copyrights (#4386)

* Forbid creating ui thread Handler. (#4385)

* Forbid creating ui thread Handler.

* fix perf tests

* ktfmt

* actually fix perf

* Add workflow triggers for startup time test (#4379)

* Enable for Kotlin Gradle dsl. (#4392)

* Enable for Kotlin Gradle dsl.

Additionally migrate to using a version catalog to simplify dependency
management.

* Fix metalava

* Address review comments

* Migrate RC to common executors. (#4393)

* Allow task subclasses to implement overloads. (#4394)

* Remove unused Executor classes. (#4383)

* Invoke async api for processing startup time request (#4406)

* Upgrade JaCoCo plugin version (#4423)

Fixes the issue where JaCoCo cannot produce coverage files for certain kotlin packages.

See details:
- jacoco/jacoco#1155
- https://youtrack.jetbrains.com/issue/KT-44757

* Refine startup time test app (#4407)

- Force initialize all components
- Include `fire-perf-early` in measurements
- Test only changed products in pull requests

* Initial setup for Github Pages (#4427)

* Add Component documentation (#4429)

* Add components documentation

* switch to light theme

* undo workflow change

* remove direct boot mode reference

* Create scorecards.yml

* Change concurrency group for health metrics test to "github.sha" (#4428)

The problem with "github.ref" was that when two consecutive
commits are pushed to a feature branch (e.g. `master`) around
the same time, the execution of health metrics test for the
second commit will cancel the execution for the first one, and
thus make the metrics measurement for the first commit unavailable.

* Port app.get() check from errorprone to lint (#4434)

* Port app.get() check from errorprone to lint

Motivation: Make sure the check works for kotlin, not only java.

* Add copyrights

* Added more docs (#4437)

* Describe dependencies

* deploy

* fix typo

* fixes

* updates

* toc

* fix

* updates

* configure callouts

* undo deploy from branch

* Apply suggestions from code review

Co-authored-by: Rodrigo Lazo <rlazo@users.noreply.github.com>

Co-authored-by: Rodrigo Lazo <rlazo@users.noreply.github.com>

* Migrate `firebase-appcheck` to use standard executors provided by Firebase Common. (#4431)

* Migrate to use standard executors provided by Firebase Common.

* Update changelog and fix unit test.

* Address review comments.

* Fix unit test.

* Address review comments.

* Fix RC Executor annotation (#4395)

* Integrate `AppCheckProvider`s with Firebase Components. (#4436)

* Integrate `SafetyNetAppCheckProvider` with Firebase Components.

* Suppress warning.

* Integrate DebugAppCheckProvider with Firebase Components.

* Add unit tests for the new registrars.

* Integrate `PlayIntegrityAppCheckProvider` with Firebase Components.

* Add dependency injection docs (#4447)

* Migrate firebase-inappmessaging SDK to go/firebase-android-executors. (#4440)

Migrate firebase-inappmessaging SDK to go/firebase-android-executors.

* Migrate remaining App Check SDKs to go/firebase-android-executors. (#4449)

* Migrate `firebase-appcheck-safetynet` to go/firebase-android-executors.

* Migrate `firebase-appcheck-playintegrity` to go/firebase-android-executors.

* Migrate `firebase-appcheck-debug` to go/firebase-android-executors.

* Remove unnecessary class field from `SafetyNetAppCheckProvider`.

* Update changelogs.

* Migrate core libraries to Gradle Kotlin DSL. (#4452)

* Migrate core libraries to Gradle Kotlin DSL.

* update

* Add functions, fix tests

* fix docs

* fix functions ktx minSdk version.

* Apply suggestions from code review

Co-authored-by: Rodrigo Lazo <rlazo@users.noreply.github.com>

Co-authored-by: Rodrigo Lazo <rlazo@users.noreply.github.com>

* Fix overlay bug leas to patch mutation optimization not being applied (#4442)

* Fix overlay patch bug

* Feedback

* Delete comment

* Add Diff Javadoc workflow (#4426)

* Add diff javadoc workflow

* Minor tweaks

* Revert checkout order change

* Revert incorrect changes

* Modify ChangedModulesTask

* Only compare modified SDKs

* Change build order

* Add fetch depth

* Fix typo

* Only Firebase SDKs

* Move continuations off main thread for App Check SDKs. (#4453)

* Move continuations off main thread for `firebase-appcheck`.

* One more continuation in `firebase-appcheck`.

* Move continuations off main thread for `firebase-appcheck-debug`.

* Rearrange executor order.

* Move continuations off main thread for `firebase-appcheck-safetynet`.

* Move continuations off main thread for `firebase-appcheck-playintegrity`.

* Update changelog.

* Fix `SafetyNetAppCheckProviderTest`.

* Address review comments.

* update mlkitdownloader to use executors (#4382)

* update dagger

* update

* update

* update

* update registrar

* update tests

* Replace tag targets with commits (#4460)

* Fix typo in comments. (#4462)

* Use Firebase executors for realtime.

* Format java.

Signed-off-by: utzcoz <utzcoz@outlook.com>
Co-authored-by: argzdev <alvinrustan@google.com>
Co-authored-by: Rodrigo Lazo <rlazo@users.noreply.github.com>
Co-authored-by: Mila <107142260+milaGGL@users.noreply.github.com>
Co-authored-by: Ehsan <ehsannas@gmail.com>
Co-authored-by: cherylEnkidu <96084918+cherylEnkidu@users.noreply.github.com>
Co-authored-by: Denver Coneybeare <dconeybe@google.com>
Co-authored-by: Rosário Pereira Fernandes <rosariopf@google.com>
Co-authored-by: utzcoz <43091780+utzcoz@users.noreply.github.com>
Co-authored-by: William Xu <91489359+willxu-google@users.noreply.github.com>
Co-authored-by: Daymon <17409137+daymxn@users.noreply.github.com>
Co-authored-by: Tom Andersen <tom-andersen@users.noreply.github.com>
Co-authored-by: Kurt Alfred Kluever <kak@google.com>
Co-authored-by: Rosalyn Tan <rosalyntan@google.com>
Co-authored-by: Leo Zhan <zhanl@google.com>
Co-authored-by: Yifan Yang <yifayan@gmail.com>
Co-authored-by: Vladimir Kryachko <vkryachko@google.com>
Co-authored-by: Matthew Robertson <mrober@users.noreply.github.com>
Co-authored-by: Greg Sakakihara <gsaka@google.com>
Co-authored-by: emilypgoogle <110422458+emilypgoogle@users.noreply.github.com>
Co-authored-by: Márton Braun <braunmarci@gmail.com>
Co-authored-by: Eldhose M Babu <eldhosembabu@google.com>
Co-authored-by: wu-hui <53845758+wu-hui@users.noreply.github.com>
Co-authored-by: Vinay Guthal <vguthal@google.com>
@firebase firebase locked and limited conversation to collaborators Jan 8, 2023
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.

None yet

3 participants