From 85ee3e4908203c44833e618f7fa865c06946cf5f Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 5 Aug 2023 14:29:30 +0200 Subject: [PATCH] Linter fixes --- CHANGELOG.md | 3 +++ analysis_options.yaml | 3 +++ build.yaml | 12 ++++++++++++ .../reverse_engineering/cipher/cipher_manifest.dart | 4 ++-- .../reverse_engineering/clients/comments_client.dart | 2 +- lib/src/reverse_engineering/models/fragment.g.dart | 2 ++ .../pages/channel_about_page.dart | 2 +- .../pages/channel_upload_page.dart | 2 +- lib/src/reverse_engineering/pages/playlist_page.dart | 6 +++--- lib/src/reverse_engineering/pages/search_page.dart | 2 +- lib/src/search/search_client.dart | 2 +- lib/src/videos/closed_captions/closed_caption.g.dart | 2 ++ .../closed_captions/closed_caption_format.g.dart | 2 ++ .../closed_captions/closed_caption_part.g.dart | 2 ++ .../closed_captions/closed_caption_track.g.dart | 2 ++ .../closed_captions/closed_caption_track_info.g.dart | 2 ++ lib/src/videos/closed_captions/language.g.dart | 2 ++ lib/src/videos/streams/audio_only_stream_info.g.dart | 2 ++ lib/src/videos/streams/bitrate.g.dart | 2 ++ lib/src/videos/streams/filesize.g.dart | 2 ++ lib/src/videos/streams/framerate.g.dart | 2 ++ lib/src/videos/streams/muxed_stream_info.g.dart | 2 ++ lib/src/videos/streams/stream_container.g.dart | 2 ++ lib/src/videos/streams/video_only_stream_info.g.dart | 2 ++ lib/src/videos/streams/video_resolution.g.dart | 2 ++ lib/src/videos/video_client.dart | 4 ++-- pubspec.yaml | 1 + test/closed_caption_test.dart | 3 ++- 28 files changed, 63 insertions(+), 13 deletions(-) create mode 100644 build.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a1de64..f8c2cf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2.0.0+1 +- Linter fixes. + ## 2.0.0 - BREAKING CHANGE: Required at least dart 3.00 - Fixes for dart3 diff --git a/analysis_options.yaml b/analysis_options.yaml index cca8b6c..5c678c2 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,6 +1,9 @@ include: package:lint/strict.yaml analyzer: + errors: + invalid_annotation_target: ignore + language: strict-casts: false diff --git a/build.yaml b/build.yaml new file mode 100644 index 0000000..d29b3ef --- /dev/null +++ b/build.yaml @@ -0,0 +1,12 @@ +# Read about `build.yaml` at https://pub.dev/packages/build_config +# To update generated code, run `pub run build_runner build` +targets: + $default: + builders: + # The end-user of a builder which applies "source_gen|combining_builder" + # may configure the builder to ignore specific lints for their project + source_gen|combining_builder: + options: + ignore_for_file: + - non_constant_identifier_names + - require_trailing_commas \ No newline at end of file diff --git a/lib/src/reverse_engineering/cipher/cipher_manifest.dart b/lib/src/reverse_engineering/cipher/cipher_manifest.dart index c9f8030..0ec715a 100644 --- a/lib/src/reverse_engineering/cipher/cipher_manifest.dart +++ b/lib/src/reverse_engineering/cipher/cipher_manifest.dart @@ -79,11 +79,11 @@ final class CipherManifest { return null; } if (calledFuncName == swapFuncName) { - final index = _funcIndexExp.firstMatch(e)?.group(1)?.parseInt(); + final index = _funcIndexExp.firstMatch(e)?.group(1).parseInt(); return SwapCipherOperation(index!); } if (calledFuncName == spliceFuncName) { - final index = _funcIndexExp.firstMatch(e)?.group(1)?.parseInt(); + final index = _funcIndexExp.firstMatch(e)?.group(1).parseInt(); return SpliceCipherOperation(index!); } if (calledFuncName == reverseFuncName) { diff --git a/lib/src/reverse_engineering/clients/comments_client.dart b/lib/src/reverse_engineering/clients/comments_client.dart index d076566..f62ee8c 100644 --- a/lib/src/reverse_engineering/clients/comments_client.dart +++ b/lib/src/reverse_engineering/clients/comments_client.dart @@ -183,7 +183,7 @@ class _Comment { late final int? likeCount = _commentRenderer .get('voteCount') ?.getT('simpleText') - ?.parseIntWithUnits(); + .parseIntWithUnits(); late final bool isHearted = _commentRenderer .get('actionButtons') diff --git a/lib/src/reverse_engineering/models/fragment.g.dart b/lib/src/reverse_engineering/models/fragment.g.dart index 07aba84..a2e3dd9 100644 --- a/lib/src/reverse_engineering/models/fragment.g.dart +++ b/lib/src/reverse_engineering/models/fragment.g.dart @@ -1,5 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: non_constant_identifier_names, require_trailing_commas + part of 'fragment.dart'; // ************************************************************************** diff --git a/lib/src/reverse_engineering/pages/channel_about_page.dart b/lib/src/reverse_engineering/pages/channel_about_page.dart index 8efe231..2875771 100644 --- a/lib/src/reverse_engineering/pages/channel_about_page.dart +++ b/lib/src/reverse_engineering/pages/channel_about_page.dart @@ -120,7 +120,7 @@ class _InitialData extends InitialData { []; late final int? viewCount = - content.get('viewCountText')?.getT('simpleText')?.parseInt(); + content.get('viewCountText')?.getT('simpleText').parseInt(); late final String? joinDate = content.get('joinedDateText')?.getList('runs')?[1].getT('text'); diff --git a/lib/src/reverse_engineering/pages/channel_upload_page.dart b/lib/src/reverse_engineering/pages/channel_upload_page.dart index 4c31ec3..d0dcfd3 100644 --- a/lib/src/reverse_engineering/pages/channel_upload_page.dart +++ b/lib/src/reverse_engineering/pages/channel_upload_page.dart @@ -198,7 +198,7 @@ class _InitialData extends InitialData { video.get('thumbnail')?.getList('thumbnails')?.last.getT('url') ?? '', video.get('publishedTimeText')?.getT('simpleText') ?? '', - video.get('viewCountText')?.getT('simpleText')?.parseInt() ?? 0, + video.get('viewCountText')?.getT('simpleText').parseInt() ?? 0, ); } } diff --git a/lib/src/reverse_engineering/pages/playlist_page.dart b/lib/src/reverse_engineering/pages/playlist_page.dart index a89baac..f9efbbe 100644 --- a/lib/src/reverse_engineering/pages/playlist_page.dart +++ b/lib/src/reverse_engineering/pages/playlist_page.dart @@ -93,7 +93,7 @@ class _InitialData extends InitialData { ?.getList('stats') ?.elementAtSafe(1) ?.getT('simpleText') - ?.parseInt(); + .parseInt(); // sidebar.playlistSidebarRenderer.items[0].playlistSidebarPrimaryInfoRenderer.stats late final int? videoCount = root @@ -107,7 +107,7 @@ class _InitialData extends InitialData { ?.getList('runs') ?.firstOrNull ?.getT('text') - ?.parseInt(); + .parseInt(); late final String? continuationToken = (videosContent ?? playlistVideosContent) @@ -215,5 +215,5 @@ class _Video { root.get('lengthText')?.getT('simpleText')?.toDuration(); int get viewCount => - root.get('viewCountText')?.getT('simpleText')?.parseInt() ?? 0; + root.get('viewCountText')?.getT('simpleText').parseInt() ?? 0; } diff --git a/lib/src/reverse_engineering/pages/search_page.dart b/lib/src/reverse_engineering/pages/search_page.dart index a8ed9c9..0b8afc5 100644 --- a/lib/src/reverse_engineering/pages/search_page.dart +++ b/lib/src/reverse_engineering/pages/search_page.dart @@ -239,7 +239,7 @@ class _InitialData extends InitialData { ?.getList('runs') ?.first .getT('text') - ?.parseInt() ?? + .parseInt() ?? -1, ); } diff --git a/lib/src/search/search_client.dart b/lib/src/search/search_client.dart index 934a003..6a95b78 100644 --- a/lib/src/search/search_client.dart +++ b/lib/src/search/search_client.dart @@ -30,7 +30,7 @@ class SearchClient { e.title, e.author, ChannelId(e.channelId), - e.uploadDate?.toDateTime(), + e.uploadDate.toDateTime(), e.uploadDate?.toString(), null, e.description, diff --git a/lib/src/videos/closed_captions/closed_caption.g.dart b/lib/src/videos/closed_captions/closed_caption.g.dart index 4845790..a462dab 100644 --- a/lib/src/videos/closed_captions/closed_caption.g.dart +++ b/lib/src/videos/closed_captions/closed_caption.g.dart @@ -1,5 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: non_constant_identifier_names, require_trailing_commas + part of 'closed_caption.dart'; // ************************************************************************** diff --git a/lib/src/videos/closed_captions/closed_caption_format.g.dart b/lib/src/videos/closed_captions/closed_caption_format.g.dart index 7bf0ab4..6fe9d82 100644 --- a/lib/src/videos/closed_captions/closed_caption_format.g.dart +++ b/lib/src/videos/closed_captions/closed_caption_format.g.dart @@ -1,5 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: non_constant_identifier_names, require_trailing_commas + part of 'closed_caption_format.dart'; // ************************************************************************** diff --git a/lib/src/videos/closed_captions/closed_caption_part.g.dart b/lib/src/videos/closed_captions/closed_caption_part.g.dart index 3137fdf..e7bc12c 100644 --- a/lib/src/videos/closed_captions/closed_caption_part.g.dart +++ b/lib/src/videos/closed_captions/closed_caption_part.g.dart @@ -1,5 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: non_constant_identifier_names, require_trailing_commas + part of 'closed_caption_part.dart'; // ************************************************************************** diff --git a/lib/src/videos/closed_captions/closed_caption_track.g.dart b/lib/src/videos/closed_captions/closed_caption_track.g.dart index 9a0665f..15ae3bc 100644 --- a/lib/src/videos/closed_captions/closed_caption_track.g.dart +++ b/lib/src/videos/closed_captions/closed_caption_track.g.dart @@ -1,5 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: non_constant_identifier_names, require_trailing_commas + part of 'closed_caption_track.dart'; // ************************************************************************** diff --git a/lib/src/videos/closed_captions/closed_caption_track_info.g.dart b/lib/src/videos/closed_captions/closed_caption_track_info.g.dart index 6fcf696..dfec6d1 100644 --- a/lib/src/videos/closed_captions/closed_caption_track_info.g.dart +++ b/lib/src/videos/closed_captions/closed_caption_track_info.g.dart @@ -1,5 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: non_constant_identifier_names, require_trailing_commas + part of 'closed_caption_track_info.dart'; // ************************************************************************** diff --git a/lib/src/videos/closed_captions/language.g.dart b/lib/src/videos/closed_captions/language.g.dart index e6c6112..3f83e87 100644 --- a/lib/src/videos/closed_captions/language.g.dart +++ b/lib/src/videos/closed_captions/language.g.dart @@ -1,5 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: non_constant_identifier_names, require_trailing_commas + part of 'language.dart'; // ************************************************************************** diff --git a/lib/src/videos/streams/audio_only_stream_info.g.dart b/lib/src/videos/streams/audio_only_stream_info.g.dart index a5498ce..3accad2 100644 --- a/lib/src/videos/streams/audio_only_stream_info.g.dart +++ b/lib/src/videos/streams/audio_only_stream_info.g.dart @@ -1,5 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: non_constant_identifier_names, require_trailing_commas + part of 'audio_only_stream_info.dart'; // ************************************************************************** diff --git a/lib/src/videos/streams/bitrate.g.dart b/lib/src/videos/streams/bitrate.g.dart index bce853c..66aeb1e 100644 --- a/lib/src/videos/streams/bitrate.g.dart +++ b/lib/src/videos/streams/bitrate.g.dart @@ -1,5 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: non_constant_identifier_names, require_trailing_commas + part of 'bitrate.dart'; // ************************************************************************** diff --git a/lib/src/videos/streams/filesize.g.dart b/lib/src/videos/streams/filesize.g.dart index d07ecd9..51e57ba 100644 --- a/lib/src/videos/streams/filesize.g.dart +++ b/lib/src/videos/streams/filesize.g.dart @@ -1,5 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: non_constant_identifier_names, require_trailing_commas + part of 'filesize.dart'; // ************************************************************************** diff --git a/lib/src/videos/streams/framerate.g.dart b/lib/src/videos/streams/framerate.g.dart index d0ff88f..b504a87 100644 --- a/lib/src/videos/streams/framerate.g.dart +++ b/lib/src/videos/streams/framerate.g.dart @@ -1,5 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: non_constant_identifier_names, require_trailing_commas + part of 'framerate.dart'; // ************************************************************************** diff --git a/lib/src/videos/streams/muxed_stream_info.g.dart b/lib/src/videos/streams/muxed_stream_info.g.dart index 4a01ccf..cc6b839 100644 --- a/lib/src/videos/streams/muxed_stream_info.g.dart +++ b/lib/src/videos/streams/muxed_stream_info.g.dart @@ -1,5 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: non_constant_identifier_names, require_trailing_commas + part of 'muxed_stream_info.dart'; // ************************************************************************** diff --git a/lib/src/videos/streams/stream_container.g.dart b/lib/src/videos/streams/stream_container.g.dart index e1688d5..2963f72 100644 --- a/lib/src/videos/streams/stream_container.g.dart +++ b/lib/src/videos/streams/stream_container.g.dart @@ -1,5 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: non_constant_identifier_names, require_trailing_commas + part of 'stream_container.dart'; // ************************************************************************** diff --git a/lib/src/videos/streams/video_only_stream_info.g.dart b/lib/src/videos/streams/video_only_stream_info.g.dart index c9ca2a4..8431dc2 100644 --- a/lib/src/videos/streams/video_only_stream_info.g.dart +++ b/lib/src/videos/streams/video_only_stream_info.g.dart @@ -1,5 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: non_constant_identifier_names, require_trailing_commas + part of 'video_only_stream_info.dart'; // ************************************************************************** diff --git a/lib/src/videos/streams/video_resolution.g.dart b/lib/src/videos/streams/video_resolution.g.dart index d1f48f8..5531e52 100644 --- a/lib/src/videos/streams/video_resolution.g.dart +++ b/lib/src/videos/streams/video_resolution.g.dart @@ -1,5 +1,7 @@ // GENERATED CODE - DO NOT MODIFY BY HAND +// ignore_for_file: non_constant_identifier_names, require_trailing_commas + part of 'video_resolution.dart'; // ************************************************************************** diff --git a/lib/src/videos/video_client.dart b/lib/src/videos/video_client.dart index 07f8771..5de5e90 100644 --- a/lib/src/videos/video_client.dart +++ b/lib/src/videos/video_client.dart @@ -46,13 +46,13 @@ class VideoClient { watchPage.root .querySelector('meta[itemprop=uploadDate]') ?.attributes['content'] - ?.tryParseDateTime(), + .tryParseDateTime(), playerResponse.videoUploadDate.toString(), playerResponse.videoPublishDate ?? watchPage.root .querySelector('meta[itemprop=datePublished]') ?.attributes['content'] - ?.tryParseDateTime(), + .tryParseDateTime(), playerResponse.videoDescription, playerResponse.videoDuration, ThumbnailSet(videoId.value), diff --git a/pubspec.yaml b/pubspec.yaml index 5b0807d..65eff0e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -20,6 +20,7 @@ dependencies: http_parser: ^4.0.0 json_annotation: ^4.5.0 meta: ^1.7.0 + source_gen: ^1.4.0 xml: ^6.1.0 dev_dependencies: diff --git a/test/closed_caption_test.dart b/test/closed_caption_test.dart index cc826df..9ecfc55 100644 --- a/test/closed_caption_test.dart +++ b/test/closed_caption_test.dart @@ -36,8 +36,9 @@ void main() { final manifest = await yt!.videos.closedCaptions.getManifest('qfJthDvcZ08'); final trackInfo = manifest.getByLanguage( 'en', + // ignore: avoid_redundant_argument_values autoGenerated: false, - ); // ignore: avoid_redundant_argument_values + ); final track = await yt!.videos.closedCaptions.get(trackInfo.first); final caption = track.getByTime( const Duration(