Skip to content

Commit

Permalink
chore(nextcloud): migrate lint rules
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolas Rimikis <[email protected]>
  • Loading branch information
Leptopoda committed Dec 19, 2023
1 parent d82019e commit 80d000a
Show file tree
Hide file tree
Showing 49 changed files with 4,628 additions and 4,830 deletions.
2 changes: 1 addition & 1 deletion packages/dynamite/dynamite/lib/src/builder/client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ Iterable<String> buildAuthCheck(
yield '''
// coverage:ignore-start
final authentication = $client.authentications.firstWhereOrNull(
(final auth) => switch (auth) {
(auth) => switch (auth) {
''';

yield* securityRequirements.map((final requirement) {
Expand Down
5 changes: 0 additions & 5 deletions packages/nextcloud/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
include: package:neon_lints/dart.yaml

linter:
rules:
prefer_final_parameters: true
avoid_final_parameters: false
4 changes: 2 additions & 2 deletions packages/nextcloud/bin/generate_exports.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ void main() {
final files = Directory('lib/src/api')
.listSync()
.cast<File>()
.where((final file) => file.path.endsWith('.openapi.dart'))
.where((file) => file.path.endsWith('.openapi.dart'))
.toList()
..sort((final a, final b) => a.path.compareTo(b.path));
..sort((a, b) => a.path.compareTo(b.path));

final idStatements = StringBuffer();

Expand Down
26 changes: 13 additions & 13 deletions packages/nextcloud/bin/generate_props.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:io';

void main() {
final props = File('lib/src/webdav/props.csv').readAsLinesSync().map((final line) => line.split(','));
final props = File('lib/src/webdav/props.csv').readAsLinesSync().map((line) => line.split(','));
final valueProps = <String>[];
final findProps = <String>[];
final variables = <String>[];
Expand Down Expand Up @@ -58,33 +58,33 @@ void main() {
}

List<String> generateClass(
final String name,
final String elementName,
final String namespace,
final List<String> props,
final List<String> variables, {
required final bool isPropfind,
String name,
String elementName,
String namespace,
List<String> props,
List<String> variables, {
required bool isPropfind,
}) =>
[
'@annotation.XmlSerializable(createMixin: true)',
"@annotation.XmlRootElement(name: '$elementName', namespace: $namespace)",
'class $name with _\$${name}XmlSerializableMixin {',
' $name({',
...variables.map((final variable) => ' this.$variable,'),
...variables.map((variable) => ' this.$variable,'),
' });',
'',
if (isPropfind) ...[
' $name.fromBools({',
...variables.map((final variable) => ' final bool $variable = false,'),
' }) : ${variables.map((final variable) => '$variable = $variable ? [null] : null').join(', ')};',
...variables.map((variable) => ' bool $variable = false,'),
' }) : ${variables.map((variable) => '$variable = $variable ? [null] : null').join(', ')};',
'',
],
' factory $name.fromXmlElement(final XmlElement element) => _\$${name}FromXmlElement(element);',
...props.map((final prop) => '\n $prop'),
' factory $name.fromXmlElement(XmlElement element) => _\$${name}FromXmlElement(element);',
...props.map((prop) => '\n $prop'),
'}',
];

String convertNamespace(final String namespacePrefix) {
String convertNamespace(String namespacePrefix) {
switch (namespacePrefix) {
case 'dav':
return 'namespaceDav';
Expand Down
11 changes: 5 additions & 6 deletions packages/nextcloud/lib/src/api/comments.openapi.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Client extends DynamiteClient {
super.authentications,
});

Client.fromClient(final DynamiteClient client)
Client.fromClient(DynamiteClient client)
: super(
client.baseURL,
baseHeaders: client.baseHeaders,
Expand All @@ -40,15 +40,14 @@ abstract interface class $Capabilities_FilesInterface {

abstract class Capabilities_Files
implements $Capabilities_FilesInterface, Built<Capabilities_Files, Capabilities_FilesBuilder> {
factory Capabilities_Files([final void Function(Capabilities_FilesBuilder)? b]) = _$Capabilities_Files;
factory Capabilities_Files([void Function(Capabilities_FilesBuilder)? b]) = _$Capabilities_Files;

// coverage:ignore-start
const Capabilities_Files._();
// coverage:ignore-end

// coverage:ignore-start
factory Capabilities_Files.fromJson(final Map<String, dynamic> json) =>
jsonSerializers.deserializeWith(serializer, json)!;
factory Capabilities_Files.fromJson(Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;
// coverage:ignore-end

// coverage:ignore-start
Expand All @@ -64,14 +63,14 @@ abstract interface class $CapabilitiesInterface {
}

abstract class Capabilities implements $CapabilitiesInterface, Built<Capabilities, CapabilitiesBuilder> {
factory Capabilities([final void Function(CapabilitiesBuilder)? b]) = _$Capabilities;
factory Capabilities([void Function(CapabilitiesBuilder)? b]) = _$Capabilities;

// coverage:ignore-start
const Capabilities._();
// coverage:ignore-end

// coverage:ignore-start
factory Capabilities.fromJson(final Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;
factory Capabilities.fromJson(Map<String, dynamic> json) => jsonSerializers.deserializeWith(serializer, json)!;
// coverage:ignore-end

// coverage:ignore-start
Expand Down
Loading

0 comments on commit 80d000a

Please sign in to comment.