Skip to content
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 CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 0.23.3


- Support for multiple `include:` entry in `analysis_options.yaml`.

## 0.23.2

Expand Down
32 changes: 19 additions & 13 deletions lib/src/sdk_env.dart
Original file line number Diff line number Diff line change
Expand Up @@ -595,21 +595,28 @@ class ToolEnvironment {
);

// extract the package name from the `include: package:<package>/path.yaml` entry in analysis options:
String? includedPackage;
final includedPackages = <String>{};
final analysisOptionsFile = File(
p.join(packageDir, 'analysis_options.yaml'),
);
if (await analysisOptionsFile.exists()) {
void addPackageInclude(String includeValue) {
final include = includeValue.trim();
if (include.startsWith('package:')) {
includedPackages.add(
include.substring('package:'.length).split('/').first,
);
}
}

final analysisOptions = await analysisOptionsFile.readAsString();
final parsed = yamlToJson(analysisOptions);
final includeValue = parsed?['include'];
if (includeValue is String) {
final include = includeValue.trim();
if (include.startsWith('package:')) {
includedPackage = include
.substring('package:'.length)
.split('/')
.first;
addPackageInclude(includeValue);
} else if (includeValue is List) {
for (final v in includeValue.whereType<String>()) {
addPackageInclude(v);
}
}
}
Expand All @@ -621,16 +628,15 @@ class ToolEnvironment {
if (oldDevDependencies is Map<String, dynamic>) {
final keptDevDependencies = <String, dynamic>{};
for (final name in oldDevDependencies.keys) {
if (name != includedPackage) continue;
if (!includedPackages.contains(name)) {
continue;
}
final value = oldDevDependencies[name];
var passthrough = true;
if (value is Map &&
(value.containsKey('path') || value.containsKey('git'))) {
passthrough = false;
}
if (passthrough) {
keptDevDependencies[name] = value;
continue;
}
keptDevDependencies[name] = value;
}
if (keptDevDependencies.isNotEmpty) {
parsed['dev_dependencies'] = keptDevDependencies;
Expand Down
13 changes: 13 additions & 0 deletions test/analysis_options_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,19 @@ linter:
expect(json.decode(content), {'include': 'package:lints/other.yaml'});
});

test('update includes from original', () {
final content = updatePassthroughOptions(
original:
'include:\n'
' - package:lints/other.yaml\n'
' - package:lints/core.yaml\n',
custom: '',
);
expect(json.decode(content), {
'include': ['package:lints/other.yaml', 'package:lints/core.yaml'],
});
});

test('include only in custom', () {
final content = updatePassthroughOptions(
original: '',
Expand Down
4 changes: 1 addition & 3 deletions test/goldens/end2end/audio_service-0.18.17.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
"material_color_utilities",
"meta",
"mockito",
"objective_c",
"path",
"path_provider",
"path_provider_android",
Expand All @@ -100,7 +99,6 @@
"path_provider_windows",
"platform",
"plugin_platform_interface",
"pub_semver",
"rxdart",
"source_span",
"sqflite",
Expand Down Expand Up @@ -173,7 +171,7 @@
"grantedPoints": 30,
"maxPoints": 40,
"status": "failed",
"summary": "### [x] 0/10 points: All of the package dependencies are supported in the latest version\n\n|Package|Constraint|Compatible|Latest|Notes|\n|:-|:-|:-|:-|:-|\n|[`audio_service_platform_interface`]|`^0.1.3`|0.1.3|0.1.3||\n|[`audio_service_web`]|`^0.1.4`|0.1.4|0.1.4||\n|[`audio_session`]|`^0.1.25`|0.1.25|**0.2.2**||\n|[`clock`]|`^1.1.0`|1.1.2|1.1.2||\n|[`flutter_cache_manager`]|`^3.3.1`|3.4.1|3.4.1||\n|[`js`]|`>=0.6.3 <0.8.0`|0.7.2|0.7.2|**Discontinued**|\n|[`rxdart`]|`>=0.26.0 <0.29.0`|0.28.0|0.28.0||\n\n<details><summary>Transitive dependencies</summary>\n\n|Package|Constraint|Compatible|Latest|Notes|\n|:-|:-|:-|:-|:-|\n|[`async`]|-|2.13.0|2.13.0||\n|[`characters`]|-|1.4.0|1.4.1||\n|[`collection`]|-|1.19.1|1.19.1||\n|[`crypto`]|-|3.0.7|3.0.7||\n|[`ffi`]|-|2.1.4|2.1.4||\n|[`file`]|-|7.0.1|7.0.1||\n|[`fixnum`]|-|1.1.1|1.1.1||\n|[`http`]|-|1.6.0|1.6.0||\n|[`http_parser`]|-|4.1.2|4.1.2||\n|[`material_color_utilities`]|-|0.11.1|0.13.0||\n|[`meta`]|-|1.17.0|1.17.0||\n|[`objective_c`]|-|9.1.0|9.1.0||\n|[`path`]|-|1.9.1|1.9.1||\n|[`path_provider`]|-|2.1.5|2.1.5||\n|[`path_provider_android`]|-|2.2.22|2.2.22||\n|[`path_provider_foundation`]|-|2.5.0|2.5.0||\n|[`path_provider_linux`]|-|2.2.1|2.2.1||\n|[`path_provider_platform_interface`]|-|2.1.2|2.1.2||\n|[`path_provider_windows`]|-|2.3.0|2.3.0||\n|[`platform`]|-|3.1.6|3.1.6||\n|[`plugin_platform_interface`]|-|2.1.8|2.1.8||\n|[`pub_semver`]|-|2.2.0|2.2.0||\n|[`source_span`]|-|1.10.1|1.10.1||\n|[`sqflite`]|-|2.4.2|2.4.2||\n|[`sqflite_android`]|-|2.4.2+2|2.4.2+2||\n|[`sqflite_common`]|-|2.5.6|2.5.6||\n|[`sqflite_darwin`]|-|2.4.2|2.4.2||\n|[`sqflite_platform_interface`]|-|2.4.0|2.4.0||\n|[`string_scanner`]|-|1.4.1|1.4.1||\n|[`synchronized`]|-|3.4.0|3.4.0||\n|[`term_glyph`]|-|1.2.2|1.2.2||\n|[`typed_data`]|-|1.4.0|1.4.0||\n|[`uuid`]|-|4.5.2|4.5.2||\n|[`vector_math`]|-|2.2.0|2.2.0||\n|[`web`]|-|1.1.1|1.1.1||\n|[`xdg_directories`]|-|1.1.0|1.1.0||\n</details>\n\nTo reproduce run `dart pub outdated --no-dev-dependencies --up-to-date --no-dependency-overrides`.\n\n[`audio_service_platform_interface`]: https://pub.dev/packages/audio_service_platform_interface\n[`audio_service_web`]: https://pub.dev/packages/audio_service_web\n[`audio_session`]: https://pub.dev/packages/audio_session\n[`clock`]: https://pub.dev/packages/clock\n[`flutter_cache_manager`]: https://pub.dev/packages/flutter_cache_manager\n[`js`]: https://pub.dev/packages/js\n[`rxdart`]: https://pub.dev/packages/rxdart\n[`async`]: https://pub.dev/packages/async\n[`characters`]: https://pub.dev/packages/characters\n[`collection`]: https://pub.dev/packages/collection\n[`crypto`]: https://pub.dev/packages/crypto\n[`ffi`]: https://pub.dev/packages/ffi\n[`file`]: https://pub.dev/packages/file\n[`fixnum`]: https://pub.dev/packages/fixnum\n[`http`]: https://pub.dev/packages/http\n[`http_parser`]: https://pub.dev/packages/http_parser\n[`material_color_utilities`]: https://pub.dev/packages/material_color_utilities\n[`meta`]: https://pub.dev/packages/meta\n[`objective_c`]: https://pub.dev/packages/objective_c\n[`path`]: https://pub.dev/packages/path\n[`path_provider`]: https://pub.dev/packages/path_provider\n[`path_provider_android`]: https://pub.dev/packages/path_provider_android\n[`path_provider_foundation`]: https://pub.dev/packages/path_provider_foundation\n[`path_provider_linux`]: https://pub.dev/packages/path_provider_linux\n[`path_provider_platform_interface`]: https://pub.dev/packages/path_provider_platform_interface\n[`path_provider_windows`]: https://pub.dev/packages/path_provider_windows\n[`platform`]: https://pub.dev/packages/platform\n[`plugin_platform_interface`]: https://pub.dev/packages/plugin_platform_interface\n[`pub_semver`]: https://pub.dev/packages/pub_semver\n[`source_span`]: https://pub.dev/packages/source_span\n[`sqflite`]: https://pub.dev/packages/sqflite\n[`sqflite_android`]: https://pub.dev/packages/sqflite_android\n[`sqflite_common`]: https://pub.dev/packages/sqflite_common\n[`sqflite_darwin`]: https://pub.dev/packages/sqflite_darwin\n[`sqflite_platform_interface`]: https://pub.dev/packages/sqflite_platform_interface\n[`string_scanner`]: https://pub.dev/packages/string_scanner\n[`synchronized`]: https://pub.dev/packages/synchronized\n[`term_glyph`]: https://pub.dev/packages/term_glyph\n[`typed_data`]: https://pub.dev/packages/typed_data\n[`uuid`]: https://pub.dev/packages/uuid\n[`vector_math`]: https://pub.dev/packages/vector_math\n[`web`]: https://pub.dev/packages/web\n[`xdg_directories`]: https://pub.dev/packages/xdg_directories\n\n<details>\n<summary>\nThe constraint `^0.1.25` on audio_session does not support the stable version `0.2.0`.\n</summary>\n\nTry running `dart pub upgrade --major-versions audio_session` to update the constraint.\n</details>\n\n<details>\n<summary>\nThe package has one or more discontinued direct dependencies.\n\nDiscontinued packages are no longer maintained, and can end up being a\nliability.\n\n</summary>\n\nConsider migrating away from these dependencies: \n\n* js.\n\n</details>\n\n### [*] 10/10 points: Package supports latest stable Dart and Flutter SDKs\n\n### [*] 20/20 points: Compatible with dependency constraint lower bounds\n\n`pub downgrade` does not expose any static analysis error.\n"
"summary": "### [x] 0/10 points: All of the package dependencies are supported in the latest version\n\n|Package|Constraint|Compatible|Latest|Notes|\n|:-|:-|:-|:-|:-|\n|[`audio_service_platform_interface`]|`^0.1.3`|0.1.3|0.1.3||\n|[`audio_service_web`]|`^0.1.4`|0.1.4|0.1.4||\n|[`audio_session`]|`^0.1.25`|0.1.25|**0.2.2**||\n|[`clock`]|`^1.1.0`|1.1.2|1.1.2||\n|[`flutter_cache_manager`]|`^3.3.1`|3.4.1|3.4.1||\n|[`js`]|`>=0.6.3 <0.8.0`|0.7.2|0.7.2|**Discontinued**|\n|[`rxdart`]|`>=0.26.0 <0.29.0`|0.28.0|0.28.0||\n\n<details><summary>Transitive dependencies</summary>\n\n|Package|Constraint|Compatible|Latest|Notes|\n|:-|:-|:-|:-|:-|\n|[`async`]|-|2.13.0|2.13.0||\n|[`characters`]|-|1.4.0|1.4.1||\n|[`collection`]|-|1.19.1|1.19.1||\n|[`crypto`]|-|3.0.7|3.0.7||\n|[`ffi`]|-|2.1.4|2.1.4||\n|[`file`]|-|7.0.1|7.0.1||\n|[`fixnum`]|-|1.1.1|1.1.1||\n|[`http`]|-|1.6.0|1.6.0||\n|[`http_parser`]|-|4.1.2|4.1.2||\n|[`material_color_utilities`]|-|0.11.1|0.13.0||\n|[`meta`]|-|1.17.0|1.17.0||\n|[`path`]|-|1.9.1|1.9.1||\n|[`path_provider`]|-|2.1.5|2.1.5||\n|[`path_provider_android`]|-|2.2.22|2.2.22||\n|[`path_provider_foundation`]|-|2.4.4|2.4.4||\n|[`path_provider_linux`]|-|2.2.1|2.2.1||\n|[`path_provider_platform_interface`]|-|2.1.2|2.1.2||\n|[`path_provider_windows`]|-|2.3.0|2.3.0||\n|[`platform`]|-|3.1.6|3.1.6||\n|[`plugin_platform_interface`]|-|2.1.8|2.1.8||\n|[`source_span`]|-|1.10.1|1.10.1||\n|[`sqflite`]|-|2.4.2|2.4.2||\n|[`sqflite_android`]|-|2.4.2+2|2.4.2+2||\n|[`sqflite_common`]|-|2.5.6|2.5.6||\n|[`sqflite_darwin`]|-|2.4.2|2.4.2||\n|[`sqflite_platform_interface`]|-|2.4.0|2.4.0||\n|[`string_scanner`]|-|1.4.1|1.4.1||\n|[`synchronized`]|-|3.4.0|3.4.0||\n|[`term_glyph`]|-|1.2.2|1.2.2||\n|[`typed_data`]|-|1.4.0|1.4.0||\n|[`uuid`]|-|4.5.2|4.5.2||\n|[`vector_math`]|-|2.2.0|2.2.0||\n|[`web`]|-|1.1.1|1.1.1||\n|[`xdg_directories`]|-|1.1.0|1.1.0||\n</details>\n\nTo reproduce run `dart pub outdated --no-dev-dependencies --up-to-date --no-dependency-overrides`.\n\n[`audio_service_platform_interface`]: https://pub.dev/packages/audio_service_platform_interface\n[`audio_service_web`]: https://pub.dev/packages/audio_service_web\n[`audio_session`]: https://pub.dev/packages/audio_session\n[`clock`]: https://pub.dev/packages/clock\n[`flutter_cache_manager`]: https://pub.dev/packages/flutter_cache_manager\n[`js`]: https://pub.dev/packages/js\n[`rxdart`]: https://pub.dev/packages/rxdart\n[`async`]: https://pub.dev/packages/async\n[`characters`]: https://pub.dev/packages/characters\n[`collection`]: https://pub.dev/packages/collection\n[`crypto`]: https://pub.dev/packages/crypto\n[`ffi`]: https://pub.dev/packages/ffi\n[`file`]: https://pub.dev/packages/file\n[`fixnum`]: https://pub.dev/packages/fixnum\n[`http`]: https://pub.dev/packages/http\n[`http_parser`]: https://pub.dev/packages/http_parser\n[`material_color_utilities`]: https://pub.dev/packages/material_color_utilities\n[`meta`]: https://pub.dev/packages/meta\n[`path`]: https://pub.dev/packages/path\n[`path_provider`]: https://pub.dev/packages/path_provider\n[`path_provider_android`]: https://pub.dev/packages/path_provider_android\n[`path_provider_foundation`]: https://pub.dev/packages/path_provider_foundation\n[`path_provider_linux`]: https://pub.dev/packages/path_provider_linux\n[`path_provider_platform_interface`]: https://pub.dev/packages/path_provider_platform_interface\n[`path_provider_windows`]: https://pub.dev/packages/path_provider_windows\n[`platform`]: https://pub.dev/packages/platform\n[`plugin_platform_interface`]: https://pub.dev/packages/plugin_platform_interface\n[`source_span`]: https://pub.dev/packages/source_span\n[`sqflite`]: https://pub.dev/packages/sqflite\n[`sqflite_android`]: https://pub.dev/packages/sqflite_android\n[`sqflite_common`]: https://pub.dev/packages/sqflite_common\n[`sqflite_darwin`]: https://pub.dev/packages/sqflite_darwin\n[`sqflite_platform_interface`]: https://pub.dev/packages/sqflite_platform_interface\n[`string_scanner`]: https://pub.dev/packages/string_scanner\n[`synchronized`]: https://pub.dev/packages/synchronized\n[`term_glyph`]: https://pub.dev/packages/term_glyph\n[`typed_data`]: https://pub.dev/packages/typed_data\n[`uuid`]: https://pub.dev/packages/uuid\n[`vector_math`]: https://pub.dev/packages/vector_math\n[`web`]: https://pub.dev/packages/web\n[`xdg_directories`]: https://pub.dev/packages/xdg_directories\n\n<details>\n<summary>\nThe constraint `^0.1.25` on audio_session does not support the stable version `0.2.0`.\n</summary>\n\nTry running `dart pub upgrade --major-versions audio_session` to update the constraint.\n</details>\n\n<details>\n<summary>\nThe package has one or more discontinued direct dependencies.\n\nDiscontinued packages are no longer maintained, and can end up being a\nliability.\n\n</summary>\n\nConsider migrating away from these dependencies: \n\n* js.\n\n</details>\n\n### [*] 10/10 points: Package supports latest stable Dart and Flutter SDKs\n\n### [*] 20/20 points: Compatible with dependency constraint lower bounds\n\n`pub downgrade` does not expose any static analysis error.\n"
}
]
},
Expand Down
6 changes: 1 addition & 5 deletions test/goldens/end2end/audio_service-0.18.17.json_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,15 @@ To reproduce make sure you are using the [lints_core](https://pub.dev/packages/l
|[`http_parser`]|-|4.1.2|4.1.2||
|[`material_color_utilities`]|-|0.11.1|0.13.0||
|[`meta`]|-|1.17.0|1.17.0||
|[`objective_c`]|-|9.1.0|9.1.0||
|[`path`]|-|1.9.1|1.9.1||
|[`path_provider`]|-|2.1.5|2.1.5||
|[`path_provider_android`]|-|2.2.22|2.2.22||
|[`path_provider_foundation`]|-|2.5.0|2.5.0||
|[`path_provider_foundation`]|-|2.4.4|2.4.4||
|[`path_provider_linux`]|-|2.2.1|2.2.1||
|[`path_provider_platform_interface`]|-|2.1.2|2.1.2||
|[`path_provider_windows`]|-|2.3.0|2.3.0||
|[`platform`]|-|3.1.6|3.1.6||
|[`plugin_platform_interface`]|-|2.1.8|2.1.8||
|[`pub_semver`]|-|2.2.0|2.2.0||
|[`source_span`]|-|1.10.1|1.10.1||
|[`sqflite`]|-|2.4.2|2.4.2||
|[`sqflite_android`]|-|2.4.2+2|2.4.2+2||
Expand Down Expand Up @@ -189,7 +187,6 @@ To reproduce run `dart pub outdated --no-dev-dependencies --up-to-date --no-depe
[`http_parser`]: https://pub.dev/packages/http_parser
[`material_color_utilities`]: https://pub.dev/packages/material_color_utilities
[`meta`]: https://pub.dev/packages/meta
[`objective_c`]: https://pub.dev/packages/objective_c
[`path`]: https://pub.dev/packages/path
[`path_provider`]: https://pub.dev/packages/path_provider
[`path_provider_android`]: https://pub.dev/packages/path_provider_android
Expand All @@ -199,7 +196,6 @@ To reproduce run `dart pub outdated --no-dev-dependencies --up-to-date --no-depe
[`path_provider_windows`]: https://pub.dev/packages/path_provider_windows
[`platform`]: https://pub.dev/packages/platform
[`plugin_platform_interface`]: https://pub.dev/packages/plugin_platform_interface
[`pub_semver`]: https://pub.dev/packages/pub_semver
[`source_span`]: https://pub.dev/packages/source_span
[`sqflite`]: https://pub.dev/packages/sqflite
[`sqflite_android`]: https://pub.dev/packages/sqflite_android
Expand Down
Loading