From f93b3379282c804a3335888f5e61efc38dccf2d0 Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Fri, 25 Aug 2023 22:45:58 -0500 Subject: [PATCH 1/2] Fix spelling errors --- doc/cache_layout.md | 8 ++++---- lib/src/command/deps.dart | 3 ++- lib/src/command/outdated.dart | 4 ++-- lib/src/command_runner.dart | 4 ++-- lib/src/executable.dart | 4 ++-- lib/src/global_packages.dart | 2 +- lib/src/ignore.dart | 2 +- lib/src/io.dart | 6 +++--- lib/src/lock_file.dart | 4 ++-- lib/src/package.dart | 12 ++++++------ lib/src/pubspec_parse.dart | 2 +- lib/src/solver/result.dart | 2 +- lib/src/solver/solve_suggestions.dart | 6 +++--- lib/src/source/hosted.dart | 5 +++-- lib/src/utils.dart | 2 +- test/cache/add/package_not_found_test.dart | 2 +- test/cache/preload_test.dart | 2 +- ...resolve_with_retracted_package_versions_test.dart | 2 +- test/pubspec_test.dart | 6 +++--- test/test_pub.dart | 2 +- .../goldens/help_test/pub outdated --help.txt | 2 +- .../does not allow arguments - handles bad flags.txt | 4 ++-- test/validator/file_case_test.dart | 2 +- test/validator/flutter_constraint_test.dart | 2 +- test/version_solver_test.dart | 2 +- tool/test-bin/pub_command_runner.dart | 6 +++--- 26 files changed, 50 insertions(+), 48 deletions(-) diff --git a/doc/cache_layout.md b/doc/cache_layout.md index 8cd76a7a4..5c58d369b 100644 --- a/doc/cache_layout.md +++ b/doc/cache_layout.md @@ -14,14 +14,14 @@ cache conventions. ## Location The global default pub-cache is located at: - * `$HOME/.pub_cache` on Linux and Mac OS, + * `$HOME/.pub_cache` on Linux and macOS, * `%LOCALAPPDATA%/Pub/Cache` on Windows. Prior to Flutter 3.8.0, the Flutter SDK declared `PUB_CACHE=$FLUTTER_ROOT/.pub_cache` overriding the default global pub-cache. The default location of the pub-cache can be overridden using the environment variable `PUB_CACHE`. -For the remainder of this document we refer to the location of the pub-cache as `$PUB_CACHE`.``` +For the remainder of this document we refer to the location of the pub-cache as `$PUB_CACHE`. ## Layout @@ -48,7 +48,7 @@ stored in a platform specific config dir: * On Linux `$XDG_CONFIG_HOME/dart/pub-credentials.json` if `$XDG_CONFIG_HOME` is defined, otherwise `$HOME/.config/dart/pub-credentials.json` -* On Mac OS: `$HOME/Library/Application Support/dart/pub-credentials.json` +* On macOS: `$HOME/Library/Application Support/dart/pub-credentials.json` * On Windows: `%APPDATA%/dart/pub-credentials.json` ### Hosted @@ -214,7 +214,7 @@ limitations, and we should probably rethink this). A re-activation of the package will delete all the existing snapshots. The `incremental` is used while compiling them. (TODO: We should probably remove -this after succesful compilation https://github.com/dart-lang/pub/issues/3896). +this after successful compilation https://github.com/dart-lang/pub/issues/3896). For packages activated with `--source=path` the lockfile is special-cased to just point to the activated path, and `.dart_tool/package_config.json`, snapshots are diff --git a/lib/src/command/deps.dart b/lib/src/command/deps.dart index 5b9023cde..87b889de4 100644 --- a/lib/src/command/deps.dart +++ b/lib/src/command/deps.dart @@ -71,7 +71,8 @@ class DepsCommand extends PubCommand { @override Future runProtected() async { - // Explicitly Run this in the directorycase we don't access `entrypoint.packageGraph`. + // Explicitly run this in the directory in case + // we don't access `entrypoint.packageGraph`. await entrypoint.ensureUpToDate(); final buffer = StringBuffer(); diff --git a/lib/src/command/outdated.dart b/lib/src/command/outdated.dart index 521bce0a4..5ae4a72a0 100644 --- a/lib/src/command/outdated.dart +++ b/lib/src/command/outdated.dart @@ -89,7 +89,7 @@ class OutdatedCommand extends PubCommand { argParser.addFlag( 'show-all', - help: 'Include dependencies that are already fullfilling --mode.', + help: 'Include dependencies that are already fulfilling --mode.', ); // Preserve for backwards compatibility. @@ -876,7 +876,7 @@ class _MarkedVersionDetails { final String? _prefix; final String? _suffix; - /// This should be true if the mode creating this consideres the version as + /// This should be true if the mode creating this considers the version as /// "good". /// /// By default only packages with a current version that is not as desired diff --git a/lib/src/command_runner.dart b/lib/src/command_runner.dart index 65af797dd..d7e235f3e 100644 --- a/lib/src/command_runner.dart +++ b/lib/src/command_runner.dart @@ -36,9 +36,9 @@ import 'utils.dart'; /// The name of the program that is invoking pub /// 'flutter' if we are running inside `flutter pub` 'dart' otherwise. -String topLevelProgram = _isrunningInsideFlutter ? 'flutter' : 'dart'; +String topLevelProgram = _isRunningInsideFlutter ? 'flutter' : 'dart'; -bool _isrunningInsideFlutter = +bool _isRunningInsideFlutter = (Platform.environment['PUB_ENVIRONMENT'] ?? '').contains('flutter_cli'); class PubCommandRunner extends CommandRunner implements PubTopLevel { diff --git a/lib/src/executable.dart b/lib/src/executable.dart index ea5820567..9b03a2499 100644 --- a/lib/src/executable.dart +++ b/lib/src/executable.dart @@ -132,7 +132,7 @@ Future runExecutable( } /// Runs the dart program (can be a snapshot) at [path] with [args] and hooks -/// its stdout, stderr, and sdtin to this process's. +/// its stdout, stderr, and stdin to this process's. /// /// [packageConfig] is the path to the ".dart_tool/package_config.json" file. /// @@ -140,7 +140,7 @@ Future runExecutable( /// /// Passes [vmArgs] to the vm. /// -/// Returns the programs's exit code. +/// Returns the program's exit code. /// /// Tries to run the program as an isolate if no special [vmArgs] are given /// otherwise starts new vm in a subprocess. If [alwaysUseSubprocess] is `true` diff --git a/lib/src/global_packages.dart b/lib/src/global_packages.dart index 9315c63cd..c68c6b025 100644 --- a/lib/src/global_packages.dart +++ b/lib/src/global_packages.dart @@ -867,7 +867,7 @@ fi // Write this as the system encoding since the system is going to // execute it and it might contain non-ASCII characters in the - // pathnames. + // path names. writeTextFile(tmpPath, binstub, encoding: const SystemEncoding()); if (Platform.isLinux || Platform.isMacOS) { diff --git a/lib/src/ignore.dart b/lib/src/ignore.dart index 2633521f1..75c0f1f08 100644 --- a/lib/src/ignore.dart +++ b/lib/src/ignore.dart @@ -55,7 +55,7 @@ final class Ignore { /// Each value in [patterns] will be interpreted as one or more lines from /// a `.gitignore` file, in compliance with the [`.gitignore` manual page][1]. /// - /// The keys of 'pattern' are the directories to intpret the rules relative + /// The keys of 'pattern' are the directories to interpret the rules relative /// to. The root should be the empty string, and sub-directories are separated /// by '/' (but no final '/'). /// diff --git a/lib/src/io.dart b/lib/src/io.dart index ab20655cb..264db0c26 100644 --- a/lib/src/io.dart +++ b/lib/src/io.dart @@ -346,7 +346,7 @@ List listDir( bool includeDirs = true, Iterable allowed = const [], }) { - var allowlistFilter = createFileFilter(allowed); + var allowListFilter = createFileFilter(allowed); // This is used in some performance-sensitive paths and can list many, many // files. As such, it leans more heavily towards optimization as opposed to @@ -376,9 +376,9 @@ List listDir( // If the basename is in [allowed], don't count its "/." as making the // file hidden. - if (allowlistFilter.any(pathInDir.contains)) { + if (allowListFilter.any(pathInDir.contains)) { final allowedBasename = - allowlistFilter.firstWhere(pathInDir.contains); + allowListFilter.firstWhere(pathInDir.contains); pathInDir = pathInDir.substring(0, pathInDir.length - allowedBasename.length); } diff --git a/lib/src/lock_file.dart b/lib/src/lock_file.dart index ebf04730e..cecf4072f 100644 --- a/lib/src/lock_file.dart +++ b/lib/src/lock_file.dart @@ -496,8 +496,8 @@ ${yamlToString(data)} /// Returns `true` if the [text] looks like it uses windows line endings. /// -/// The heuristic used is to count all `\n` in the text and if stricly more than -/// half of them are preceded by `\r` we report `true`. +/// The heuristic used is to count all `\n` in the text and if strictly more +/// than half of them are preceded by `\r` we report `true`. @visibleForTesting bool detectWindowsLineEndings(String text) { var index = -1; diff --git a/lib/src/package.dart b/lib/src/package.dart index fa7399ab4..eaa41bf7a 100644 --- a/lib/src/package.dart +++ b/lib/src/package.dart @@ -202,8 +202,8 @@ class Package { /// For each directory a .pubignore takes precedence over a .gitignore. /// /// Note that the returned paths will be always be below [dir], and will - /// always start with [dir] (thus alway be relative to current working - /// directory or absolute id [dir] is absolute. + /// always start with [dir] (thus always be relative to the current working + /// directory) or absolute id [dir] is absolute. /// /// To convert them to paths relative to the package root, use [p.relative]. List listFiles({String? beneath, bool recursive = true}) { @@ -275,16 +275,16 @@ class Package { '$ignoreFile had invalid pattern $pattern. ${exception.message}', ); }, - // Ignore case on MacOs and Windows, because `git clone` and + // Ignore case on macOS and Windows, because `git clone` and // `git init` will set `core.ignoreCase = true` in the local // local `.git/config` file for the repository. // - // So on Windows and MacOS most users will have case-insensitive + // So on Windows and macOS most users will have case-insensitive // behavior with `.gitignore`, hence, it seems reasonable to do // the same when we interpret `.gitignore` and `.pubignore`. // // There are cases where a user may have case-sensitive behavior - // with `.gitignore` on Windows and MacOS: + // with `.gitignore` on Windows and macOS: // // (A) The user has manually overwritten the repository // configuration setting `core.ignoreCase = false`. @@ -303,7 +303,7 @@ class Package { // > if appropriate when the repository is created. // // In either case, it seems likely that users on Windows and - // MacOS will prefer case-insensitive matching. We specifically + // macOS will prefer case-insensitive matching. We specifically // know that some tooling will generate `.PDB` files instead of // `.pdb`, see: [#3003][2] // diff --git a/lib/src/pubspec_parse.dart b/lib/src/pubspec_parse.dart index d76a049b3..3ea5f88e0 100644 --- a/lib/src/pubspec_parse.dart +++ b/lib/src/pubspec_parse.dart @@ -182,7 +182,7 @@ abstract class PubspecBase { /// that will be placed on the user's PATH. The value is the name of the /// .dart script (without extension) in the package's `bin` directory that /// should be run for that command. Both key and value must be "simple" - /// strings: alphanumerics, underscores and hypens only. If a value is + /// strings: alphanumerics, underscores and hyphens only. If a value is /// omitted, it is inferred to use the same name as the key. Map get executables { if (_executables != null) return _executables!; diff --git a/lib/src/solver/result.dart b/lib/src/solver/result.dart index 6322fb4ce..bfb7dbead 100644 --- a/lib/src/solver/result.dart +++ b/lib/src/solver/result.dart @@ -215,7 +215,7 @@ class SolveResult { category: 'pub-get', ); log.fine( - 'Sending analytics timing "pub-get" took ${resolutionTime.inMilliseconds} miliseconds', + 'Sending analytics timing "pub-get" took ${resolutionTime.inMilliseconds} milliseconds', ); } diff --git a/lib/src/solver/solve_suggestions.dart b/lib/src/solver/solve_suggestions.dart index 68a6d4306..2431b7525 100644 --- a/lib/src/solver/solve_suggestions.dart +++ b/lib/src/solver/solve_suggestions.dart @@ -17,8 +17,8 @@ import '../system_cache.dart'; import 'incompatibility.dart'; import 'incompatibility_cause.dart'; -/// Looks through the root-[incompability] of a solve-failure and tries to see if -/// the conflict could resolved by any of the following suggestions: +/// Looks through the root-[incompatibility] of a solve-failure and tries to see +/// if the conflict could resolved by any of the following suggestions: /// * An update of the current SDK. /// * Any single change to a package constraint. /// * Removing the bounds on all constraints, changing less than 5 dependencies. @@ -144,7 +144,7 @@ class _ResolutionContext { final constraint = cause.constraint; if (constraint == null) return null; - /// Find the most relevant Flutter release fullfilling the constraint. + // Find the most relevant Flutter release fulfilling the constraint. final bestRelease = await inferBestFlutterRelease({cause.sdk.identifier: constraint}); if (bestRelease == null) return null; diff --git a/lib/src/source/hosted.dart b/lib/src/source/hosted.dart index f0c230d39..6d3d0bdad 100644 --- a/lib/src/source/hosted.dart +++ b/lib/src/source/hosted.dart @@ -944,8 +944,9 @@ class HostedSource extends CachedSource { url = _directoryToUrl(directory); } on FormatException { log.error('Unable to detect hosted url from directory: $directory'); - // If _directoryToUrl can't intepret a directory name, we just silently - // ignore it and hope it's because it comes from a newer version of pub. + // If _directoryToUrl can't interpret a directory name, + // we just silently ignore it and hope it's because it + // comes from a newer version of pub. // // This is most likely because someone manually modified PUB_CACHE. return []; diff --git a/lib/src/utils.dart b/lib/src/utils.dart index 9df0a3b70..31ca1d188 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -469,7 +469,7 @@ bool get canUseAnsiCodes { String getAnsi(String ansiCode) => canUseAnsiCodes ? ansiCode : ''; /// Gets a emoji special character as unicode, or the [alternative] if unicode -/// charactors are not supported by stdout. +/// characters are not supported by stdout. String emoji(String unicode, String alternative) => canUseUnicode ? unicode : alternative; diff --git a/test/cache/add/package_not_found_test.dart b/test/cache/add/package_not_found_test.dart index e929c7bf2..0428bd95c 100644 --- a/test/cache/add/package_not_found_test.dart +++ b/test/cache/add/package_not_found_test.dart @@ -8,7 +8,7 @@ import 'package:test/test.dart'; import '../../test_pub.dart'; void main() { - test('fails if the package cound not be found on the source', () async { + test('fails if the package could not be found on the source', () async { await servePackages(); await runPub( diff --git a/test/cache/preload_test.dart b/test/cache/preload_test.dart index 314e5ed65..a9577fe86 100644 --- a/test/cache/preload_test.dart +++ b/test/cache/preload_test.dart @@ -64,7 +64,7 @@ void main() { }); test( - 'installs package according to PUB_HOSTED_URL even on non-offical server', + 'installs package according to PUB_HOSTED_URL even on non-official server', () async { final server = await servePackages(); server.serve('foo', '1.0.0'); diff --git a/test/get/hosted/resolve_with_retracted_package_versions_test.dart b/test/get/hosted/resolve_with_retracted_package_versions_test.dart index b6a907e60..bafe70094 100644 --- a/test/get/hosted/resolve_with_retracted_package_versions_test.dart +++ b/test/get/hosted/resolve_with_retracted_package_versions_test.dart @@ -45,7 +45,7 @@ void main() { // Currently retraction does not affect prioritization. I.e., if // pubspec.lock already contains a retracted version, which is the newest - // satisfying the dependency contstraint we will not choose to downgrade. + // satisfying the dependency constraint we will not choose to downgrade. // In this case we expect a newer version to be published at some point which // will then cause pub upgrade to choose that one. test('Allow retracted version when it was already in pubspec.lock', () async { diff --git a/test/pubspec_test.dart b/test/pubspec_test.dart index 990bb2a48..c06ca2140 100644 --- a/test/pubspec_test.dart +++ b/test/pubspec_test.dart @@ -602,7 +602,7 @@ dependencies: }); test( - 'default upper constraint for the SDK applies only if compatibile ' + 'default upper constraint for the SDK applies only if compatible ' 'with the lower bound', () { var pubspec = Pubspec.parse( ''' @@ -686,11 +686,11 @@ environment: test("throws if the sdk isn't a valid version constraint", () { expectPubspecException( - 'environment: {sdk: "oopies"}', + 'environment: {sdk: "oopsies"}', (pubspec) => pubspec.sdkConstraints, ); expectPubspecException( - 'environment: {sdk: 1.2.3, flutter: "oopies"}', + 'environment: {sdk: 1.2.3, flutter: "oopsies"}', (pubspec) => pubspec.sdkConstraints, ); }); diff --git a/test/test_pub.dart b/test/test_pub.dart index 3bc01592f..395a99ebd 100644 --- a/test/test_pub.dart +++ b/test/test_pub.dart @@ -1080,7 +1080,7 @@ Stream> tarFromDescriptors(Iterable contents) { } /// Replaces the entry at index 9 in [stream] with a 0. This replaces the os -/// entry of a gzip stream, giving us the same stream and thius stable testing +/// entry of a gzip stream, giving us the same stream and this stable testing /// on all platforms. /// /// See https://www.rfc-editor.org/rfc/rfc1952 section 2.3 for information diff --git a/test/testdata/goldens/help_test/pub outdated --help.txt b/test/testdata/goldens/help_test/pub outdated --help.txt index 14e83235f..ba6b13a61 100644 --- a/test/testdata/goldens/help_test/pub outdated --help.txt +++ b/test/testdata/goldens/help_test/pub outdated --help.txt @@ -12,7 +12,7 @@ Usage: pub outdated [options] (defaults to on) --json Output the results using a json format. --[no-]prereleases Include prereleases in latest version. - --[no-]show-all Include dependencies that are already fullfilling --mode. + --[no-]show-all Include dependencies that are already fulfilling --mode. --[no-]transitive Show transitive dependencies. -C, --directory= Run this in the directory . diff --git a/test/testdata/goldens/outdated/outdated_test/does not allow arguments - handles bad flags.txt b/test/testdata/goldens/outdated/outdated_test/does not allow arguments - handles bad flags.txt index ad60ceba9..97b2feff1 100644 --- a/test/testdata/goldens/outdated/outdated_test/does not allow arguments - handles bad flags.txt +++ b/test/testdata/goldens/outdated/outdated_test/does not allow arguments - handles bad flags.txt @@ -13,7 +13,7 @@ $ pub outdated random_argument [STDERR] --json Output the results using a json format. [STDERR] --[no-]prereleases Include prereleases in latest version. [STDERR] --[no-]show-all Include dependencies that are already -[STDERR] fullfilling --mode. +[STDERR] fulfilling --mode. [STDERR] --[no-]transitive Show transitive dependencies. [STDERR] -C, --directory= Run this in the directory . [STDERR] @@ -36,7 +36,7 @@ $ pub outdated --bad_flag [STDERR] --json Output the results using a json format. [STDERR] --[no-]prereleases Include prereleases in latest version. [STDERR] --[no-]show-all Include dependencies that are already -[STDERR] fullfilling --mode. +[STDERR] fulfilling --mode. [STDERR] --[no-]transitive Show transitive dependencies. [STDERR] -C, --directory= Run this in the directory . [STDERR] diff --git a/test/validator/file_case_test.dart b/test/validator/file_case_test.dart index 37b279ff2..fd43eb308 100644 --- a/test/validator/file_case_test.dart +++ b/test/validator/file_case_test.dart @@ -5,7 +5,7 @@ // These tests only work on case-sensitive file systems (ie. only on linux). @OnPlatform({ 'windows': Skip('Windows file system is case-insensitive'), - 'mac-os': Skip('MacOS file system is case-insensitive'), + 'mac-os': Skip('macOS file system is case-insensitive'), }) library; diff --git a/test/validator/flutter_constraint_test.dart b/test/validator/flutter_constraint_test.dart index 60800a209..5c0b2058c 100644 --- a/test/validator/flutter_constraint_test.dart +++ b/test/validator/flutter_constraint_test.dart @@ -31,7 +31,7 @@ Future setup({ d.pubspec({ 'name': 'test_pkg', 'description': - 'A just long enough decription to fit the requirement of 60 characters', + 'A just long enough description to fit the requirement of 60 characters', 'homepage': 'https://example.com/', 'version': '1.0.0', 'environment': { diff --git a/test/version_solver_test.dart b/test/version_solver_test.dart index 2712ad40a..b9ec6a2e9 100644 --- a/test/version_solver_test.dart +++ b/test/version_solver_test.dart @@ -1711,7 +1711,7 @@ void override() { await expectResolves(result: {'a': '2.0.0', 'b': '1.0.0', 'c': '1.0.0'}); }); - test('backtracks on overidden package for its constraints', () async { + test('backtracks on overridden package for its constraints', () async { await servePackages() ..serve('a', '1.0.0', deps: {'shared': 'any'}) ..serve('a', '2.0.0', deps: {'shared': '1.0.0'}) diff --git a/tool/test-bin/pub_command_runner.dart b/tool/test-bin/pub_command_runner.dart index 8e28d14bd..a11a2a486 100644 --- a/tool/test-bin/pub_command_runner.dart +++ b/tool/test-bin/pub_command_runner.dart @@ -19,8 +19,8 @@ import 'package:usage/usage.dart'; final Analytics loggingAnalytics = _LoggingAnalytics(); -// A command for explicitly throwing an exception, to test the handling of -// unexpected eceptions. +/// A command for explicitly throwing an exception, to test the handling of +/// unexpected exceptions. class ThrowingCommand extends PubCommand { @override String get name => 'fail'; @@ -36,7 +36,7 @@ class ThrowingCommand extends PubCommand { } } -// A command for testing the ensurePubspecResolved functionality +/// A command for testing the [ensurePubspecResolved] functionality. class EnsurePubspecResolvedCommand extends PubCommand { @override String get name => 'ensure-pubspec-resolved'; From 3be60e7f054ef9d2552ee78ce6ff4951a7fa740e Mon Sep 17 00:00:00 2001 From: Parker Lougheed Date: Fri, 25 Aug 2023 22:49:20 -0500 Subject: [PATCH 2/2] Fix formatting --- lib/src/command/deps.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/command/deps.dart b/lib/src/command/deps.dart index 87b889de4..ae1b6dcb9 100644 --- a/lib/src/command/deps.dart +++ b/lib/src/command/deps.dart @@ -71,7 +71,7 @@ class DepsCommand extends PubCommand { @override Future runProtected() async { - // Explicitly run this in the directory in case + // Explicitly run this in the directory in case // we don't access `entrypoint.packageGraph`. await entrypoint.ensureUpToDate(); final buffer = StringBuffer();