refactor: refactor codebase using very_good_analysis
0
packages/cohost/.gitignore
vendored
Normal file → Executable file
3
packages/cohost/analysis_options.yaml
Normal file → Executable file
|
@ -3,3 +3,6 @@ include: package:very_good_analysis/analysis_options.yaml
|
|||
linter:
|
||||
rules:
|
||||
public_member_api_docs: false
|
||||
|
||||
analyzer:
|
||||
exclude: [ '**.g.dart' ]
|
0
packages/cohost/assets/test/project.json
Normal file → Executable file
0
packages/cohost/build.yaml
Normal file → Executable file
2
packages/cohost/lib/cohost.dart
Normal file → Executable file
|
@ -1,5 +1,3 @@
|
|||
library;
|
||||
|
||||
export 'src/models/attachment.dart';
|
||||
export 'src/models/blocks.dart';
|
||||
export 'src/models/post.dart';
|
||||
|
|
6
packages/cohost/lib/src/models/attachment.dart
Normal file → Executable file
|
@ -14,6 +14,9 @@ class Attachment {
|
|||
required this.height,
|
||||
});
|
||||
|
||||
factory Attachment.fromJson(Map<String, dynamic> json) =>
|
||||
_$AttachmentFromJson(json);
|
||||
|
||||
final String attachmentId;
|
||||
final String altText;
|
||||
final Uri previewURL;
|
||||
|
@ -23,9 +26,6 @@ class Attachment {
|
|||
final int height;
|
||||
|
||||
Map<String, dynamic> toJson() => _$AttachmentToJson(this);
|
||||
|
||||
factory Attachment.fromJson(Map<String, dynamic> json) =>
|
||||
_$AttachmentFromJson(json);
|
||||
}
|
||||
|
||||
enum AttachmentKind {
|
||||
|
|
0
packages/cohost/lib/src/models/attachment.g.dart
Normal file → Executable file
18
packages/cohost/lib/src/models/blocks.dart
Normal file → Executable file
|
@ -4,12 +4,10 @@ import 'package:json_annotation/json_annotation.dart';
|
|||
part 'blocks.g.dart';
|
||||
|
||||
sealed class Block {
|
||||
BlockType get type;
|
||||
|
||||
const Block();
|
||||
|
||||
factory Block.fromJson(Map<String, dynamic> json) {
|
||||
final type = BlockType.values.firstWhere((e) => json["type"] == e.name);
|
||||
final type = BlockType.values.firstWhere((e) => json['type'] == e.name);
|
||||
|
||||
final block = switch (type) {
|
||||
BlockType.attachment => AttachmentBlock.fromJson(json),
|
||||
|
@ -21,6 +19,8 @@ sealed class Block {
|
|||
return block;
|
||||
}
|
||||
|
||||
BlockType get type;
|
||||
|
||||
Map<String, dynamic> toJson();
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,9 @@ enum BlockType { attachment, markdown }
|
|||
class AttachmentBlock extends Block {
|
||||
const AttachmentBlock({required this.attachment});
|
||||
|
||||
factory AttachmentBlock.fromJson(Map<String, dynamic> json) =>
|
||||
_$AttachmentBlockFromJson(json);
|
||||
|
||||
@override
|
||||
BlockType get type => BlockType.attachment;
|
||||
|
||||
|
@ -37,15 +40,15 @@ class AttachmentBlock extends Block {
|
|||
|
||||
@override
|
||||
Map<String, dynamic> toJson() => _$AttachmentBlockToJson(this);
|
||||
|
||||
factory AttachmentBlock.fromJson(Map<String, dynamic> json) =>
|
||||
_$AttachmentBlockFromJson(json);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class MarkdownBlock extends Block {
|
||||
const MarkdownBlock({required this.markdown});
|
||||
|
||||
factory MarkdownBlock.fromJson(Map<String, dynamic> json) =>
|
||||
_$MarkdownBlockFromJson(json);
|
||||
|
||||
@override
|
||||
BlockType get type => BlockType.markdown;
|
||||
|
||||
|
@ -53,7 +56,4 @@ class MarkdownBlock extends Block {
|
|||
|
||||
@override
|
||||
Map<String, dynamic> toJson() => _$MarkdownBlockToJson(this);
|
||||
|
||||
factory MarkdownBlock.fromJson(Map<String, dynamic> json) =>
|
||||
_$MarkdownBlockFromJson(json);
|
||||
}
|
||||
|
|
0
packages/cohost/lib/src/models/blocks.g.dart
Normal file → Executable file
4
packages/cohost/lib/src/models/post.dart
Normal file → Executable file
|
@ -40,6 +40,8 @@ class Post {
|
|||
required this.responseToAskId,
|
||||
});
|
||||
|
||||
factory Post.fromJson(Map<String, dynamic> json) => _$PostFromJson(json);
|
||||
|
||||
final int postId;
|
||||
final String headline;
|
||||
final DateTime publishedAt;
|
||||
|
@ -73,6 +75,4 @@ class Post {
|
|||
final String? responseToAskId;
|
||||
|
||||
Map<String, dynamic> toJson() => _$PostToJson(this);
|
||||
|
||||
factory Post.fromJson(Map<String, dynamic> json) => _$PostFromJson(json);
|
||||
}
|
||||
|
|
0
packages/cohost/lib/src/models/post.g.dart
Normal file → Executable file
18
packages/cohost/lib/src/models/project.dart
Normal file → Executable file
|
@ -27,6 +27,9 @@ class Project {
|
|||
required this.isSelfProject,
|
||||
});
|
||||
|
||||
factory Project.fromJson(Map<String, dynamic> json) =>
|
||||
_$ProjectFromJson(json);
|
||||
|
||||
final int projectId;
|
||||
final String handle;
|
||||
final String displayName;
|
||||
|
@ -49,9 +52,6 @@ class Project {
|
|||
final bool? isSelfProject;
|
||||
|
||||
Map<String, dynamic> toJson() => _$ProjectToJson(this);
|
||||
|
||||
factory Project.fromJson(Map<String, dynamic> json) =>
|
||||
_$ProjectFromJson(json);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
|
@ -62,14 +62,14 @@ class ContactCardLink {
|
|||
required this.service,
|
||||
});
|
||||
|
||||
factory ContactCardLink.fromJson(Map<String, dynamic> json) =>
|
||||
_$ContactCardLinkFromJson(json);
|
||||
|
||||
final ContactCardLinkVisiblity visibility;
|
||||
final String value;
|
||||
final String service;
|
||||
|
||||
Map<String, dynamic> toJson() => _$ContactCardLinkToJson(this);
|
||||
|
||||
factory ContactCardLink.fromJson(Map<String, dynamic> json) =>
|
||||
_$ContactCardLinkFromJson(json);
|
||||
}
|
||||
|
||||
enum ContactCardLinkVisiblity { public }
|
||||
|
@ -93,12 +93,12 @@ class AskSettings {
|
|||
required this.requireLoggedInAnon,
|
||||
});
|
||||
|
||||
factory AskSettings.fromJson(Map<String, dynamic> json) =>
|
||||
_$AskSettingsFromJson(json);
|
||||
|
||||
final bool enabled;
|
||||
final bool allowAnon;
|
||||
final bool requireLoggedInAnon;
|
||||
|
||||
Map<String, dynamic> toJson() => _$AskSettingsToJson(this);
|
||||
|
||||
factory AskSettings.fromJson(Map<String, dynamic> json) =>
|
||||
_$AskSettingsFromJson(json);
|
||||
}
|
||||
|
|
2
packages/cohost/lib/src/models/project.g.dart
Normal file → Executable file
|
@ -101,7 +101,7 @@ ContactCardLink _$ContactCardLinkFromJson(Map<String, dynamic> json) =>
|
|||
|
||||
Map<String, dynamic> _$ContactCardLinkToJson(ContactCardLink instance) =>
|
||||
<String, dynamic>{
|
||||
'visibility': _$ContactCardLinkVisiblityEnumMap[instance.visibility]!,
|
||||
'visibility': _$ContactCardLinkVisiblityEnumMap[instance.visibility],
|
||||
'value': instance.value,
|
||||
'service': instance.service,
|
||||
};
|
||||
|
|
0
packages/cohost/pubspec.yaml
Normal file → Executable file
0
packages/cohost/pubspec_overrides.yaml
Normal file → Executable file
0
packages/cohost/test/cohost_test.dart
Normal file → Executable file
0
packages/kaiteki/.gitignore
vendored
Normal file → Executable file
0
packages/kaiteki/.metadata
Normal file → Executable file
64
packages/kaiteki/analysis_options.yaml
Normal file → Executable file
|
@ -1,4 +1,6 @@
|
|||
include: package:flutter_lints/flutter.yaml
|
||||
include: package:very_good_analysis/analysis_options.yaml
|
||||
|
||||
|
||||
|
||||
analyzer:
|
||||
plugins:
|
||||
|
@ -7,68 +9,10 @@ analyzer:
|
|||
- '**.g.dart'
|
||||
- 'lib/l10n/**'
|
||||
errors:
|
||||
missing_enum_constant_in_switch: ignore
|
||||
# Ignoring TODO comments since they're obnoxious
|
||||
# to see within the problem list and can be easily
|
||||
# viewed with the todo lists within the IDE.
|
||||
todo: ignore
|
||||
fixme: ignore
|
||||
hack: ignore
|
||||
|
||||
custom_lint:
|
||||
rules:
|
||||
# Unreliable, triggers on variables and methods returning expected Widget type.
|
||||
- missing_provider_scope: false
|
||||
|
||||
linter:
|
||||
rules:
|
||||
avoid_type_to_string: true
|
||||
avoid_positional_boolean_parameters: false
|
||||
|
||||
# Unnecessary code
|
||||
avoid_redundant_argument_values: true
|
||||
avoid_types_on_closure_parameters: true
|
||||
noop_primitive_operations: true
|
||||
unnecessary_await_in_return: true
|
||||
unnecessary_lambdas: true
|
||||
unnecessary_null_aware_assignments: true
|
||||
unnecessary_null_checks: true
|
||||
unnecessary_parenthesis: true
|
||||
unnecessary_statements: true
|
||||
omit_local_variable_types: true
|
||||
|
||||
# Code style
|
||||
prefer_double_quotes: true
|
||||
always_declare_return_types: true
|
||||
avoid_void_async: true
|
||||
join_return_with_assignment: true
|
||||
only_throw_errors: true
|
||||
prefer_constructors_over_static_methods: true
|
||||
prefer_final_in_for_each: true
|
||||
prefer_final_locals: true
|
||||
require_trailing_commas: true
|
||||
use_named_constants: true
|
||||
use_setters_to_change_properties: true
|
||||
use_string_buffers: true
|
||||
use_test_throws_matchers: true
|
||||
use_super_parameters: true
|
||||
|
||||
# Dart features
|
||||
avoid_classes_with_only_static_members: true
|
||||
avoid_returning_this: true
|
||||
cascade_invocations: true
|
||||
prefer_asserts_in_initializer_lists: true
|
||||
prefer_if_elements_to_conditional_expressions: true
|
||||
|
||||
# Sorting
|
||||
directives_ordering: true
|
||||
sort_pub_dependencies: true
|
||||
sort_unnamed_constructors_first: true
|
||||
|
||||
# Naming conventions
|
||||
flutter_style_todos: true
|
||||
use_to_and_as_if_applicable: true
|
||||
|
||||
# Flutter
|
||||
sized_box_shrink_expand: true
|
||||
use_decorated_box: true
|
||||
public_member_api_docs: false
|
0
packages/kaiteki/android/.gitignore
vendored
Normal file → Executable file
0
packages/kaiteki/android/app/build.gradle
Normal file → Executable file
0
packages/kaiteki/android/app/src/debug/AndroidManifest.xml
Normal file → Executable file
0
packages/kaiteki/android/app/src/main/AndroidManifest.xml
Normal file → Executable file
0
packages/kaiteki/android/app/src/main/ic_launcher-playstore.png
Normal file → Executable file
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
0
packages/kaiteki/android/app/src/main/kotlin/app/kaiteki/MainActivity.kt
Normal file → Executable file
0
packages/kaiteki/android/app/src/main/res/drawable-hdpi/splash.png
Normal file → Executable file
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
0
packages/kaiteki/android/app/src/main/res/drawable-mdpi/splash.png
Normal file → Executable file
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
0
packages/kaiteki/android/app/src/main/res/drawable-v21/background.png
Normal file → Executable file
Before Width: | Height: | Size: 70 B After Width: | Height: | Size: 70 B |
0
packages/kaiteki/android/app/src/main/res/drawable-v21/launch_background.xml
Normal file → Executable file
0
packages/kaiteki/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Normal file → Executable file
0
packages/kaiteki/android/app/src/main/res/drawable-xhdpi/splash.png
Normal file → Executable file
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
0
packages/kaiteki/android/app/src/main/res/drawable-xxhdpi/splash.png
Normal file → Executable file
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
0
packages/kaiteki/android/app/src/main/res/drawable-xxxhdpi/splash.png
Normal file → Executable file
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
0
packages/kaiteki/android/app/src/main/res/drawable/background.png
Normal file → Executable file
Before Width: | Height: | Size: 70 B After Width: | Height: | Size: 70 B |
0
packages/kaiteki/android/app/src/main/res/drawable/ic_kaiteki.xml
Normal file → Executable file
0
packages/kaiteki/android/app/src/main/res/drawable/ic_kaiteki_color.xml
Normal file → Executable file
0
packages/kaiteki/android/app/src/main/res/drawable/kaiteki_noshadow.xml
Normal file → Executable file
0
packages/kaiteki/android/app/src/main/res/drawable/launch_background.xml
Normal file → Executable file
0
packages/kaiteki/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file → Executable file
0
packages/kaiteki/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file → Executable file
0
packages/kaiteki/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 4 KiB |
0
packages/kaiteki/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Normal file → Executable file
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 4 KiB |
0
packages/kaiteki/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
0
packages/kaiteki/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Normal file → Executable file
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
0
packages/kaiteki/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
0
packages/kaiteki/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Normal file → Executable file
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
0
packages/kaiteki/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
0
packages/kaiteki/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file → Executable file
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
0
packages/kaiteki/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file → Executable file
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
0
packages/kaiteki/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file → Executable file
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
0
packages/kaiteki/android/app/src/main/res/values-night/styles.xml
Normal file → Executable file
0
packages/kaiteki/android/app/src/main/res/values-v31/styles.xml
Normal file → Executable file
0
packages/kaiteki/android/app/src/main/res/values/colors.xml
Normal file → Executable file
0
packages/kaiteki/android/app/src/main/res/values/ic_launcher_background.xml
Normal file → Executable file
0
packages/kaiteki/android/app/src/main/res/values/styles.xml
Normal file → Executable file
0
packages/kaiteki/android/app/src/profile/AndroidManifest.xml
Normal file → Executable file
0
packages/kaiteki/android/build.gradle
Normal file → Executable file
0
packages/kaiteki/android/gradle.properties
Normal file → Executable file
0
packages/kaiteki/android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file → Executable file
0
packages/kaiteki/android/settings.gradle
Normal file → Executable file
0
packages/kaiteki/assets/attributions/tenor.png
Normal file → Executable file
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
0
packages/kaiteki/assets/exampleAvatar.jpg
Normal file → Executable file
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 123 KiB |
0
packages/kaiteki/assets/fonts/AtkinsonHyperlegible-Bold.ttf
Normal file → Executable file
0
packages/kaiteki/assets/fonts/AtkinsonHyperlegible-BoldItalic.ttf
Normal file → Executable file
0
packages/kaiteki/assets/fonts/AtkinsonHyperlegible-Italic.ttf
Normal file → Executable file
0
packages/kaiteki/assets/fonts/AtkinsonHyperlegible-Regular.ttf
Normal file → Executable file
0
packages/kaiteki/assets/fonts/FiraMono-Bold.ttf
Normal file → Executable file
0
packages/kaiteki/assets/fonts/FiraMono-Medium.ttf
Normal file → Executable file
0
packages/kaiteki/assets/fonts/FiraMono-Regular.ttf
Normal file → Executable file
0
packages/kaiteki/assets/fonts/FiraSans-Bold.ttf
Normal file → Executable file
0
packages/kaiteki/assets/fonts/FiraSans-BoldItalic.ttf
Normal file → Executable file
0
packages/kaiteki/assets/fonts/FiraSans-Italic.ttf
Normal file → Executable file
0
packages/kaiteki/assets/fonts/FiraSans-Medium.ttf
Normal file → Executable file
0
packages/kaiteki/assets/fonts/FiraSans-MediumItalic.ttf
Normal file → Executable file
0
packages/kaiteki/assets/fonts/FiraSans-Regular.ttf
Normal file → Executable file
0
packages/kaiteki/assets/fonts/FiraSansExtraCondensed-Regular.ttf
Normal file → Executable file
0
packages/kaiteki/assets/fonts/OpenDyslexic-Bold-Italic.otf
Normal file → Executable file
0
packages/kaiteki/assets/fonts/OpenDyslexic-Bold.otf
Normal file → Executable file
0
packages/kaiteki/assets/fonts/OpenDyslexic-Regular.otf
Normal file → Executable file
0
packages/kaiteki/assets/fonts/Quicksand-Bold.ttf
Normal file → Executable file
0
packages/kaiteki/assets/icon.png
Normal file → Executable file
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.7 KiB |
0
packages/kaiteki/assets/icons/2.0x/akkoma.png
Normal file → Executable file
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
0
packages/kaiteki/assets/icons/2.0x/bluesky.png
Normal file → Executable file
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
0
packages/kaiteki/assets/icons/2.0x/calckey.png
Normal file → Executable file
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
0
packages/kaiteki/assets/icons/2.0x/fediverse.png
Normal file → Executable file
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
0
packages/kaiteki/assets/icons/2.0x/foundkey.png
Normal file → Executable file
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
0
packages/kaiteki/assets/icons/2.0x/mastodon.png
Normal file → Executable file
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
0
packages/kaiteki/assets/icons/2.0x/misskey.png
Normal file → Executable file
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
0
packages/kaiteki/assets/icons/2.0x/pleroma.png
Normal file → Executable file
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
0
packages/kaiteki/assets/icons/2.0x/tumblr_blue.png
Normal file → Executable file
Before Width: | Height: | Size: 534 B After Width: | Height: | Size: 534 B |
0
packages/kaiteki/assets/icons/2.0x/tumblr_white.png
Normal file → Executable file
Before Width: | Height: | Size: 477 B After Width: | Height: | Size: 477 B |
0
packages/kaiteki/assets/icons/akkoma.png
Normal file → Executable file
Before Width: | Height: | Size: 839 B After Width: | Height: | Size: 839 B |
0
packages/kaiteki/assets/icons/bluesky.png
Normal file → Executable file
Before Width: | Height: | Size: 623 B After Width: | Height: | Size: 623 B |
0
packages/kaiteki/assets/icons/calckey.png
Normal file → Executable file
Before Width: | Height: | Size: 801 B After Width: | Height: | Size: 801 B |
0
packages/kaiteki/assets/icons/fediverse.png
Normal file → Executable file
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
0
packages/kaiteki/assets/icons/foundkey.png
Normal file → Executable file
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
0
packages/kaiteki/assets/icons/mastodon.png
Normal file → Executable file
Before Width: | Height: | Size: 1,005 B After Width: | Height: | Size: 1,005 B |
0
packages/kaiteki/assets/icons/misskey.png
Normal file → Executable file
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
0
packages/kaiteki/assets/icons/pleroma.png
Normal file → Executable file
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
0
packages/kaiteki/assets/icons/tumblr_blue.png
Normal file → Executable file
Before Width: | Height: | Size: 331 B After Width: | Height: | Size: 331 B |