Add pre-commit with formatting and linting.

This commit is contained in:
Dain Nilsson 2023-11-29 10:26:56 +01:00
parent 2151902c57
commit 83fda9ddf5
No known key found for this signature in database
GPG Key ID: F04367096FBA95E8
6 changed files with 32 additions and 8 deletions

26
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,26 @@
repos:
# Flutter
- repo: https://github.com/dluksza/flutter-analyze-pre-commit
rev: "4afcaa82fc368d40d486256bf4edba329bf667bb"
hooks:
- id: flutter-analyze
args: [lib/*]
- id: dart-format
args: [lib/*]
# Python
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
files: helper/
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
files: helper/
- repo: https://github.com/PyCQA/bandit
rev: 1.7.5
hooks:
- id: bandit
files: helper/ # keep in sync with .bandit file

View File

@ -160,7 +160,8 @@ class _DialogProvider {
_DDesc.oathDeleteAccount => l10n.s_nfc_dialog_oath_delete_account, _DDesc.oathDeleteAccount => l10n.s_nfc_dialog_oath_delete_account,
_DDesc.oathCalculateCode => l10n.s_nfc_dialog_oath_calculate_code, _DDesc.oathCalculateCode => l10n.s_nfc_dialog_oath_calculate_code,
_DDesc.oathActionFailure => l10n.s_nfc_dialog_oath_failure, _DDesc.oathActionFailure => l10n.s_nfc_dialog_oath_failure,
_DDesc.oathAddMultipleAccounts => l10n.s_nfc_dialog_oath_add_multiple_accounts, _DDesc.oathAddMultipleAccounts =>
l10n.s_nfc_dialog_oath_add_multiple_accounts,
_ => '' _ => ''
}; };
} }

View File

@ -26,4 +26,3 @@ class ApduException implements Exception {
return 'ApduException[$message; dec: $sw]'; return 'ApduException[$message; dec: $sw]';
} }
} }

View File

@ -14,6 +14,4 @@
* limitations under the License. * limitations under the License.
*/ */
class CancellationException implements Exception { class CancellationException implements Exception {}
}

View File

@ -61,7 +61,8 @@ class IconPack {
element.issuer.any((element) => element == issuer.toUpperCase())); element.issuer.any((element) => element == issuer.toUpperCase()));
final issuerImageFile = matching.isNotEmpty final issuerImageFile = matching.isNotEmpty
? File(join(directory.path, getLocalIconFileName(matching.first.filename))) ? File(
join(directory.path, getLocalIconFileName(matching.first.filename)))
: null; : null;
if (issuerImageFile != null && !issuerImageFile.existsSync()) { if (issuerImageFile != null && !issuerImageFile.existsSync()) {

View File

@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
@ -15,4 +14,4 @@ class FocusUtils {
currentFocus.unfocus(); currentFocus.unfocus();
} }
} }
} }