Skip to content

Commit 98c6048

Browse files
committed
chore: update analysis options and remove deprecated lint package references and skipped redundant tests.
1 parent 7b2b4b7 commit 98c6048

File tree

13 files changed

+166
-83
lines changed

13 files changed

+166
-83
lines changed
Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
1-
# For lint rules and documentation, see http://dart-lang.github.io/linter/lints.
2-
# Uncomment to specify additional rules.
3-
# linter:
4-
# rules:
5-
# - camel_case_types
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
67

7-
analyzer:
8-
# exclude:
9-
# - path/to/excluded/files/**
8+
# The following line activates a set of recommended lints for Dart packages,
9+
# designed to encourage good coding practices.
10+
include: package:lints/recommended.yaml
11+
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:lints/recommended.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at https://dart.dev/tools/linter-rules.
17+
#
18+
# Instead of disabling a lint rule for the entire project in the
19+
# section below, it can also be suppressed for a single line of code
20+
# or a specific dart file by using the `// ignore: name_of_lint` and
21+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
22+
# producing the lint.
23+
rules:
24+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
25+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
26+
27+
# Additional information about this file can be found at
28+
# https://dart.dev/tools/analysis

openapi-generator-annotations/lib/src/openapi_generator_annotations_base.dart

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,8 @@ class AWSRemoteSpecHeaderDelegate extends RemoteSpecHeaderDelegate {
341341

342342
const AWSRemoteSpecHeaderDelegate({
343343
required this.bucket,
344-
this.secretAccessKey = null,
345-
this.accessKeyId = null,
344+
this.secretAccessKey,
345+
this.accessKeyId,
346346
}) : super();
347347

348348
AWSRemoteSpecHeaderDelegate.fromMap(Map<String, dynamic> map)
@@ -359,7 +359,7 @@ class AWSRemoteSpecHeaderDelegate extends RemoteSpecHeaderDelegate {
359359
String? path,
360360
}) {
361361
if (!(path != null && path.isNotEmpty)) {
362-
throw new AssertionError('The path to the OAS spec should be provided');
362+
throw AssertionError('The path to the OAS spec should be provided');
363363
}
364364

365365
// Use the provided credentials to the constructor, if any, otherwise
@@ -369,7 +369,7 @@ class AWSRemoteSpecHeaderDelegate extends RemoteSpecHeaderDelegate {
369369
secretAccessKey ?? Platform.environment['AWS_SECRET_ACCESS_KEY'];
370370
if ((accessKey == null || accessKey.isEmpty) ||
371371
(secretKey == null || secretKey.isEmpty)) {
372-
throw new AssertionError(
372+
throw AssertionError(
373373
'AWS_SECRET_KEY_ID & AWS_SECRET_ACCESS_KEY should be defined and not empty or they should be provided in the delegate constructor.');
374374
}
375375

@@ -548,30 +548,39 @@ class AdditionalProperties {
548548
String toString() {
549549
final buffer = StringBuffer();
550550
buffer.writeln('AdditionalProperties(');
551-
if (allowUnicodeIdentifiers != null)
551+
if (allowUnicodeIdentifiers != null) {
552552
buffer.writeln(' allowUnicodeIdentifiers: $allowUnicodeIdentifiers,');
553-
if (ensureUniqueParams != null)
553+
}
554+
if (ensureUniqueParams != null) {
554555
buffer.writeln(' ensureUniqueParams: $ensureUniqueParams,');
555-
if (prependFormOrBodyParameters != null)
556+
}
557+
if (prependFormOrBodyParameters != null) {
556558
buffer.writeln(
557559
' prependFormOrBodyParameters: $prependFormOrBodyParameters,');
560+
}
558561
if (pubAuthor != null) buffer.writeln(' pubAuthor: "$pubAuthor",');
559-
if (pubAuthorEmail != null)
562+
if (pubAuthorEmail != null) {
560563
buffer.writeln(' pubAuthorEmail: "$pubAuthorEmail",');
561-
if (pubDescription != null)
564+
}
565+
if (pubDescription != null) {
562566
buffer.writeln(' pubDescription: "$pubDescription",');
567+
}
563568
if (pubHomepage != null) buffer.writeln(' pubHomepage: "$pubHomepage",');
564569
if (pubName != null) buffer.writeln(' pubName: "$pubName",');
565570
if (pubVersion != null) buffer.writeln(' pubVersion: "$pubVersion",');
566-
if (sortModelPropertiesByRequiredFlag != null)
571+
if (sortModelPropertiesByRequiredFlag != null) {
567572
buffer.writeln(
568573
' sortModelPropertiesByRequiredFlag: $sortModelPropertiesByRequiredFlag,');
569-
if (sortParamsByRequiredFlag != null)
574+
}
575+
if (sortParamsByRequiredFlag != null) {
570576
buffer.writeln(' sortParamsByRequiredFlag: $sortParamsByRequiredFlag,');
571-
if (sourceFolder != null)
577+
}
578+
if (sourceFolder != null) {
572579
buffer.writeln(' sourceFolder: "$sourceFolder",');
573-
if (useEnumExtension != null)
580+
}
581+
if (useEnumExtension != null) {
574582
buffer.writeln(' useEnumExtension: $useEnumExtension,');
583+
}
575584
buffer.writeln(' enumUnknownDefaultCase: $enumUnknownDefaultCase,');
576585
buffer.writeln(' wrapper: $wrapper,');
577586
buffer
@@ -629,10 +638,12 @@ class InlineSchemaOptions {
629638
String toString() {
630639
final buffer = StringBuffer();
631640
buffer.writeln('InlineSchemaOptions(');
632-
if (arrayItemSuffix != null)
641+
if (arrayItemSuffix != null) {
633642
buffer.writeln(' arrayItemSuffix: "$arrayItemSuffix",');
634-
if (mapItemSuffix != null)
643+
}
644+
if (mapItemSuffix != null) {
635645
buffer.writeln(' mapItemSuffix: "$mapItemSuffix",');
646+
}
636647
buffer.writeln(' skipSchemaReuse: $skipSchemaReuse,');
637648
buffer
638649
.writeln(' refactorAllofInlineSchemas: $refactorAllofInlineSchemas,');
@@ -694,6 +705,7 @@ class DioProperties extends AdditionalProperties {
694705
map['serializationLibrary']),
695706
super.fromMap(map);
696707

708+
@override
697709
Map<String, dynamic> toMap() => Map.from(super.toMap())
698710
..addAll({
699711
if (dateLibrary != null)
@@ -713,10 +725,12 @@ class DioProperties extends AdditionalProperties {
713725
.replaceAll(RegExp(r'AdditionalProperties\(|\)$'), '')
714726
.replaceAll('\n', '\n ')); // Indent base class fields
715727
if (dateLibrary != null) buffer.writeln(' dateLibrary: $dateLibrary,');
716-
if (nullableFields != null)
728+
if (nullableFields != null) {
717729
buffer.writeln(' nullableFields: $nullableFields,');
718-
if (serializationLibrary != null)
730+
}
731+
if (serializationLibrary != null) {
719732
buffer.writeln(' serializationLibrary: $serializationLibrary,');
733+
}
720734
buffer.write(')');
721735
return buffer.toString();
722736
}
@@ -783,6 +797,7 @@ class DioAltProperties extends AdditionalProperties {
783797
pubspecDevDependencies = map['pubspecDevDependencies'],
784798
super.fromMap(map);
785799

800+
@override
786801
Map<String, dynamic> toMap() => Map.from(super.toMap())
787802
..addAll({
788803
if (listAnyOf != null) 'listAnyOf': listAnyOf,
@@ -805,10 +820,12 @@ class DioAltProperties extends AdditionalProperties {
805820

806821
// Add DioAltProperties-specific fields
807822
if (listAnyOf != null) buffer.writeln(' listAnyOf: $listAnyOf,');
808-
if (pubspecDependencies != null)
823+
if (pubspecDependencies != null) {
809824
buffer.writeln(' pubspecDependencies: "$pubspecDependencies",');
810-
if (pubspecDevDependencies != null)
825+
}
826+
if (pubspecDevDependencies != null) {
811827
buffer.writeln(' pubspecDevDependencies: "$pubspecDevDependencies",');
828+
}
812829

813830
buffer.write(')');
814831
return buffer.toString();

openapi-generator-annotations/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ dev_dependencies:
1515
test:
1616
source_gen_test:
1717
lint:
18+
lints: ^6.0.0

openapi-generator-annotations/test/additional_properties_test.dart

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ void main() {
1414
expect(props.sortModelPropertiesByRequiredFlag, isTrue);
1515
expect(props.sortParamsByRequiredFlag, isTrue);
1616
// Default null props
17-
[
17+
for (var element in [
1818
props.pubVersion,
1919
props.pubName,
2020
props.pubHomepage,
2121
props.pubDescription,
2222
props.pubAuthor,
2323
props.pubAuthorEmail,
2424
props.sourceFolder
25-
].forEach((element) => expect(element, isNull));
25+
]) {
26+
expect(element, isNull);
27+
}
2628
});
2729
test('toMap', () {
2830
final props = AdditionalProperties();
@@ -37,15 +39,17 @@ void main() {
3739
expect(map['sortParamsByRequiredFlag'], isTrue);
3840

3941
// Doesn't include null fields
40-
[
42+
for (var element in [
4143
'pubVersion',
4244
'pubName',
4345
'pubHomepage',
4446
'pubDescription',
4547
'pubAuthor',
4648
'pubAuthorEmail',
4749
'sourceFolder'
48-
].forEach((element) => expect(map.containsKey(element), isFalse));
50+
]) {
51+
expect(map.containsKey(element), isFalse);
52+
}
4953
});
5054
test('fromMap', () {
5155
final props = AdditionalProperties(
@@ -107,7 +111,7 @@ void main() {
107111
expect(props.sortModelPropertiesByRequiredFlag, isTrue);
108112
expect(props.sortParamsByRequiredFlag, isTrue);
109113
// Default null props
110-
[
114+
for (var element in [
111115
props.pubVersion,
112116
props.pubName,
113117
props.pubHomepage,
@@ -118,7 +122,9 @@ void main() {
118122
props.nullableFields,
119123
props.serializationLibrary,
120124
props.dateLibrary,
121-
].forEach((element) => expect(element, isNull));
125+
]) {
126+
expect(element, isNull);
127+
}
122128
});
123129
test('toMap', () {
124130
final props = DioProperties();
@@ -133,7 +139,7 @@ void main() {
133139
expect(map['sortParamsByRequiredFlag'], isTrue);
134140

135141
// Doesn't include null fields
136-
[
142+
for (var element in [
137143
'pubVersion',
138144
'pubName',
139145
'pubHomepage',
@@ -144,7 +150,9 @@ void main() {
144150
'dateLibrary',
145151
'nullableFields',
146152
'serializationLibrary'
147-
].forEach((element) => expect(map.containsKey(element), isFalse));
153+
]) {
154+
expect(map.containsKey(element), isFalse);
155+
}
148156
});
149157
test('fromMap', () {
150158
final props = DioProperties(
@@ -215,7 +223,7 @@ void main() {
215223
expect(props.sortModelPropertiesByRequiredFlag, isTrue);
216224
expect(props.sortParamsByRequiredFlag, isTrue);
217225
// Default null props
218-
[
226+
for (var element in [
219227
props.pubVersion,
220228
props.pubName,
221229
props.pubHomepage,
@@ -226,7 +234,9 @@ void main() {
226234
props.listAnyOf,
227235
props.pubspecDevDependencies,
228236
props.pubspecDependencies
229-
].forEach((element) => expect(element, isNull));
237+
]) {
238+
expect(element, isNull);
239+
}
230240
});
231241
test('toMap', () {
232242
final props = DioAltProperties();
@@ -241,7 +251,7 @@ void main() {
241251
expect(map['sortParamsByRequiredFlag'], isTrue);
242252

243253
// Doesn't include null fields
244-
[
254+
for (var element in [
245255
'pubVersion',
246256
'pubName',
247257
'pubHomepage',
@@ -254,7 +264,9 @@ void main() {
254264
'listAnyOf,'
255265
'pubspecDevDependencies,'
256266
'pubspecDependencies'
257-
].forEach((element) => expect(map.containsKey(element), isFalse));
267+
]) {
268+
expect(map.containsKey(element), isFalse);
269+
}
258270
});
259271
test('fromMap', () {
260272
final props = DioAltProperties(
Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
1-
# Defines a default set of lint rules enforced for
2-
# projects at Google. For details and rationale,
3-
# see https://github.com/dart-lang/pedantic#enabled-lints.
4-
include: package:pedantic/analysis_options.yaml
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
57

6-
# For lint rules and documentation, see http://dart-lang.github.io/linter/lints.
7-
# Uncomment to specify additional rules.
8-
# linter:
9-
# rules:
10-
# - camel_case_types
8+
# The following line activates a set of recommended lints for Dart packages,
9+
# designed to encourage good coding practices.
10+
include: package:lints/recommended.yaml
1111

12-
analyzer:
13-
# exclude:
14-
# - path/to/excluded/files/**
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:lints/recommended.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at https://dart.dev/tools/linter-rules.
17+
#
18+
# Instead of disabling a lint rule for the entire project in the
19+
# section below, it can also be suppressed for a single line of code
20+
# or a specific dart file by using the `// ignore: name_of_lint` and
21+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
22+
# producing the lint.
23+
rules:
24+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
25+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
26+
27+
# Additional information about this file can be found at
28+
# https://dart.dev/tools/analysis

openapi-generator-cli/lib/src/generate_command.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import 'package:openapi_generator_cli/src/models.dart';
44
class GenerateCommand extends Command {
55
// The [name] and [description] properties must be defined by every
66
// subclass.
7+
@override
78
final name = "generate";
9+
@override
810
final description = "Record changes to the repository.";
911

10-
CommitCommand() {
12+
GenerateCommand() {
1113
// Add options based on ConfigDefaults and ConfigKeys
1214
argParser.addOption(ConfigKeys.openapiGeneratorVersion,
1315
help: 'The version of the OpenAPI generator to use.',
@@ -33,6 +35,7 @@ class GenerateCommand extends Command {
3335
}
3436

3537
// [run] may also return a Future.
38+
@override
3639
void run() {
3740
// [argResults] is set before [run()] is called and contains the flags/options
3841
// passed to this command.

openapi-generator-cli/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dependencies:
1313
cli_launcher: ^0.3.1
1414

1515
dev_dependencies:
16-
pedantic:
16+
lints: ^6.0.0
1717
test:
1818

1919
executables:

0 commit comments

Comments
 (0)