From 041f2017ec5c1c4bb76c266bf3aa57ab0c1d2204 Mon Sep 17 00:00:00 2001 From: Moshe Dicker <75931499+dickermoshe@users.noreply.github.com> Date: Thu, 19 Sep 2024 03:55:18 +0000 Subject: [PATCH] docs: better doccomments --- packages/custom_lint/lib/src/workspace.dart | 23 +++++++++------------ 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/packages/custom_lint/lib/src/workspace.dart b/packages/custom_lint/lib/src/workspace.dart index 0413a3b0..77a9fd22 100644 --- a/packages/custom_lint/lib/src/workspace.dart +++ b/packages/custom_lint/lib/src/workspace.dart @@ -628,7 +628,7 @@ publish_to: 'none' projects.expand((e) => e.pubspec.devDependencies.keys).toSet(); final uniqueDependencyOverridesNames = projects.expand((e) => e.pubspec.dependencyOverrides.keys).toSet(); - // Note: Regular dependencies which are dev_dependencies in other projects are ignored. + // Note: dependencies which are `dependencies` AND `dev_dependencies` are ignored. final exclusivelyRegularDependencyNames = projects .expand((e) => e.pubspec.dependencies.keys) .whereNot(uniqueDevDependencyNames.contains) @@ -669,8 +669,7 @@ publish_to: 'none' ), }; - // Create a list of dependencies with constraints which will be written to the pubspec.yaml. - final dependenciesWithConstraints = ( + final dependencyConstraints = ( dependencies: {}, devDependencies: {}, ); @@ -681,8 +680,8 @@ publish_to: 'none' if (allDependencies == null) continue; // Determine if this is a dev_dependency or a dependency. - // Note: Being that we ignore dependencies that are both dev_dependencies and dependencies, - // `devDependencies.isNotEmpty` and `dependencies.isNotEmpty` are mutually exclusive. + // Note: We ignore dependencies that are in both `dev_dependencies` and `dependencies`, + // so `devDependencies.isNotEmpty` and `dependencies.isNotEmpty` are mutually exclusive. final bool isDevDependency; if (allDependencies.devDependencies.isNotEmpty) { isDevDependency = true; @@ -709,24 +708,22 @@ publish_to: 'none' // Add the dependency to the appropriate dependency map. if (isDevDependency) { - dependenciesWithConstraints.devDependencies[name] = constraint; + dependencyConstraints.devDependencies[name] = constraint; } else { - dependenciesWithConstraints.dependencies[name] = constraint; + dependencyConstraints.dependencies[name] = constraint; } } // Write the dependencies to the buffer. - if (dependenciesWithConstraints.dependencies.isNotEmpty) { + if (dependencyConstraints.dependencies.isNotEmpty) { buffer.writeln('\ndependencies:'); - for (final dependency - in dependenciesWithConstraints.dependencies.entries) { + for (final dependency in dependencyConstraints.dependencies.entries) { buffer.writeln(' ${dependency.key}: ${dependency.value}'); } } - if (dependenciesWithConstraints.devDependencies.isNotEmpty) { + if (dependencyConstraints.devDependencies.isNotEmpty) { buffer.writeln('\ndev_dependencies:'); - for (final dependency - in dependenciesWithConstraints.devDependencies.entries) { + for (final dependency in dependencyConstraints.devDependencies.entries) { buffer.writeln(' ${dependency.key}: ${dependency.value}'); } }