Skip to content

Commit 91c583a

Browse files
committed
style: stricter linting rules
Closes #33
1 parent 377f8f0 commit 91c583a

File tree

98 files changed

+276
-332
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+276
-332
lines changed

example/crypto/hash/hmac_sha256_benchmark.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import '../../utils/perf_gain.dart';
1616
/// ```dart compile jit-snapshot example/crypto/hash/hmac_sha256_benchmark.dart```
1717
/// ```dart /example/crypto/hash/hmac_sha256_benchemark.jit```
1818
void main() {
19-
print("Dartoos HMAC-SHA256 vs. Cryptos HMAC-SHA256...");
19+
print('Dartoos HMAC-SHA256 vs. Cryptos HMAC-SHA256...');
2020
const len = 25000000;
2121
const alphabet =
2222
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';

example/crypto/hash/sha256_benchmark.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import '../../utils/perf_gain.dart';
1616
/// ```dart compile jit-snapshot example/crypto/hash/sha256_benchmark.dart```
1717
/// ```dart /example/crypto/hash/sha256_benchemark.jit```
1818
void main() {
19-
print("Dartoos sha256 vs. Cryptos sha256...");
19+
print('Dartoos sha256 vs. Cryptos sha256...');
2020

2121
const len = 25000000;
2222
const alphabet =
@@ -42,5 +42,6 @@ void main() {
4242
print('Dartoos digest value......: $dartoosDigest');
4343
const perf = PerfGain();
4444
print('Performance ratio.........: ${perf(cryptoHashTime, dartoosHashTime)}');
45-
print('Are the generated digests the same? ${dartoosDigest == cryptoDigest}');
45+
final sameText = dartoosDigest == cryptoDigest;
46+
print('Are the generated digests the same? $sameText');
4647
}

example/crypto/hash/sha512_benchmark.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import '../../utils/perf_gain.dart';
1616
/// ```dart compile jit-snapshot example/crypto/hash/sha512_benchmark.dart```
1717
/// ```dart /example/crypto/hash/sha512_benchemark.jit```
1818
void main() {
19-
print("Dartoos sha512 vs. Crypto sha512...");
19+
print('Dartoos sha512 vs. Crypto sha512...');
2020

2121
const len = 25000000;
2222
const alphabet =
@@ -41,5 +41,6 @@ void main() {
4141
print('Dartoos digest value......: $dartoosDigest');
4242
const perf = PerfGain();
4343
print('Performance ratio.........: ${perf(cryptoHashTime, dartoosHashTime)}');
44-
print('Are the generated digests the same? ${dartoosDigest == cryptoDigest}');
44+
final sameText = dartoosDigest == cryptoDigest;
45+
print('Are the generated digests the same? $sameText');
4546
}

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ dependencies:
1313
dartoos:
1414
path: ../
1515

16-
lint: ^1.7.2
16+
lint: ^1.8.1

example/radix/bin_benchmark.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ void main() {
5252
print(
5353
'Performance.........: $perf (Dart elapsed time / Dartoos elapsed time)',
5454
);
55-
print("Are the generated texts the same? ${dartBinText == dartoosBinText}");
55+
final sameText = dartBinText == dartoosBinText;
56+
print('Are the generated texts the same? $sameText');
5657
}
5758

5859
/// Convert an integer to its binary text representation.

example/radix/bin_bytes_benchmark.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import 'dart:typed_data';
44

5-
import 'package:dartoos/src/radix/bin_bytes.dart';
5+
import 'package:dartoos/radix.dart';
66

77
import '../utils/perf_gain.dart';
88

@@ -63,8 +63,6 @@ void main() {
6363
///
6464
/// **Note**: even when padding is disabled, Dartoos' performance is better.
6565
String bytesAsBinText(List<int> bytes) {
66-
// return bytes.map((int byte) => byte.toRadixString(2).padLeft(8, '0')).join();
67-
6866
// using StringBuffer runs faster than mapping and joining the list of bytes.
6967
final buffer = StringBuffer();
7068
for (var i = 0; i < bytes.length; ++i) {

example/radix/hex_benchmark.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,9 @@ void main() {
5252
print(
5353
'Performance ratio...: $perf (Dart elapsed time / Dartoos elapsed time)',
5454
);
55-
print(
56-
"Are the generated hex texts the same? ${dartHexText == dartoosHexText}",
57-
);
55+
final sameText = dartHexText == dartoosHexText;
56+
print('Are the generated hex texts the same? $sameText');
5857
}
5958

6059
/// Convert an integer to its hexadecimal text representation.
61-
String toHexText(int word) {
62-
return word.toRadixString(16).padLeft(2, '0');
63-
}
60+
String toHexText(int word) => word.toRadixString(16).padLeft(2, '0');

example/radix/hex_bytes_benchmark.dart

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,13 @@ void main() {
5050
print('Dartoos elapsed time: $elapsedDartoos milliseconds');
5151

5252
final perf = const PerfGain().value(elapsedDart, elapsedDartoos);
53-
print(
54-
'Performance ratio...: $perf (Dart elapsed time / Dartoos elapsed time)',
55-
);
56-
print(
57-
'Are the generated hex texts the same? ${dartHexText == dartoosHexText}',
58-
);
53+
print('Performance ratio...: $perf (Dart elapsed time / Dartoos time)');
54+
final sameText = dartHexText == dartoosHexText;
55+
print('Are the generated hex texts the same? $sameText');
5956
}
6057

6158
/// Typical Dart implementation.
6259
String bytesAsHexText(Uint8List bytes) {
63-
// return bytes.map((int byte) => byte.toRadixString(16).padLeft(2, '0')).join();
64-
6560
final buffer = StringBuffer();
6661
for (var i = 0; i < bytes.length; ++i) {
6762
buffer.write(bytes[i].toRadixString(16).padLeft(2, '0'));

example/radix/oct_benchmark.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
import 'dart:typed_data';
44

5-
import 'package:dartoos/src/radix/oct.dart';
6-
5+
import 'package:dartoos/radix.dart';
76
import '../utils/perf_gain.dart';
87

98
/// Dartoos octal text vs. Dart's built-in conversion.
@@ -52,9 +51,8 @@ void main() {
5251
print(
5352
'Performance ratio...: $perf (Dart elapsed time / Dartoos elapsed time)',
5453
);
55-
print(
56-
"Are the generated octal texts the same? ${dartOctText == dartoosOctText}",
57-
);
54+
final sameText = dartOctText == dartoosOctText;
55+
print('Are the generated octal texts the same? $sameText');
5856
}
5957

6058
/// Convert an integer to its octary text representation.

example/radix/oct_bytes_benchmark.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import '../utils/perf_gain.dart';
2828
///
2929
/// Usually, the items 2 and 3 perform better.
3030
void main() {
31-
print("Dartoos octal text vs. Dart sdk");
31+
print('Dartoos octal text vs. Dart sdk');
3232

3333
const len = 5000000;
3434
final bytes = Uint8List.fromList(List<int>.generate(len, (int i) => i % 256));
@@ -58,7 +58,6 @@ void main() {
5858

5959
/// Typical Dart implementation.
6060
String bytesAsOctalText(Uint8List bytes) {
61-
// return bytes.map((int byte) => byte.toRadixString(8).padLeft(3, '0')).join();
6261
final buffer = StringBuffer();
6362
for (var i = 0; i < bytes.length; ++i) {
6463
buffer.write(bytes[i].toRadixString(8).padLeft(3, '0'));

0 commit comments

Comments
 (0)