Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

require dart 3.0; update to the latest package:lints #399

Merged
merged 2 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
matrix:
os: [ubuntu-latest]
# Test with at least the declared minimum Dart version
sdk: [2.18.7, stable]
sdk: ['3.0', stable]
steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 9.23.0

* Require Dart 3.0.
* Update to the latest `package:lints`.

## 9.22.0

* Add support for the `Ghost` user when the Github user is deleted.
Expand Down
2 changes: 0 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ linter:
- avoid_implementing_value_types
- avoid_js_rounded_ints
- avoid_private_typedef_functions
- avoid_returning_null
- avoid_returning_null_for_future
- avoid_returning_this
- avoid_setters_without_getters
- avoid_slow_async_io
Expand Down
2 changes: 2 additions & 0 deletions lib/src/common.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/// The Core of GitHub for Dart.
/// Contains the Models and other GitHub stuff.
library;

export 'package:github/src/common/activity_service.dart';
export 'package:github/src/common/authorizations_service.dart';
export 'package:github/src/common/checks_service.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/common/activity_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:http/http.dart' as http;
///
/// API docs: https://developer.github.com/v3/activity/
class ActivityService extends Service {
ActivityService(GitHub github) : super(github);
ActivityService(super.github);

/// Lists public events.
///
Expand Down
2 changes: 1 addition & 1 deletion lib/src/common/authorizations_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:github/src/common.dart';
///
/// API docs: https://developer.github.com/v3/oauth_authorizations/
class AuthorizationsService extends Service {
AuthorizationsService(GitHub github) : super(github);
AuthorizationsService(super.github);

/// Lists all authorizations.
///
Expand Down
9 changes: 4 additions & 5 deletions lib/src/common/checks_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ class ChecksService extends Service {
/// API docs: https://developer.github.com/v3/checks/suites/
final CheckSuitesService checkSuites;

ChecksService(GitHub github)
ChecksService(super.github)
: checkRuns = CheckRunsService._(github),
checkSuites = CheckSuitesService._(github),
super(github);
checkSuites = CheckSuitesService._(github);
}

class CheckRunsService extends Service {
CheckRunsService._(GitHub github) : super(github);
CheckRunsService._(super.github);

/// Creates a new check run for a specific commit in a repository.
/// Your GitHub App must have the `checks:write` permission to create check runs.
Expand Down Expand Up @@ -235,7 +234,7 @@ class CheckRunsService extends Service {
}

class CheckSuitesService extends Service {
CheckSuitesService._(GitHub github) : super(github);
CheckSuitesService._(super.github);

/// Gets a single check suite using its `id`.
/// GitHub Apps must have the `checks:read` permission on a private repository or pull access to a public repository to get check suites.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/common/gists_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:github/src/common.dart';
///
/// API docs: https://developer.github.com/v3/gists/
class GistsService extends Service {
GistsService(GitHub github) : super(github);
GistsService(super.github);

/// lists gists for a user.
///
Expand Down
2 changes: 1 addition & 1 deletion lib/src/common/git_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:github/src/common.dart';
///
/// API docs: https://developer.github.com/v3/git/blobs/
class GitService extends Service {
const GitService(GitHub github) : super(github);
const GitService(super.github);

/// Fetches a blob from [slug] for a given [sha].
///
Expand Down
2 changes: 1 addition & 1 deletion lib/src/common/issues_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:github/src/common.dart';
///
/// API docs: https://developer.github.com/v3/issues/
class IssuesService extends Service {
IssuesService(GitHub github) : super(github);
IssuesService(super.github);

/// List all issues across all the authenticated user’s visible repositories
/// including owned repositories, member repositories, and organization repositories
Expand Down
2 changes: 1 addition & 1 deletion lib/src/common/misc_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:github/src/common.dart';
///
/// API docs: https://developer.github.com/v3/misc/
class MiscService extends Service {
MiscService(GitHub github) : super(github);
MiscService(super.github);

/// Fetches all emojis available on GitHub
/// Returns a map of the name to a url of the image.
Expand Down
10 changes: 5 additions & 5 deletions lib/src/common/model/checks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CheckRunAnnotationLevel extends EnumWithValue {
static const warning = CheckRunAnnotationLevel._('warning');
static const failure = CheckRunAnnotationLevel._('failure');

const CheckRunAnnotationLevel._(String value) : super(value);
const CheckRunAnnotationLevel._(String super.value);

factory CheckRunAnnotationLevel._fromValue(String? value) {
switch (value) {
Expand Down Expand Up @@ -51,7 +51,7 @@ class CheckRunConclusion extends EnumWithValue {
static const actionRequired = CheckRunConclusion._('action_required');
static const empty = CheckRunConclusion._(null);

const CheckRunConclusion._(String? value) : super(value);
const CheckRunConclusion._(super.value);

factory CheckRunConclusion._fromValue(String? value) {
if (value == null) {
Expand Down Expand Up @@ -79,13 +79,13 @@ class CheckRunStatus extends EnumWithValue {
static const queued = CheckRunStatus._('queued');
static const inProgress = CheckRunStatus._('in_progress');
static const completed = CheckRunStatus._('completed');
const CheckRunStatus._(String value) : super(value);
const CheckRunStatus._(String super.value);
}

class CheckRunFilter extends EnumWithValue {
static const all = CheckRunFilter._('all');
static const latest = CheckRunFilter._('latest');
const CheckRunFilter._(String value) : super(value);
const CheckRunFilter._(String super.value);
}

@immutable
Expand Down Expand Up @@ -253,7 +253,7 @@ class CheckRunAnnotation {
assert(title.length <= 255);

@override
bool operator ==(dynamic other) {
bool operator ==(Object other) {
if (other is CheckRunAnnotation) {
return other.annotationLevel == annotationLevel &&
other.path == path &&
Expand Down
2 changes: 1 addition & 1 deletion lib/src/common/orgs_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:http/http.dart' as http;
///
/// API docs: https://developer.github.com/v3/orgs/
class OrganizationsService extends Service {
OrganizationsService(GitHub github) : super(github);
OrganizationsService(super.github);

/// Lists all of the memberships in organizations for the given [userName].
/// If [userName] is not specified we list the memberships in organizations
Expand Down
2 changes: 1 addition & 1 deletion lib/src/common/pulls_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:github/src/common.dart';
///
/// API docs: https://developer.github.com/v3/pulls/
class PullRequestsService extends Service {
PullRequestsService(GitHub github) : super(github);
PullRequestsService(super.github);

/// Fetches several pull requests.
///
Expand Down
2 changes: 1 addition & 1 deletion lib/src/common/repos_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import 'package:http/http.dart' as http;
///
/// API docs: https://developer.github.com/v3/repos/
class RepositoriesService extends Service {
RepositoriesService(GitHub github) : super(github);
RepositoriesService(super.github);

/// Lists the repositories of the currently authenticated user.
///
Expand Down
2 changes: 1 addition & 1 deletion lib/src/common/search_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:github/src/common.dart';
///
/// API docs: https://developer.github.com/v3/search/
class SearchService extends Service {
SearchService(GitHub github) : super(github);
SearchService(super.github);

/// Search for repositories using [query].
/// Since the Search Rate Limit is small, this is a best effort implementation.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/common/url_shortener_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:github/src/common.dart';
///
/// API docs: https://github.com/blog/985-git-io-github-url-shortener
class UrlShortenerService extends Service {
UrlShortenerService(GitHub github) : super(github);
UrlShortenerService(super.github);

/// Shortens the provided [url]. An optional [code] can be provided to create
/// your own vanity URL.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/common/users_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:http/http.dart' as http;
///
/// API docs: https://developer.github.com/v3/users/
class UsersService extends Service {
UsersService(GitHub github) : super(github);
UsersService(super.github);

/// Fetches the user specified by [name].
///
Expand Down
16 changes: 7 additions & 9 deletions lib/src/common/util/errors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@ class NotReady extends GitHubError {
/// GitHub Entity was not found
class NotFound extends GitHubError {
const NotFound(
GitHub github,
String msg,
) : super(github, msg);
super.github,
String super.msg,
);
}

class BadRequest extends GitHubError {
const BadRequest(GitHub github, [String? msg = 'Not Found'])
: super(github, msg);
const BadRequest(super.github, [super.msg = 'Not Found']);
}

/// GitHub Repository was not found
Expand Down Expand Up @@ -94,11 +93,10 @@ class NotAuthenticated extends GitHubError {
}

class InvalidJSON extends BadRequest {
const InvalidJSON(GitHub github, [String? message = 'Invalid JSON'])
: super(github, message);
const InvalidJSON(super.github, [super.message = 'Invalid JSON']);
}

class ValidationFailed extends GitHubError {
const ValidationFailed(GitHub github, [String message = 'Validation Failed'])
: super(github, message);
const ValidationFailed(super.github,
[String super.message = 'Validation Failed']);
}
2 changes: 1 addition & 1 deletion lib/src/common/util/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ abstract class EnumWithValue {

/// True iff [other] is an [EnumWithValue] with the same value as this object.
@override
bool operator ==(dynamic other) =>
bool operator ==(Object other) =>
other is EnumWithValue && value == other.value;

@override
Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: github
version: 9.22.0
version: 9.23.0
description: A high-level GitHub API Client Library that uses Github's v3 API
homepage: https://github.com/SpinlockLabs/github.dart

environment:
sdk: '>=2.18.0 <3.0.0'
sdk: ^3.0.0

dependencies:
http: '>=0.13.0 <2.0.0'
Expand All @@ -19,10 +19,10 @@ dev_dependencies:
collection: ^1.15.0
dependency_validator:
json_serializable: ^6.6.1
lints: ^2.0.0
lints: ^3.0.0
mockito: ^5.0.0
nock: ^1.0.0
pub_semver: ^2.0.0
test: ^1.16.0
yaml: ^3.0.0
yaml_edit:
yaml_edit: ^2.2.0
4 changes: 2 additions & 2 deletions test/helper/http.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class MockHTTPClient extends http.BaseClient {
}

class MockResponse extends http.Response {
MockResponse(String body, Map<String, String> headers, int statusCode)
: super(body, statusCode, headers: headers);
MockResponse(super.body, Map<String, String> headers, super.statusCode)
: super(headers: headers);

factory MockResponse.fromAsset(String name) {
final responseData =
Expand Down
1 change: 1 addition & 0 deletions test/server/hooks_test_data.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// Json messages as dart string used for checks model tests.
library;

String checkSuiteString = checkSuiteTemplate('requested');

Expand Down
2 changes: 1 addition & 1 deletion tool/process_github_schema.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ List<String> wordWrap(String body) {

typedef GenTypeVisitor = void Function(GenType type);

abstract class GenType extends Comparable<GenType> {
abstract class GenType implements Comparable<GenType> {
GenType();

String get name;
Expand Down
Loading