From a2f0917c1656028086028e7375c19e207dfcefa3 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 25 Apr 2023 13:53:32 +0200 Subject: [PATCH 01/28] add format action --- .github/workflows/format.yml | 31 ++++++++++++++++++++++++++++++ dart/tool/commit-formatted-code.sh | 16 +++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/format.yml create mode 100755 dart/tool/commit-formatted-code.sh diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000000..fe1ba036ac --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,31 @@ +name: format code +on: + pull_request: + +jobs: + format-code: + name: Format Code + runs-on: ubuntu-latest + matrix: + working-directory: [flutter, dart] + defaults: + run: + working-directory: ${{ matrix.working-directory }} + steps: + - uses: actions/checkout@v3 + - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d # pin@v1 + + - name: pub get + run: dart pub get + + - name: format + run: dart format . + + - name: fix + run: dart fix --apply + + # actions/checkout fetches only a single commit in a detached HEAD state. Therefore + # we need to pass the current branch, otherwise we can't commit the changes. + # GITHUB_HEAD_REF is the name of the head branch. GitHub Actions only sets this for PRs. + - name: Commit & Push + run: ./tool/commit-formatted-code.sh $GITHUB_HEAD_REF diff --git a/dart/tool/commit-formatted-code.sh b/dart/tool/commit-formatted-code.sh new file mode 100755 index 0000000000..8f77921ceb --- /dev/null +++ b/dart/tool/commit-formatted-code.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -euo pipefail + +GITHUB_BRANCH="${1}" + +if [[ $(git status) == *"nothing to commit"* ]]; then + echo "Nothing to commit. All code formatted correctly." +else + echo "Formatted some code. Going to push the changes." + git config --global user.name 'Sentry Github Bot' + git config --global user.email 'bot+github-bot@sentry.io' + git fetch + git checkout ${GITHUB_BRANCH} + git commit -am "Format & fix code" + git push --set-upstream origin ${GITHUB_BRANCH} +fi From b815694616bdec9b97a054a82b0d72695e766268 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 25 Apr 2023 13:58:22 +0200 Subject: [PATCH 02/28] fix matrix --- .github/workflows/format.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index fe1ba036ac..0b98c02d70 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -6,8 +6,9 @@ jobs: format-code: name: Format Code runs-on: ubuntu-latest - matrix: - working-directory: [flutter, dart] + strategy: + matrix: + working-directory: [flutter, dart] defaults: run: working-directory: ${{ matrix.working-directory }} From b520e13ef2dd4ec46339eabc777319e04c3a6d66 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 25 Apr 2023 14:00:08 +0200 Subject: [PATCH 03/28] run correct pub get command --- .github/workflows/format.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 0b98c02d70..8e377ac537 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -8,16 +8,16 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - working-directory: [flutter, dart] + package: [flutter, dart] defaults: run: - working-directory: ${{ matrix.working-directory }} + working-directory: ${{ matrix.package }} steps: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d # pin@v1 - name: pub get - run: dart pub get + run: ${{ matrix.package }} pub get - name: format run: dart format . From c038c05b247b8a11d1129047a68c5e15a7b36745 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 25 Apr 2023 14:02:17 +0200 Subject: [PATCH 04/28] setup flutter --- .github/workflows/format.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 8e377ac537..2415275059 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -15,6 +15,9 @@ jobs: steps: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d # pin@v1 + if: ${{ matrix.package == 'dart' }} + - uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # pin@v2.10.0 + if: ${{ matrix.package == 'flutter' }} - name: pub get run: ${{ matrix.package }} pub get From e78d9dfe7f9b57b88b2d894eb12db6c4401909a7 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 25 Apr 2023 14:05:42 +0200 Subject: [PATCH 05/28] correct relatice path to commit script --- .github/workflows/format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 2415275059..a40b4fb905 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -32,4 +32,4 @@ jobs: # we need to pass the current branch, otherwise we can't commit the changes. # GITHUB_HEAD_REF is the name of the head branch. GitHub Actions only sets this for PRs. - name: Commit & Push - run: ./tool/commit-formatted-code.sh $GITHUB_HEAD_REF + run: ../tool/commit-formatted-code.sh $GITHUB_HEAD_REF From 20e960231968084815c69dbc0b2cb4c1b633ff7d Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 25 Apr 2023 14:10:47 +0200 Subject: [PATCH 06/28] move script to correct folder --- .github/workflows/format.yml | 2 +- {dart/tool => scripts}/commit-formatted-code.sh | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename {dart/tool => scripts}/commit-formatted-code.sh (100%) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index a40b4fb905..be12b29b0c 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -32,4 +32,4 @@ jobs: # we need to pass the current branch, otherwise we can't commit the changes. # GITHUB_HEAD_REF is the name of the head branch. GitHub Actions only sets this for PRs. - name: Commit & Push - run: ../tool/commit-formatted-code.sh $GITHUB_HEAD_REF + run: ../scripts/commit-formatted-code.sh $GITHUB_HEAD_REF diff --git a/dart/tool/commit-formatted-code.sh b/scripts/commit-formatted-code.sh similarity index 100% rename from dart/tool/commit-formatted-code.sh rename to scripts/commit-formatted-code.sh From 54ffd1e94fb549dacab86fd6b0168f998d6a0555 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 25 Apr 2023 14:13:36 +0200 Subject: [PATCH 07/28] test flutter format --- flutter/lib/src/sentry_flutter_options.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flutter/lib/src/sentry_flutter_options.dart b/flutter/lib/src/sentry_flutter_options.dart index 2f5ccd96d1..0b171154b4 100644 --- a/flutter/lib/src/sentry_flutter_options.dart +++ b/flutter/lib/src/sentry_flutter_options.dart @@ -172,7 +172,8 @@ class SentryFlutterOptions extends SentryOptions { /// Requires adding the [SentryUserInteractionWidget] to the widget tree. /// Example: /// runApp(SentryUserInteractionWidget(child: App())); - bool enableUserInteractionBreadcrumbs = true; + bool enableUserInteractionBreadcrumbs = + true; /// Enables the Auto instrumentation for user interaction tracing. /// From 30cc41bc0c81125924f39808f3c5d61dc83bd3b8 Mon Sep 17 00:00:00 2001 From: Sentry Github Bot Date: Tue, 25 Apr 2023 12:15:39 +0000 Subject: [PATCH 08/28] Format & fix code --- flutter/lib/src/sentry_flutter_options.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/flutter/lib/src/sentry_flutter_options.dart b/flutter/lib/src/sentry_flutter_options.dart index 0b171154b4..2f5ccd96d1 100644 --- a/flutter/lib/src/sentry_flutter_options.dart +++ b/flutter/lib/src/sentry_flutter_options.dart @@ -172,8 +172,7 @@ class SentryFlutterOptions extends SentryOptions { /// Requires adding the [SentryUserInteractionWidget] to the widget tree. /// Example: /// runApp(SentryUserInteractionWidget(child: App())); - bool enableUserInteractionBreadcrumbs = - true; + bool enableUserInteractionBreadcrumbs = true; /// Enables the Auto instrumentation for user interaction tracing. /// From b55912fc670f0ca4cbc9ab641d1d32460370c3f7 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 25 Apr 2023 14:18:03 +0200 Subject: [PATCH 09/28] test fix in flutter package, test format & fix in dart package --- dart/lib/src/sentry_options.dart | 4 +++- flutter/lib/src/sentry_flutter_options.dart | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dart/lib/src/sentry_options.dart b/dart/lib/src/sentry_options.dart index 4160d0fc0f..191319a74e 100644 --- a/dart/lib/src/sentry_options.dart +++ b/dart/lib/src/sentry_options.dart @@ -15,6 +15,7 @@ import 'noop_client.dart'; import 'transport/noop_transport.dart'; import 'utils.dart'; import 'version.dart'; +import 'dart:async'; // TODO: shutdownTimeout, flushTimeoutMillis // https://api.dart.dev/stable/2.10.2/dart-io/HttpClient/close.html doesn't have a timeout param, we'd need to implement manually @@ -291,7 +292,8 @@ class SentryOptions { TracesSamplerCallback? tracesSampler; /// Send statistics to sentry when the client drops events. - bool sendClientReports = true; + bool sendClientReports = + true; /// If enabled, [scopeObservers] will be called when mutating scope. bool enableScopeSync = true; diff --git a/flutter/lib/src/sentry_flutter_options.dart b/flutter/lib/src/sentry_flutter_options.dart index 2f5ccd96d1..e51d8f18ab 100644 --- a/flutter/lib/src/sentry_flutter_options.dart +++ b/flutter/lib/src/sentry_flutter_options.dart @@ -5,6 +5,7 @@ import 'package:flutter/widgets.dart'; import 'binding_wrapper.dart'; import 'renderer/renderer.dart'; import 'screenshot/sentry_screenshot_quality.dart'; +import 'dart:async'; /// This class adds options which are only availble in a Flutter environment. /// Note that some of these options require native Sentry integration, which is From 509b67894b86cefc35d96ec7cccfa3cdd4004d98 Mon Sep 17 00:00:00 2001 From: Sentry Github Bot Date: Tue, 25 Apr 2023 12:19:05 +0000 Subject: [PATCH 10/28] Format & fix code --- dart/lib/src/sentry_options.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dart/lib/src/sentry_options.dart b/dart/lib/src/sentry_options.dart index 191319a74e..4160d0fc0f 100644 --- a/dart/lib/src/sentry_options.dart +++ b/dart/lib/src/sentry_options.dart @@ -15,7 +15,6 @@ import 'noop_client.dart'; import 'transport/noop_transport.dart'; import 'utils.dart'; import 'version.dart'; -import 'dart:async'; // TODO: shutdownTimeout, flushTimeoutMillis // https://api.dart.dev/stable/2.10.2/dart-io/HttpClient/close.html doesn't have a timeout param, we'd need to implement manually @@ -292,8 +291,7 @@ class SentryOptions { TracesSamplerCallback? tracesSampler; /// Send statistics to sentry when the client drops events. - bool sendClientReports = - true; + bool sendClientReports = true; /// If enabled, [scopeObservers] will be called when mutating scope. bool enableScopeSync = true; From 65b9ccf6bbd58756e45450fe6126619e165675df Mon Sep 17 00:00:00 2001 From: Sentry Github Bot Date: Tue, 25 Apr 2023 12:20:56 +0000 Subject: [PATCH 11/28] Format & fix code --- flutter/lib/src/sentry_flutter_options.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/flutter/lib/src/sentry_flutter_options.dart b/flutter/lib/src/sentry_flutter_options.dart index e51d8f18ab..2f5ccd96d1 100644 --- a/flutter/lib/src/sentry_flutter_options.dart +++ b/flutter/lib/src/sentry_flutter_options.dart @@ -5,7 +5,6 @@ import 'package:flutter/widgets.dart'; import 'binding_wrapper.dart'; import 'renderer/renderer.dart'; import 'screenshot/sentry_screenshot_quality.dart'; -import 'dart:async'; /// This class adds options which are only availble in a Flutter environment. /// Note that some of these options require native Sentry integration, which is From 7d8f1455acdda8d2f15c387109c44e0908b1d582 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 2 May 2023 10:49:41 +0200 Subject: [PATCH 12/28] remove pub get and introduce format and fix issue in flutter package --- .github/workflows/format.yml | 6 ------ flutter/lib/src/sentry_flutter_options.dart | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index be12b29b0c..6badd9de8b 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -15,12 +15,6 @@ jobs: steps: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d # pin@v1 - if: ${{ matrix.package == 'dart' }} - - uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # pin@v2.10.0 - if: ${{ matrix.package == 'flutter' }} - - - name: pub get - run: ${{ matrix.package }} pub get - name: format run: dart format . diff --git a/flutter/lib/src/sentry_flutter_options.dart b/flutter/lib/src/sentry_flutter_options.dart index 2f5ccd96d1..e3510456c7 100644 --- a/flutter/lib/src/sentry_flutter_options.dart +++ b/flutter/lib/src/sentry_flutter_options.dart @@ -5,6 +5,7 @@ import 'package:flutter/widgets.dart'; import 'binding_wrapper.dart'; import 'renderer/renderer.dart'; import 'screenshot/sentry_screenshot_quality.dart'; +import 'dart:async'; /// This class adds options which are only availble in a Flutter environment. /// Note that some of these options require native Sentry integration, which is @@ -24,7 +25,8 @@ class SentryFlutterOptions extends SentryOptions { bool autoInitializeNativeSdk = true; /// Enable or disable reporting of used packages. - bool reportPackages = true; + bool reportPackages + = true; /// Enable or disable the Auto session tracking on the Native SDKs (Android/iOS) bool enableAutoSessionTracking = true; From 691cecfd5dc80d5c3b05392b39e5008499565cb4 Mon Sep 17 00:00:00 2001 From: Sentry Github Bot Date: Tue, 2 May 2023 08:50:32 +0000 Subject: [PATCH 13/28] Format & fix code --- flutter/lib/src/binding_wrapper.dart | 1 - flutter/lib/src/navigation/sentry_navigator_observer.dart | 1 - flutter/lib/src/sentry_flutter_options.dart | 4 +--- .../src/user_interaction/sentry_user_interaction_widget.dart | 1 - flutter/lib/src/view_hierarchy/sentry_tree_walker.dart | 2 -- 5 files changed, 1 insertion(+), 8 deletions(-) diff --git a/flutter/lib/src/binding_wrapper.dart b/flutter/lib/src/binding_wrapper.dart index 4a0b5d5a87..08cfa84f53 100644 --- a/flutter/lib/src/binding_wrapper.dart +++ b/flutter/lib/src/binding_wrapper.dart @@ -3,7 +3,6 @@ import 'package:flutter/widgets.dart'; import 'package:meta/meta.dart'; -import '../sentry_flutter.dart'; /// The methods and properties are modelled after the the real binding class. @experimental diff --git a/flutter/lib/src/navigation/sentry_navigator_observer.dart b/flutter/lib/src/navigation/sentry_navigator_observer.dart index de5b51c52e..c28c36b6e4 100644 --- a/flutter/lib/src/navigation/sentry_navigator_observer.dart +++ b/flutter/lib/src/navigation/sentry_navigator_observer.dart @@ -1,6 +1,5 @@ import 'package:flutter/widgets.dart'; -import '../../sentry_flutter.dart'; import '../sentry_native.dart'; import '../sentry_native_channel.dart'; diff --git a/flutter/lib/src/sentry_flutter_options.dart b/flutter/lib/src/sentry_flutter_options.dart index e3510456c7..2f5ccd96d1 100644 --- a/flutter/lib/src/sentry_flutter_options.dart +++ b/flutter/lib/src/sentry_flutter_options.dart @@ -5,7 +5,6 @@ import 'package:flutter/widgets.dart'; import 'binding_wrapper.dart'; import 'renderer/renderer.dart'; import 'screenshot/sentry_screenshot_quality.dart'; -import 'dart:async'; /// This class adds options which are only availble in a Flutter environment. /// Note that some of these options require native Sentry integration, which is @@ -25,8 +24,7 @@ class SentryFlutterOptions extends SentryOptions { bool autoInitializeNativeSdk = true; /// Enable or disable reporting of used packages. - bool reportPackages - = true; + bool reportPackages = true; /// Enable or disable the Auto session tracking on the Native SDKs (Android/iOS) bool enableAutoSessionTracking = true; diff --git a/flutter/lib/src/user_interaction/sentry_user_interaction_widget.dart b/flutter/lib/src/user_interaction/sentry_user_interaction_widget.dart index f98a919065..3b5fec5224 100644 --- a/flutter/lib/src/user_interaction/sentry_user_interaction_widget.dart +++ b/flutter/lib/src/user_interaction/sentry_user_interaction_widget.dart @@ -207,7 +207,6 @@ import 'package:flutter/rendering.dart'; import 'package:meta/meta.dart'; import '../../sentry_flutter.dart'; -import '../widget_utils.dart'; import 'user_interaction_widget.dart'; const _tapDeltaArea = 20 * 20; diff --git a/flutter/lib/src/view_hierarchy/sentry_tree_walker.dart b/flutter/lib/src/view_hierarchy/sentry_tree_walker.dart index aaa21143ed..f7b5cb2fde 100644 --- a/flutter/lib/src/view_hierarchy/sentry_tree_walker.dart +++ b/flutter/lib/src/view_hierarchy/sentry_tree_walker.dart @@ -203,8 +203,6 @@ import 'package:flutter/widgets.dart'; -import '../../sentry_flutter.dart'; -import '../widget_utils.dart'; class _TreeWalker { static const _privateDelimiter = '_'; From 2e0783917f02295838911da5a7708dbc9c6e6025 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 2 May 2023 10:57:50 +0200 Subject: [PATCH 14/28] restore imports --- flutter/lib/src/binding_wrapper.dart | 2 +- flutter/lib/src/navigation/sentry_navigator_observer.dart | 1 + .../src/user_interaction/sentry_user_interaction_widget.dart | 1 + flutter/lib/src/view_hierarchy/sentry_tree_walker.dart | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/flutter/lib/src/binding_wrapper.dart b/flutter/lib/src/binding_wrapper.dart index 08cfa84f53..4d6856861a 100644 --- a/flutter/lib/src/binding_wrapper.dart +++ b/flutter/lib/src/binding_wrapper.dart @@ -1,9 +1,9 @@ // ignore_for_file: invalid_use_of_internal_member +import '../sentry_flutter.dart'; import 'package:flutter/widgets.dart'; import 'package:meta/meta.dart'; - /// The methods and properties are modelled after the the real binding class. @experimental class BindingWrapper { diff --git a/flutter/lib/src/navigation/sentry_navigator_observer.dart b/flutter/lib/src/navigation/sentry_navigator_observer.dart index c28c36b6e4..de5b51c52e 100644 --- a/flutter/lib/src/navigation/sentry_navigator_observer.dart +++ b/flutter/lib/src/navigation/sentry_navigator_observer.dart @@ -1,5 +1,6 @@ import 'package:flutter/widgets.dart'; +import '../../sentry_flutter.dart'; import '../sentry_native.dart'; import '../sentry_native_channel.dart'; diff --git a/flutter/lib/src/user_interaction/sentry_user_interaction_widget.dart b/flutter/lib/src/user_interaction/sentry_user_interaction_widget.dart index 3b5fec5224..f98a919065 100644 --- a/flutter/lib/src/user_interaction/sentry_user_interaction_widget.dart +++ b/flutter/lib/src/user_interaction/sentry_user_interaction_widget.dart @@ -207,6 +207,7 @@ import 'package:flutter/rendering.dart'; import 'package:meta/meta.dart'; import '../../sentry_flutter.dart'; +import '../widget_utils.dart'; import 'user_interaction_widget.dart'; const _tapDeltaArea = 20 * 20; diff --git a/flutter/lib/src/view_hierarchy/sentry_tree_walker.dart b/flutter/lib/src/view_hierarchy/sentry_tree_walker.dart index f7b5cb2fde..aaa21143ed 100644 --- a/flutter/lib/src/view_hierarchy/sentry_tree_walker.dart +++ b/flutter/lib/src/view_hierarchy/sentry_tree_walker.dart @@ -203,6 +203,8 @@ import 'package:flutter/widgets.dart'; +import '../../sentry_flutter.dart'; +import '../widget_utils.dart'; class _TreeWalker { static const _privateDelimiter = '_'; From 23d98b1b073e7ae9f8fa64ce3bb840b8280a8c9a Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 2 May 2023 10:58:07 +0200 Subject: [PATCH 15/28] run dart/flutter pub get before again --- .github/workflows/format.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 6badd9de8b..1eb361ab69 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -15,6 +15,16 @@ jobs: steps: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d # pin@v1 + - uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # pin@v2.10.0 + if: ${{ matrix.package == 'flutter' }} + + - name: flutter pub get + run: flutter pub get + if: ${{ matrix.package == 'flutter' }} + + - name: dart pub get + run: dart pub get + if: ${{ matrix.package != 'flutter' }} - name: format run: dart format . From b9b732629ce4b50996f0ac5e934d970de7e9aaf5 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 2 May 2023 11:02:16 +0200 Subject: [PATCH 16/28] introduce issues in file package & run fomat/fix --- .github/workflows/format.yml | 2 +- file/lib/src/sentry_file.dart | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 1eb361ab69..10df76d6e8 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - package: [flutter, dart] + package: [flutter, dart, file] defaults: run: working-directory: ${{ matrix.package }} diff --git a/file/lib/src/sentry_file.dart b/file/lib/src/sentry_file.dart index 2cb667e6ea..83fd226f5d 100644 --- a/file/lib/src/sentry_file.dart +++ b/file/lib/src/sentry_file.dart @@ -209,6 +209,7 @@ import 'dart:io'; import 'dart:typed_data'; import 'package:meta/meta.dart'; import 'package:sentry/sentry.dart'; +import 'dart:collection'; import 'version.dart'; @@ -243,7 +244,8 @@ class SentryFile implements File { } final File _file; - final Hub _hub; + final Hub + _hub; @override Future copy(String newPath) { From 82305c1779f11723198c21ed35f6f75d06d60644 Mon Sep 17 00:00:00 2001 From: Sentry Github Bot Date: Tue, 2 May 2023 09:03:13 +0000 Subject: [PATCH 17/28] Format & fix code --- file/lib/src/sentry_file.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/file/lib/src/sentry_file.dart b/file/lib/src/sentry_file.dart index 83fd226f5d..2cb667e6ea 100644 --- a/file/lib/src/sentry_file.dart +++ b/file/lib/src/sentry_file.dart @@ -209,7 +209,6 @@ import 'dart:io'; import 'dart:typed_data'; import 'package:meta/meta.dart'; import 'package:sentry/sentry.dart'; -import 'dart:collection'; import 'version.dart'; @@ -244,8 +243,7 @@ class SentryFile implements File { } final File _file; - final Hub - _hub; + final Hub _hub; @override Future copy(String newPath) { From 884cd0cdf425576c15aca5974fdfbf68c8682e97 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 2 May 2023 11:08:29 +0200 Subject: [PATCH 18/28] add dio pakcage and introduce issues there --- .github/workflows/format.yml | 2 +- dio/lib/src/dio_error_extractor.dart | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 10df76d6e8..ad9e9e0e81 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - package: [flutter, dart, file] + package: [flutter, dart, file, dio] defaults: run: working-directory: ${{ matrix.package }} diff --git a/dio/lib/src/dio_error_extractor.dart b/dio/lib/src/dio_error_extractor.dart index ff8ae6b1e0..15da81463f 100644 --- a/dio/lib/src/dio_error_extractor.dart +++ b/dio/lib/src/dio_error_extractor.dart @@ -1,10 +1,12 @@ import 'package:dio/dio.dart'; import 'package:sentry/sentry.dart'; +import 'dart:collection'; /// Extracts the inner cause and stacktrace from [DioError] class DioErrorExtractor extends ExceptionCauseExtractor { @override - ExceptionCause? cause(DioError error) { + ExceptionCause? + cause(DioError error) { final cause = error.error; if (cause == null) { return null; From 25f8282ec6bfc32733bce8816ac93bc706d5bc8d Mon Sep 17 00:00:00 2001 From: Sentry Github Bot Date: Tue, 2 May 2023 09:09:32 +0000 Subject: [PATCH 19/28] Format & fix code --- dio/lib/src/dio_error_extractor.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dio/lib/src/dio_error_extractor.dart b/dio/lib/src/dio_error_extractor.dart index 15da81463f..ff8ae6b1e0 100644 --- a/dio/lib/src/dio_error_extractor.dart +++ b/dio/lib/src/dio_error_extractor.dart @@ -1,12 +1,10 @@ import 'package:dio/dio.dart'; import 'package:sentry/sentry.dart'; -import 'dart:collection'; /// Extracts the inner cause and stacktrace from [DioError] class DioErrorExtractor extends ExceptionCauseExtractor { @override - ExceptionCause? - cause(DioError error) { + ExceptionCause? cause(DioError error) { final cause = error.error; if (cause == null) { return null; From fbd170209d561c5ffb7968b61ca51d2bdb8fdee3 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 2 May 2023 11:16:49 +0200 Subject: [PATCH 20/28] introduce issue and run in sqflite --- .github/workflows/format.yml | 2 +- sqflite/lib/src/sentry_sqflite.dart | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index ad9e9e0e81..583001204b 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - package: [flutter, dart, file, dio] + package: [flutter, dart, file, dio, sqflite] defaults: run: working-directory: ${{ matrix.package }} diff --git a/sqflite/lib/src/sentry_sqflite.dart b/sqflite/lib/src/sentry_sqflite.dart index ef8542186b..a3e7fbfa40 100644 --- a/sqflite/lib/src/sentry_sqflite.dart +++ b/sqflite/lib/src/sentry_sqflite.dart @@ -1,6 +1,7 @@ import 'package:meta/meta.dart'; import 'package:sentry/sentry.dart'; import 'package:sqflite/sqflite.dart'; +import 'dart:collection'; import 'sentry_database.dart'; @@ -39,7 +40,8 @@ Future openDatabaseWithSentry( final newHub = hub ?? HubAdapter(); - final currentSpan = newHub.getSpan(); + final currentSpan + = newHub.getSpan(); final span = currentSpan?.startChild( SentryDatabase.dbOp, description: 'Open DB: $path', From 21b58ac60acd0aa2443d990b30acddffb301b421 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 2 May 2023 11:30:10 +0200 Subject: [PATCH 21/28] run flutter pub get in sqflite --- .github/workflows/format.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 583001204b..afdb4e5812 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -20,11 +20,11 @@ jobs: - name: flutter pub get run: flutter pub get - if: ${{ matrix.package == 'flutter' }} + if: ${{ matrix.package == 'flutter' || matrix.package == 'sqflite' }} - name: dart pub get run: dart pub get - if: ${{ matrix.package != 'flutter' }} + if: ${{ matrix.package != 'flutter' && matrix.package != 'sqflite' }} - name: format run: dart format . From cbcaaeaf02619c3d7c86461d6ddb6a4cd48ec6dc Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 2 May 2023 11:36:28 +0200 Subject: [PATCH 22/28] run flutter action --- .github/workflows/format.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index afdb4e5812..32c9c33434 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -4,7 +4,7 @@ on: jobs: format-code: - name: Format Code + name: Format & Fix Code runs-on: ubuntu-latest strategy: matrix: @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v3 - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d # pin@v1 - uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # pin@v2.10.0 - if: ${{ matrix.package == 'flutter' }} + if: ${{ matrix.package == 'flutter' || matrix.package == 'sqflite' }} - name: flutter pub get run: flutter pub get From 03335b0154de056cd42df0543ed7cb6fdd59aee2 Mon Sep 17 00:00:00 2001 From: Sentry Github Bot Date: Tue, 2 May 2023 09:38:40 +0000 Subject: [PATCH 23/28] Format & fix code --- sqflite/lib/src/sentry_sqflite.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sqflite/lib/src/sentry_sqflite.dart b/sqflite/lib/src/sentry_sqflite.dart index a3e7fbfa40..ef8542186b 100644 --- a/sqflite/lib/src/sentry_sqflite.dart +++ b/sqflite/lib/src/sentry_sqflite.dart @@ -1,7 +1,6 @@ import 'package:meta/meta.dart'; import 'package:sentry/sentry.dart'; import 'package:sqflite/sqflite.dart'; -import 'dart:collection'; import 'sentry_database.dart'; @@ -40,8 +39,7 @@ Future openDatabaseWithSentry( final newHub = hub ?? HubAdapter(); - final currentSpan - = newHub.getSpan(); + final currentSpan = newHub.getSpan(); final span = currentSpan?.startChild( SentryDatabase.dbOp, description: 'Open DB: $path', From 6b516f427663d3f124f8f9cb5e294041781e4417 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 2 May 2023 11:39:24 +0200 Subject: [PATCH 24/28] run in logging package and introduce issues --- .github/workflows/format.yml | 2 +- logging/lib/src/logging_integration.dart | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 32c9c33434..bb11c735e6 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - package: [flutter, dart, file, dio, sqflite] + package: [flutter, dart, file, dio, sqflite, logging] defaults: run: working-directory: ${{ matrix.package }} diff --git a/logging/lib/src/logging_integration.dart b/logging/lib/src/logging_integration.dart index 304deb9e57..7695c24439 100644 --- a/logging/lib/src/logging_integration.dart +++ b/logging/lib/src/logging_integration.dart @@ -5,6 +5,7 @@ import 'package:sentry/sentry.dart'; import 'extension.dart'; import 'version.dart'; +import 'dart:collection'; /// An [Integration] which listens to all messages of the /// [logging](https://pub.dev/packages/logging) package. @@ -22,7 +23,8 @@ class LoggingIntegration implements Integration { _minEventLevel = minEventLevel; final Level _minBreadcrumbLevel; - final Level _minEventLevel; + final Level + _minEventLevel; late StreamSubscription _subscription; late Hub _hub; From c265f96d4fbb24b7a117260c6aaf2cfd7bb8b68e Mon Sep 17 00:00:00 2001 From: Sentry Github Bot Date: Tue, 2 May 2023 09:40:18 +0000 Subject: [PATCH 25/28] Format & fix code --- logging/lib/src/logging_integration.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/logging/lib/src/logging_integration.dart b/logging/lib/src/logging_integration.dart index 7695c24439..304deb9e57 100644 --- a/logging/lib/src/logging_integration.dart +++ b/logging/lib/src/logging_integration.dart @@ -5,7 +5,6 @@ import 'package:sentry/sentry.dart'; import 'extension.dart'; import 'version.dart'; -import 'dart:collection'; /// An [Integration] which listens to all messages of the /// [logging](https://pub.dev/packages/logging) package. @@ -23,8 +22,7 @@ class LoggingIntegration implements Integration { _minEventLevel = minEventLevel; final Level _minBreadcrumbLevel; - final Level - _minEventLevel; + final Level _minEventLevel; late StreamSubscription _subscription; late Hub _hub; From 18a9068ac0e256d048a71f5c8b514e611fff981c Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Mon, 8 May 2023 14:54:49 +0200 Subject: [PATCH 26/28] move format fix and commit to analyze step --- .github/workflows/analyze.yml | 12 ++++++++++- .github/workflows/format.yml | 39 ----------------------------------- 2 files changed, 11 insertions(+), 40 deletions(-) delete mode 100644 .github/workflows/format.yml diff --git a/.github/workflows/analyze.yml b/.github/workflows/analyze.yml index e6bd7c24d1..5e7deceb3f 100644 --- a/.github/workflows/analyze.yml +++ b/.github/workflows/analyze.yml @@ -24,6 +24,7 @@ jobs: access_token: ${{ github.token }} analyze: + name: Format, fix & analyze Code if: ${{ !startsWith(github.ref, 'refs/heads/release/') }} runs-on: ubuntu-latest timeout-minutes: 20 @@ -36,8 +37,17 @@ jobs: if: ${{ inputs.sdk == 'dart' }} - uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # pin@v2.10.0 if: ${{ inputs.sdk == 'flutter' }} + - run: ${{ inputs.sdk }} pub get - - run: ${{ inputs.sdk }} format --set-exit-if-changed ./ + + - run: dart format . + + - run: dart fix --apply + + # actions/checkout fetches only a single commit in a detached HEAD state. Therefore + # we need to pass the current branch, otherwise we can't commit the changes. + # GITHUB_HEAD_REF is the name of the head branch. GitHub Actions only sets this for PRs. + - run: ../scripts/commit-formatted-code.sh $GITHUB_HEAD_REF - name: dart analyze uses: invertase/github-action-dart-analyzer@cdd8652b05bf7ed08ffce30f425436780f869f13 # pin@v1 diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml deleted file mode 100644 index bb11c735e6..0000000000 --- a/.github/workflows/format.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: format code -on: - pull_request: - -jobs: - format-code: - name: Format & Fix Code - runs-on: ubuntu-latest - strategy: - matrix: - package: [flutter, dart, file, dio, sqflite, logging] - defaults: - run: - working-directory: ${{ matrix.package }} - steps: - - uses: actions/checkout@v3 - - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d # pin@v1 - - uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # pin@v2.10.0 - if: ${{ matrix.package == 'flutter' || matrix.package == 'sqflite' }} - - - name: flutter pub get - run: flutter pub get - if: ${{ matrix.package == 'flutter' || matrix.package == 'sqflite' }} - - - name: dart pub get - run: dart pub get - if: ${{ matrix.package != 'flutter' && matrix.package != 'sqflite' }} - - - name: format - run: dart format . - - - name: fix - run: dart fix --apply - - # actions/checkout fetches only a single commit in a detached HEAD state. Therefore - # we need to pass the current branch, otherwise we can't commit the changes. - # GITHUB_HEAD_REF is the name of the head branch. GitHub Actions only sets this for PRs. - - name: Commit & Push - run: ../scripts/commit-formatted-code.sh $GITHUB_HEAD_REF From 788426f7339849673d07e8b73ff1c12bfac9bb66 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Mon, 8 May 2023 14:54:56 +0200 Subject: [PATCH 27/28] introduce error --- flutter/lib/src/sentry_flutter_options.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flutter/lib/src/sentry_flutter_options.dart b/flutter/lib/src/sentry_flutter_options.dart index 2f5ccd96d1..7537aabae1 100644 --- a/flutter/lib/src/sentry_flutter_options.dart +++ b/flutter/lib/src/sentry_flutter_options.dart @@ -5,6 +5,7 @@ import 'package:flutter/widgets.dart'; import 'binding_wrapper.dart'; import 'renderer/renderer.dart'; import 'screenshot/sentry_screenshot_quality.dart'; +import 'dart:collection'; /// This class adds options which are only availble in a Flutter environment. /// Note that some of these options require native Sentry integration, which is @@ -21,7 +22,8 @@ class SentryFlutterOptions extends SentryOptions { /// NOTE: Be careful and only use this if you know what you are doing. /// If you use this flag, make sure a native SDK is running before the Flutter Engine initializes or events might not be captured. /// Defaults to `true`. - bool autoInitializeNativeSdk = true; + bool autoInitializeNativeSdk + = true; /// Enable or disable reporting of used packages. bool reportPackages = true; From 6f8e7ba743c5be332a9a208fa0bcf183ab1c4382 Mon Sep 17 00:00:00 2001 From: Sentry Github Bot Date: Mon, 8 May 2023 12:57:12 +0000 Subject: [PATCH 28/28] Format & fix code --- flutter/lib/src/sentry_flutter_options.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/flutter/lib/src/sentry_flutter_options.dart b/flutter/lib/src/sentry_flutter_options.dart index 7537aabae1..2f5ccd96d1 100644 --- a/flutter/lib/src/sentry_flutter_options.dart +++ b/flutter/lib/src/sentry_flutter_options.dart @@ -5,7 +5,6 @@ import 'package:flutter/widgets.dart'; import 'binding_wrapper.dart'; import 'renderer/renderer.dart'; import 'screenshot/sentry_screenshot_quality.dart'; -import 'dart:collection'; /// This class adds options which are only availble in a Flutter environment. /// Note that some of these options require native Sentry integration, which is @@ -22,8 +21,7 @@ class SentryFlutterOptions extends SentryOptions { /// NOTE: Be careful and only use this if you know what you are doing. /// If you use this flag, make sure a native SDK is running before the Flutter Engine initializes or events might not be captured. /// Defaults to `true`. - bool autoInitializeNativeSdk - = true; + bool autoInitializeNativeSdk = true; /// Enable or disable reporting of used packages. bool reportPackages = true;