public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH proxmox{_login_manager,_dart_api_client}/pve_flutter_frontend 0/3] cleanup: enable avoid_print Linter rule
@ 2026-08-21 13:07 Shan Shaji
  2026-08-21 13:07 ` [PATCH pve_flutter_frontend 1/1] cleanup: remove print statements Shan Shaji
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Shan Shaji @ 2026-08-21 13:07 UTC (permalink / raw)
  To: pve-devel

This came up during the review of this series [0]. No functional
changes. Only cleanup of print calls.

- [0] https://lore.proxmox.com/pve-devel/DKTRUBIDHBL4.20HCPMB83XVNR@proxmox.com/

pve_flutter_frontend:

Shan Shaji (1):
  cleanup: remove print statements

 analysis_options.yaml                    | 1 -
 lib/bloc/proxmox_base_bloc.dart          | 8 +++++---
 lib/bloc/pve_file_selector_bloc.dart     | 5 ++++-
 lib/widgets/pve_console_menu_widget.dart | 5 ++++-
 4 files changed, 13 insertions(+), 6 deletions(-)


proxmox_login_manager:

Shan Shaji (1):
  cleanup: remove print statements

 analysis_options.yaml       | 1 -
 lib/proxmox_login_form.dart | 5 +----
 lib/proxmox_tfa_form.dart   | 4 +---
 3 files changed, 2 insertions(+), 8 deletions(-)


proxmox_dart_api_client:

Shan Shaji (1):
  cleanup: avoid print statements

 analysis_options.yaml     | 6 +++---
 lib/src/authenticate.dart | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)


Summary over all repositories:
  9 files changed, 18 insertions(+), 18 deletions(-)

--
Generated by git-murpp 0.8.1




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH pve_flutter_frontend 1/1] cleanup: remove print statements
  2026-08-21 13:07 [PATCH proxmox{_login_manager,_dart_api_client}/pve_flutter_frontend 0/3] cleanup: enable avoid_print Linter rule Shan Shaji
@ 2026-08-21 13:07 ` Shan Shaji
  2026-08-21 13:07 ` [PATCH proxmox_login_manager " Shan Shaji
  2026-08-21 13:07 ` [PATCH proxmox_dart_api_client 1/1] cleanup: avoid " Shan Shaji
  2 siblings, 0 replies; 4+ messages in thread
From: Shan Shaji @ 2026-08-21 13:07 UTC (permalink / raw)
  To: pve-devel

Dart Linter rules recommend avoiding print statements [0]. To align with
this, surround the print calls with the kDebugMode constant.

- [0] https://dart.dev/tools/linter-rules/avoid_print

Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
 analysis_options.yaml                    | 1 -
 lib/bloc/proxmox_base_bloc.dart          | 8 +++++---
 lib/bloc/pve_file_selector_bloc.dart     | 5 ++++-
 lib/widgets/pve_console_menu_widget.dart | 5 ++++-
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/analysis_options.yaml b/analysis_options.yaml
index 97fc1a8..b8bb85a 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -21,7 +21,6 @@ linter:
   # `// ignore_for_file: name_of_lint` syntax on the line or in the file
   # producing the lint.
   rules:
-    avoid_print: false
     library_private_types_in_public_api: false # we need to fix use of our PveBaseState mixin first
     # prefer_single_quotes: true  # Uncomment to enable the `prefer_single_quotes` rule
 
diff --git a/lib/bloc/proxmox_base_bloc.dart b/lib/bloc/proxmox_base_bloc.dart
index c01ade1..32d116e 100644
--- a/lib/bloc/proxmox_base_bloc.dart
+++ b/lib/bloc/proxmox_base_bloc.dart
@@ -1,6 +1,6 @@
 import 'dart:async';
 
-import 'package:meta/meta.dart';
+import 'package:flutter/foundation.dart';
 import 'package:pve_flutter_frontend/bloc/proxmox_global_error_bloc.dart';
 import 'package:rxdart/rxdart.dart';
 
