Skip to content

Commit

Permalink
Revert "Add CI and issue templates (#35)"
Browse files Browse the repository at this point in the history
This reverts commit 8ec9023.
  • Loading branch information
rrousselGit authored Nov 23, 2022
1 parent 8ec9023 commit c31c0d0
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 247 deletions.
16 changes: 0 additions & 16 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/config.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/ISSUE_TEMPLATE/example_request.md

This file was deleted.

18 changes: 0 additions & 18 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

56 changes: 0 additions & 56 deletions .github/workflows/build.yml

This file was deleted.

22 changes: 4 additions & 18 deletions packages/custom_lint/lib/basic_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ Future<void> customLint({
bool watchMode = true,
required Directory workingDirectory,
}) async {
var isDone = false;
await runZonedGuarded(() async {
final runner = CustomLintRunner(
CustomLintPlugin(
Expand Down Expand Up @@ -67,29 +66,16 @@ Future<void> customLint({
}
});

try {
await runner.initialize();
await _runPlugins(runner, reload: false);
await runner.initialize();
await _runPlugins(runner, reload: false);

if (watchMode) {
await _startWatchMode(runner);
}
} finally {
await runner.close();
if (watchMode) {
await _startWatchMode(runner);
}
}, (err, stack) {
if (isDone) {
throw StateError(
'Received an error after `runZonedGuarded` should have complete. Is an async process leaking?'
'\nThe error was: $err'
'\nat:\n$stack',
);
}
exitCode = -1;
stderr.writeln('$err\n$stack');
});

isDone = true;
}

Future<void> _runPlugins(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ class CustomLintPlugin extends ServerPlugin {

final _overlays = <String, String>{};

bool _isDisposed = false;

late final ProviderContainer _container;

/// An imperative anchor for reading the current list of plugins
Expand Down Expand Up @@ -91,7 +89,6 @@ class CustomLintPlugin extends ServerPlugin {
(previousPlugins, currentPlugins) async {
final previousLinks = await previousPlugins;
final links = await currentPlugins;
if (_isDisposed) return;

for (final linkEntry in links.entries) {
final previousLinkResult = previousLinks?[linkEntry.key];
Expand Down Expand Up @@ -468,14 +465,11 @@ class CustomLintPlugin extends ServerPlugin {
FutureOr<plugin.PluginShutdownResult> handlePluginShutdown(
plugin.PluginShutdownParams parameters,
) async {
assert(!_isDisposed, 'The plugin is already disposed');
try {
// TODO what if a plugin initialized, then context root changed and is now failing
await _requestAllPlugins(parameters);

return plugin.PluginShutdownResult();
} finally {
_isDisposed = true;
_container.dispose();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import 'dart:async';
import 'dart:io';
import 'dart:isolate';

import 'package:ci/ci.dart' as ci;

import 'analyzer_plugin.dart';
import 'client_isolate_channel.dart';
import 'plugin_delegate.dart';
Expand All @@ -17,13 +15,9 @@ void start(Iterable<String> _, SendPort sendPort) {
final channel = ClientIsolateChannel(sendPort);
server = CustomLintPlugin(
delegate: AnalyzerPluginCustomLintDelegate(),
includeBuiltInLints:
// Disable "loading" lints custom_lint is spawned from a terminal command;
// such as when using `dart analyze`
!stdin.hasTerminal &&
// In the CI, hasTerminal is often false. So let's explicitly disable
// "loading" lints for the CI too
!ci.isCI,
// Disable "loading" lints custom_lint is spawned from a terminal command;
// such as when using `dart analyze`
includeBuiltInLints: !stdin.hasTerminal,
// The necessary flags for hot-reload to work aren't set by analyzer_plugin
watchMode: false,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,7 @@ class CommandCustomLintDelegate
err,
stackTrace,
);
try {
stderr.writeln('$err\n$stackTrace');
} catch (_) {
throw Exception('Threw while trying to print message: $err\n$stackTrace');
}
stderr.writeln('$err\n$stackTrace');
}

@override
Expand Down
53 changes: 23 additions & 30 deletions packages/custom_lint/lib/src/analyzer_plugin/plugin_link.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,38 +110,31 @@ final _pluginLinkProvider = FutureProvider.autoDispose
p.join(pluginRootPath, 'bin', 'custom_lint.dart'),
);

try {
final isolate = await Isolate.spawnUri(
mainUri,
const [],
receivePort.sendPort,
// WHen published on pub or git, the plugin source often does not have a
// package_config.json. As such, we manually specify one based on the
// application that depends on the custom lint plugin.
// Since the application that uses the plugin depends on said plugin,
// the applications' package_config should contain everything that the plugin
// needs to work.
packageConfig: packageConfig,
// TODO test error in main (outside of runZonedGuarded)
debugName: pluginName,
onError: receivePort.sendPort,
);
final isolate = await Isolate.spawnUri(
mainUri,
const [],
receivePort.sendPort,
// WHen published on pub or git, the plugin source often does not have a
// package_config.json. As such, we manually specify one based on the
// application that depends on the custom lint plugin.
// Since the application that uses the plugin depends on said plugin,
// the applications' package_config should contain everything that the plugin
// needs to work.
packageConfig: packageConfig,
// TODO test error in main (outside of runZonedGuarded)
debugName: pluginName,
onError: receivePort.sendPort,
);

final link = PluginLink._(
isolate,
ServerIsolateChannel(receivePort),
pluginRootUri.uri,
pluginName,
);
ref.onDispose(link.close);
final link = PluginLink._(
isolate,
ServerIsolateChannel(receivePort),
pluginRootUri.uri,
pluginName,
);
ref.onDispose(link.close);

return link;
} on IsolateSpawnException catch (err, stack) {
Error.throwWithStackTrace(
'Failed to spawn plugin $pluginName: $err',
stack,
);
}
return link;
});

/// The interface for interacting with a plugin
Expand Down
2 changes: 0 additions & 2 deletions packages/custom_lint/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies:
analyzer_plugin: ^0.10.0
args: ^2.3.1
async: ^2.8.2
ci: ^0.1.0
cli_util: ^0.3.5
collection: ^1.15.0
meta: ^1.7.0
Expand All @@ -26,7 +25,6 @@ dependencies:
yaml: ^3.1.0

dev_dependencies:
ansi_styles: ^0.3.2+1
test: ^1.20.2

executables:
Expand Down
15 changes: 6 additions & 9 deletions packages/custom_lint/test/cli_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:test/test.dart';

import '../bin/custom_lint.dart' as cli;
import 'create_project.dart';
import 'equals_ignoring_ansi.dart';
import 'mock_fs.dart';

const oyPluginSource = '''
Expand Down Expand Up @@ -114,13 +113,13 @@ No issues found!
await cli.main();

expect(exitCode, -1);
expect(err.join(), completion(equalsIgnoringAnsi('''
IsolateSpawnException: Unable to spawn isolate: ${plugin.path}/bin/custom_lint.dart:1:1: Error: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.
expect(err.join(), completion('''
IsolateSpawnException: Unable to spawn isolate: ${plugin.path}/bin/custom_lint.dart:1:1: \x1B[31mError: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Try adding the name of the type of the variable or the keyword 'var'.\x1B[39;49m
invalid;
^^^^^^^
''')));
'''));
expect(out, emitsDone);
},
currentDirectory: app,
Expand Down Expand Up @@ -181,14 +180,12 @@ invalid;
expect(
err.join(),
completion(
equalsIgnoringAnsi(
'''
IsolateSpawnException: Unable to spawn isolate: ${plugin2.path}/bin/custom_lint.dart:1:9: Error: A value of type 'String' can't be assigned to a variable of type 'int'.
'''
IsolateSpawnException: Unable to spawn isolate: ${plugin2.path}/bin/custom_lint.dart:1:9: \x1B[31mError: A value of type 'String' can't be assigned to a variable of type 'int'.\x1B[39;49m
int x = 'oy';
^
''',
),
),
);
expect(out.join(), completion('''
Expand Down
50 changes: 0 additions & 50 deletions packages/custom_lint/test/equals_ignoring_ansi.dart

This file was deleted.

Loading

0 comments on commit c31c0d0

Please sign in to comment.