Skip to content

Commit

Permalink
Fixes analysis issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bspinner committed Oct 29, 2024
1 parent c040977 commit c1f5d00
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions packages/melos/lib/src/scripts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ class Script {
}
}

/// Identifies path of currently running melos and reuses it for nested script execution.
/// Identifies path of currently running melos and reuses it
/// for nested script execution.
///
/// Starting melos by just calling `melos` via shell
/// would use the first found binary found in `$PATH`,
Expand All @@ -352,23 +353,28 @@ class Script {
/// could differ.
///
/// Besides ensuring starting the same melos as currently running,
/// this furthermore enables use of melos in environments
/// where `.pub-cache/bin` should/must not be put in `$PATH`.
/// this furthermore enables use of melos in environments where
/// `.pub-cache/bin` should/must not be put in `$PATH`.
List<String> _determineMelosExecutablePaths() {
final currentExecutablePathString = currentPlatform.resolvedExecutable;
final currentExecutablePathUri = Uri.file(currentExecutablePathString);
if (!currentExecutablePathUri.isAbsolute) {
throw 'Got invalid, unsupported or relative path to running executable. Expected absolute path.';
throw FormatException(
'Got invalid, unsupported or relative path to running executable.'

Check notice on line 363 in packages/melos/lib/src/scripts.dart

View workflow job for this annotation

GitHub Actions / analyze

Missing whitespace between adjacent strings.

Try adding whitespace between the strings. See https://dart.dev/lints/missing_whitespace_between_adjacent_strings to learn more about this problem.

Check notice on line 363 in packages/melos/lib/src/scripts.dart

View workflow job for this annotation

GitHub Actions / analyze

Missing whitespace between adjacent strings.

Try adding whitespace between the strings. See https://dart.dev/lints/missing_whitespace_between_adjacent_strings to learn more about this problem.
'Expected absolute path.');

Check notice on line 364 in packages/melos/lib/src/scripts.dart

View workflow job for this annotation

GitHub Actions / analyze

Use 'const' with the constructor to improve performance.

Try adding the 'const' keyword to the constructor invocation. See https://dart.dev/diagnostics/prefer_const_constructors to learn more about this problem.

Check notice on line 364 in packages/melos/lib/src/scripts.dart

View workflow job for this annotation

GitHub Actions / analyze

Use 'const' with the constructor to improve performance.

Try adding the 'const' keyword to the constructor invocation. See https://dart.dev/diagnostics/prefer_const_constructors to learn more about this problem.
}

final currentScriptPathUri = currentPlatform.script;
final currentScriptPathString = currentScriptPathUri.toFilePath();
if (!currentScriptPathString.isEmpty && !currentScriptPathUri.isAbsolute) {
throw 'Got invalid, unsupported or relative path to melos. Expected absolute path.';
if (currentScriptPathString.isNotEmpty &&
!currentScriptPathUri.isAbsolute) {
throw FormatException(
'Got invalid, unsupported or relative path to melos.'

Check notice on line 372 in packages/melos/lib/src/scripts.dart

View workflow job for this annotation

GitHub Actions / analyze

Missing whitespace between adjacent strings.

Try adding whitespace between the strings. See https://dart.dev/lints/missing_whitespace_between_adjacent_strings to learn more about this problem.

Check notice on line 372 in packages/melos/lib/src/scripts.dart

View workflow job for this annotation

GitHub Actions / analyze

Missing whitespace between adjacent strings.

Try adding whitespace between the strings. See https://dart.dev/lints/missing_whitespace_between_adjacent_strings to learn more about this problem.
'Expected absolute path.');

Check notice on line 373 in packages/melos/lib/src/scripts.dart

View workflow job for this annotation

GitHub Actions / analyze

Use 'const' with the constructor to improve performance.

Try adding the 'const' keyword to the constructor invocation. See https://dart.dev/diagnostics/prefer_const_constructors to learn more about this problem.

Check notice on line 373 in packages/melos/lib/src/scripts.dart

View workflow job for this annotation

GitHub Actions / analyze

Use 'const' with the constructor to improve performance.

Try adding the 'const' keyword to the constructor invocation. See https://dart.dev/diagnostics/prefer_const_constructors to learn more about this problem.
}

// Determine if melos is running as script or compiled binary
final isScriptPathAvailable = !currentScriptPathString.isEmpty;
final isScriptPathAvailable = currentScriptPathString.isNotEmpty;
final isCompiledMelosRunning =
currentExecutablePathUri == currentScriptPathUri;

Expand Down

0 comments on commit c1f5d00

Please sign in to comment.