@@ -55,8 +55,10 @@ abstract class ProxmoxBaseBloc<E, S> {
 
   void _errorHandler(Object error, [StackTrace? stacktrace]) {
     ProxmoxGlobalErrorBloc().addError(error);
-    print(error);
-    print(stacktrace);
+    if (kDebugMode) {
+      print(error);
+      print(stacktrace);
+    }
   }
 
   @mustCallSuper
diff --git a/lib/bloc/pve_file_selector_bloc.dart b/lib/bloc/pve_file_selector_bloc.dart
index ed78ac4..83dada7 100644
--- a/lib/bloc/pve_file_selector_bloc.dart
+++ b/lib/bloc/pve_file_selector_bloc.dart
@@ -1,6 +1,7 @@
 import 'package:pve_flutter_frontend/bloc/proxmox_base_bloc.dart';
 import 'package:proxmox_dart_api_client/proxmox_dart_api_client.dart';
 import 'package:pve_flutter_frontend/states/pve_file_selector_state.dart';
+import 'package:flutter/foundation.dart';
 
 class PveFileSelectorBloc
     extends ProxmoxBaseBloc<PveFileSelectorEvent, PveFileSelectorState> {
@@ -48,7 +49,9 @@ class PveFileSelectorBloc
             latestState.nodeID, latestState.storageID!, event.volume!,
             delay: 5);
       } on ProxmoxApiException catch (e) {
-        print(e);
+        if (kDebugMode) {
+          print(e);
+        }
       }
       events.add(LoadStorageContent());
     }
diff --git a/lib/widgets/pve_console_menu_widget.dart b/lib/widgets/pve_console_menu_widget.dart
index 86feac8..68364e7 100644
--- a/lib/widgets/pve_console_menu_widget.dart
+++ b/lib/widgets/pve_console_menu_widget.dart
@@ -2,6 +2,7 @@ import 'dart:convert';
 import 'dart:io';
 import 'dart:async';
 
+import 'package:flutter/foundation.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 import 'package:path_provider/path_provider.dart';
@@ -259,7 +260,9 @@ class PVEWebConsoleState extends State<PVEWebConsole> {
                   await settings
                       .rebuild((b) => b..trustedFingerprints.add(hash))
                       .toLocalStorage();
-                  print(settings.toJson());
+                  if (kDebugMode) {
+                    print(settings.toJson());
+                  }
                 }
 
                 final action = trust
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH proxmox_login_manager 1/1] cleanup: remove print statements
  2026-08-21 13:07 [PATCH proxmox{_login_manager,_dart_api_client}/pve_flutter_frontend 0/3] cleanup: enable avoid_print Linter rule Shan Shaji
  2026-08-21 13:07 ` [PATCH pve_flutter_frontend 1/1] cleanup: remove print statements Shan Shaji
@ 2026-08-21 13:07 ` Shan Shaji
  2026-08-21 13:07 ` [PATCH proxmox_dart_api_client 1/1] cleanup: avoid " Shan Shaji
  2 siblings, 0 replies; 4+ messages in thread
From: Shan Shaji @ 2026-08-21 13:07 UTC (permalink / raw)
  To: pve-devel

Dart linter rules recommend avoiding print statements [0]. To align with
this, remove all print statements.

- [0] https://dart.dev/tools/linter-rules/avoid_print

Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
 analysis_options.yaml       | 1 -
 lib/proxmox_login_form.dart | 5 +----
 lib/proxmox_tfa_form.dart   | 4 +---
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/analysis_options.yaml b/analysis_options.yaml
index cd3b168..3e5d916 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -22,7 +22,6 @@ linter:
   # `// ignore_for_file: name_of_lint` syntax on the line or in the file
   # producing the lint.
   rules:
-    avoid_print: false  # Uncomment to disable the `avoid_print` rule
     # prefer_single_quotes: true  # Uncomment to enable the `prefer_single_quotes` rule
 
 # Additional information about this file can be found at
