Migrate to pkg:lints
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 4c5911b..ca39e9b 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -66,7 +66,7 @@
fail-fast: false
matrix:
os: [ubuntu-latest]
- sdk: [2.12.0, dev]
+ sdk: [2.14.0, dev]
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
diff --git a/analysis_options.yaml b/analysis_options.yaml
index a5a3a99..6488b3c 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,4 +1,4 @@
-include: package:pedantic/analysis_options.yaml
+include: package:lints/recommended.yaml
analyzer:
strong-mode:
diff --git a/lib/src/async/web_driver.dart b/lib/src/async/web_driver.dart
index 5a29d51..ebbcc91 100644
--- a/lib/src/async/web_driver.dart
+++ b/lib/src/async/web_driver.dart
@@ -24,7 +24,6 @@
import '../common/utils.dart';
import '../common/webdriver_handler.dart';
import 'common.dart';
-
// ignore: uri_does_not_exist
import 'common_stub.dart'
// ignore: uri_does_not_exist
@@ -136,7 +135,7 @@
///
/// This is rather confusing and will be removed.
/// Should replace all usages with [window.close()] or [quit()].
- @deprecated
+ @Deprecated('Use `window.close()` or `quit()` instead.')
Future<void> close() async => (await window).close();
/// Handles for all of the currently displayed tabs/windows.
diff --git a/lib/src/async/web_element.dart b/lib/src/async/web_element.dart
index 6f924d6..8b60be8 100644
--- a/lib/src/async/web_element.dart
+++ b/lib/src/async/web_element.dart
@@ -132,7 +132,7 @@
/// Access to the selenium attributes of this tag.
///
/// This is deprecated, only used to support old pageloader.
- @deprecated
+ @Deprecated('Only used to support the old page loader.')
Attributes get seleniumAttributes => Attributes((name) => _client.send(
_handler.element.buildSeleniumAttributeRequest(id, name),
_handler.element.parseSeleniumAttributeResponse));
diff --git a/lib/src/common/webdriver_handler.dart b/lib/src/common/webdriver_handler.dart
index 2cc39cd..175fe0f 100644
--- a/lib/src/common/webdriver_handler.dart
+++ b/lib/src/common/webdriver_handler.dart
@@ -187,13 +187,13 @@
/// Builds request for 'Selenium Element Attribute'.
///
/// This is deprecated, only used to support old pageloader.
- @deprecated
+ @Deprecated('Only used to support the old page loader.')
WebDriverRequest buildSeleniumAttributeRequest(String elementId, String name);
/// Parses response for 'Element Attribute'.
///
/// This is deprecated, only used to support old pageloader.
- @deprecated
+ @Deprecated('Only used to support the old page loader.')
String? parseSeleniumAttributeResponse(WebDriverResponse response);
/// Builds request for 'Element Property'.
diff --git a/lib/src/handler/json_wire/element.dart b/lib/src/handler/json_wire/element.dart
index 54b1438..a33b9e9 100644
--- a/lib/src/handler/json_wire/element.dart
+++ b/lib/src/handler/json_wire/element.dart
@@ -2,7 +2,6 @@
import '../../common/request.dart';
import '../../common/webdriver_handler.dart';
-
import 'utils.dart';
class JsonWireElementHandler extends ElementHandler {
@@ -121,13 +120,13 @@
parseJsonWireResponse(response)?.toString();
@override
- @deprecated
+ @Deprecated('Only used to support the old page loader.')
WebDriverRequest buildSeleniumAttributeRequest(
String elementId, String name) =>
WebDriverRequest.getRequest('${elementPrefix(elementId)}attribute/$name');
@override
- @deprecated
+ @Deprecated('Only used to support the old page loader.')
String? parseSeleniumAttributeResponse(WebDriverResponse response) =>
parseJsonWireResponse(response)?.toString();
diff --git a/lib/src/handler/json_wire/element_finder.dart b/lib/src/handler/json_wire/element_finder.dart
index 6a6e726..71ba1a3 100644
--- a/lib/src/handler/json_wire/element_finder.dart
+++ b/lib/src/handler/json_wire/element_finder.dart
@@ -9,10 +9,8 @@
{'using': by.using, 'value': by.value};
@override
- WebDriverRequest buildFindElementsRequest(By by, [String? contextElementId]) {
- var uri = contextElementId == null
- ? 'elements'
- : 'element/$contextElementId/elements';
+ WebDriverRequest buildFindElementsRequest(By by, [String? contextId]) {
+ var uri = contextId == null ? 'elements' : 'element/$contextId/elements';
return WebDriverRequest.postRequest(uri, _byToJson(by));
}
@@ -24,10 +22,8 @@
.cast<String>();
@override
- WebDriverRequest buildFindElementRequest(By by, [String? contextElementId]) {
- var uri = contextElementId == null
- ? 'element'
- : 'element/$contextElementId/element';
+ WebDriverRequest buildFindElementRequest(By by, [String? contextId]) {
+ var uri = contextId == null ? 'element' : 'element/$contextId/element';
return WebDriverRequest.postRequest(uri, _byToJson(by));
}
diff --git a/lib/src/handler/w3c/element.dart b/lib/src/handler/w3c/element.dart
index 13f21e8..3366de9 100644
--- a/lib/src/handler/w3c/element.dart
+++ b/lib/src/handler/w3c/element.dart
@@ -2,7 +2,6 @@
import '../../common/request.dart';
import '../../common/webdriver_handler.dart';
-
import 'utils.dart';
class W3cElementHandler extends ElementHandler {
@@ -116,13 +115,13 @@
parseW3cResponse(response)?.toString();
@override
- @deprecated
+ @Deprecated('Only used to support the old page loader.')
WebDriverRequest buildSeleniumAttributeRequest(
String elementId, String name) =>
WebDriverRequest.getRequest('${elementPrefix(elementId)}attribute/$name');
@override
- @deprecated
+ @Deprecated('Only used to support the old page loader.')
String? parseSeleniumAttributeResponse(WebDriverResponse response) =>
parseW3cResponse(response)?.toString();
diff --git a/lib/src/handler/w3c/element_finder.dart b/lib/src/handler/w3c/element_finder.dart
index d91a81f..2269ee2 100644
--- a/lib/src/handler/w3c/element_finder.dart
+++ b/lib/src/handler/w3c/element_finder.dart
@@ -39,8 +39,8 @@
}
@override
- WebDriverRequest buildFindElementsRequest(By by, [String? contextElementId]) {
- var uri = '${elementPrefix(contextElementId)}elements';
+ WebDriverRequest buildFindElementsRequest(By by, [String? contextId]) {
+ var uri = '${elementPrefix(contextId)}elements';
return WebDriverRequest.postRequest(uri, _byToJson(by));
}
@@ -51,8 +51,8 @@
.toList();
@override
- WebDriverRequest buildFindElementRequest(By by, [String? contextElementId]) {
- var uri = '${elementPrefix(contextElementId)}element';
+ WebDriverRequest buildFindElementRequest(By by, [String? contextId]) {
+ var uri = '${elementPrefix(contextId)}element';
return WebDriverRequest.postRequest(uri, _byToJson(by));
}
diff --git a/lib/src/sync/web_driver.dart b/lib/src/sync/web_driver.dart
index 004e306..f913a61 100644
--- a/lib/src/sync/web_driver.dart
+++ b/lib/src/sync/web_driver.dart
@@ -22,7 +22,6 @@
import '../common/utils.dart';
import '../common/webdriver_handler.dart';
import 'common.dart';
-
// ignore: uri_does_not_exist
import 'common_stub.dart'
// ignore: uri_does_not_exist
@@ -149,7 +148,7 @@
///
/// This is rather confusing and will be removed.
/// Should replace all usages with [window.close()] or [quit()].
- @deprecated
+ @Deprecated('Use `window.close()` or `quit()` instead.')
void close() {
window.close();
}
diff --git a/pubspec.yaml b/pubspec.yaml
index cbc67c6..f5c3000 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -9,7 +9,7 @@
homepage: https://github.com/google/webdriver.dart
environment:
- sdk: '>=2.12.0 <3.0.0'
+ sdk: '>=2.14.0 <3.0.0'
dependencies:
archive: ^3.0.0
@@ -19,5 +19,5 @@
sync_http: ^0.3.0
dev_dependencies:
- pedantic: ^1.10.0
+ lints: ^1.0.0
test: ^1.16.0
diff --git a/test/async_logs_test.dart b/test/async_logs_test.dart
index c301dce..3caa7bc 100644
--- a/test/async_logs_test.dart
+++ b/test/async_logs_test.dart
@@ -43,9 +43,9 @@
}
expect(logs, isNotEmpty);
- logs.forEach((entry) {
+ for (var entry in logs) {
expect(entry.level, equals(LogLevel.info));
- });
+ }
});
}, timeout: const Timeout(Duration(minutes: 2)));
}
diff --git a/test/support/async_test.dart b/test/support/async_test.dart
index 5c9d78e..7f63323 100644
--- a/test/support/async_test.dart
+++ b/test/support/async_test.dart
@@ -14,9 +14,8 @@
library webdriver.support.async_test;
-import 'dart:async' show Future;
+import 'dart:async' show Future, unawaited;
-import 'package:pedantic/pedantic.dart';
import 'package:test/test.dart';
import 'package:webdriver/support/async.dart';
diff --git a/test/support/firefox_profile_test.dart b/test/support/firefox_profile_test.dart
index 587cee0..ece45ef 100644
--- a/test/support/firefox_profile_test.dart
+++ b/test/support/firefox_profile_test.dart
@@ -133,11 +133,9 @@
var expectedFiles = ['prefs.js', 'user.js'];
expect(archive.files.length, greaterThanOrEqualTo(expectedFiles.length));
- expectedFiles.forEach(
- (f) => expect(
- archive.files,
- anyElement((ArchiveFile f) => f.name == 'prefs.js'),
- ),
+ expect(
+ archive.files,
+ anyElement((ArchiveFile f) => f.name == 'prefs.js'),
);
var prefs = FirefoxProfile.loadPrefsFile(MockFile(
@@ -172,11 +170,9 @@
'webapps/webapps.json'
];
expect(archive.files.length, greaterThanOrEqualTo(expectedFiles.length));
- expectedFiles.forEach(
- (f) => expect(
- archive.files,
- anyElement((ArchiveFile f) => f.name == 'prefs.js'),
- ),
+ expect(
+ archive.files,
+ anyElement((ArchiveFile f) => f.name == 'prefs.js'),
);
var prefs = FirefoxProfile.loadPrefsFile(
diff --git a/test/sync/logs.dart b/test/sync/logs.dart
index d5f3bcd..4ccbd22 100644
--- a/test/sync/logs.dart
+++ b/test/sync/logs.dart
@@ -45,9 +45,9 @@
}
expect(logs, isNotEmpty);
- logs.forEach((entry) {
+ for (var entry in logs) {
expect(entry.level, equals(LogLevel.info));
- });
+ }
});
}, timeout: const Timeout(Duration(minutes: 2)));
}