diff --git a/lib/proxmox_login_form.dart b/lib/proxmox_login_form.dart
index 5b9a64e..1476930 100644
--- a/lib/proxmox_login_form.dart
+++ b/lib/proxmox_login_form.dart
@@ -571,7 +571,6 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> {
         Navigator.of(context).pop(client);
       }
     } on proxclient.ProxmoxApiException catch (e) {
-      print(e);
       if (!mounted) return;
       if (e.message.contains('No ticket')) {
         showDialog(
@@ -596,9 +595,7 @@ class _ProxmoxLoginPageState extends State<ProxmoxLoginPage> {
           ),
         );
       }
-    } catch (e, trace) {
-      print(e);
-      print(trace);
+    } catch (e) {
       if (mounted) {
         if (e.runtimeType == HandshakeException) {
           showDialog(
diff --git a/lib/proxmox_tfa_form.dart b/lib/proxmox_tfa_form.dart
index 79273fa..f9051c5 100644
--- a/lib/proxmox_tfa_form.dart
+++ b/lib/proxmox_tfa_form.dart
@@ -166,9 +166,7 @@ class _ProxmoxTfaFormState extends State<ProxmoxTfaForm> {
           ),
         );
       }
-    } catch (e, trace) {
-      print(e);
-      print(trace);
+    } catch (e) {
       if (mounted) {
         showDialog(
           context: context,
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH proxmox_dart_api_client 1/1] cleanup: avoid print statements
  2026-08-21 13:07 [PATCH proxmox{_login_manager,_dart_api_client}/pve_flutter_frontend 0/3] cleanup: enable avoid_print Linter rule Shan Shaji
  2026-08-21 13:07 ` [PATCH pve_flutter_frontend 1/1] cleanup: remove print statements Shan Shaji
  2026-08-21 13:07 ` [PATCH proxmox_login_manager " Shan Shaji
@ 2026-08-21 13:07 ` Shan Shaji
  2 siblings, 0 replies; 4+ messages in thread
From: Shan Shaji @ 2026-08-21 13:07 UTC (permalink / raw)
  To: pve-devel

Dart linter rules recommend avoiding print statements [0]. To align with
this, remove all print statements. The lints recommended.yaml config [1]
does not have the rule by default so explicitly add it.

- [0] https://dart.dev/tools/linter-rules/avoid_print
- [1] https://github.com/dart-lang/core/blob/main/pkgs/lints/rules.md

Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
 analysis_options.yaml     | 6 +++---
 lib/src/authenticate.dart | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/analysis_options.yaml b/analysis_options.yaml
index bf158d5..d1644c7 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -5,9 +5,9 @@ include: package:lints/recommended.yaml
 
 # For lint rules and documentation, see http://dart-lang.github.io/linter/lints.
 # Uncomment to specify additional rules.
-# linter:
-#   rules:
-#     - camel_case_types
+linter:
+  rules:
+    - avoid_print
 
 analyzer:
   errors:
diff --git a/lib/src/authenticate.dart b/lib/src/authenticate.dart
index 7bd9cef..e508fd9 100644
--- a/lib/src/authenticate.dart
+++ b/lib/src/authenticate.dart
@@ -36,7 +36,6 @@ Future<ProxmoxApiClient> authenticate(
 
     // for backward compat with older products, e.g. PVE < 7.1, retry without 'new-format'
     if (response.statusCode == 400) {
-      print("retrying for backward compat!");
       final errors = jsonDecode(response.body)['errors'] ?? {};
       if (errors.containsKey('new-format')) {
         var body = {
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-08-21 13:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21 13:07 [PATCH proxmox{_login_manager,_dart_api_client}/pve_flutter_frontend 0/3] cleanup: enable avoid_print Linter rule Shan Shaji
2026-08-21 13:07 ` [PATCH pve_flutter_frontend 1/1] cleanup: remove print statements Shan Shaji
2026-08-21 13:07 ` [PATCH proxmox_login_manager " Shan Shaji
2026-08-21 13:07 ` [PATCH proxmox_dart_api_client 1/1] cleanup: avoid " Shan Shaji

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal