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
12 changes: 0 additions & 12 deletions src/lib/actions/ConfigAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,15 @@ export class ConfigAction {
telemetryListener.listen(userCore);

const enginePlugins: EnginePlugin[] = this.dependencies.pluginsFactory.create();
const enginePluginModules: string[] = userConfig.getCustomEnginePluginModules();

const userEnginePromises: Promise<void>[] = [
...enginePlugins.map(enginePlugin => userCore.addEnginePlugin(enginePlugin)),
...enginePluginModules.map(pluginModule => userCore.dynamicallyAddEnginePlugin(pluginModule)),
];
await Promise.all(userEnginePromises);


// ==== PREPARE DEFAULT CONFIG (with disable_engine settings kept) AND DEFAULT CODE ANALYZER ===================

// TODO: We are currently only passing in the enginePlugins here which are not all plugins. We need to
// include the dynamically loaded plugins... but dynamicallyAddEnginePlugin loads and adds and so we never get
// access to the plugins. We need to update core to separate the concerns so that we just have a
// dynamicallyLoadEnginePlugin to just return the plugin so that we can add these plugins to this list.
// And/Or we could just have the Code Analyzer class return a list of the engines that were disabled so that
// we don't need this helper function here.
const disabledEngines: string[] = getDisabledEngineNames(enginePlugins, new Set(userCore.getEngineNames()));

type engineDisableInfo = { engines: { [key: string]: { disable_engine: boolean } } };
Expand All @@ -95,10 +87,6 @@ export class ConfigAction {
const defaultEnginePromises: Promise<void>[] = [
...enginePlugins.map(enginePlugin => defaultCoreForAllRules.addEnginePlugin(enginePlugin)),
...enginePlugins.map(enginePlugin => defaultCoreForSelectRules.addEnginePlugin(enginePlugin)),
// Assumption: Every engine's default configuration is sufficient to allow that engine to be instantiated,
// or throw a clear error indicating the problem.
...enginePluginModules.map(pluginModule => defaultCoreForAllRules.dynamicallyAddEnginePlugin(pluginModule)),
...enginePluginModules.map(pluginModule => defaultCoreForSelectRules.dynamicallyAddEnginePlugin(pluginModule)),
];
await Promise.all(defaultEnginePromises);

Expand Down
4 changes: 1 addition & 3 deletions src/lib/actions/RulesAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ export class RulesAction {
const telemetryListener: TelemetryEventListener = new TelemetryEventListener(this.dependencies.telemetryEmitter);
telemetryListener.listen(core);
const enginePlugins = this.dependencies.pluginsFactory.create();
const enginePluginModules = config.getCustomEnginePluginModules();
const addEnginePromises: Promise<void>[] = [
...enginePlugins.map(enginePlugin => core.addEnginePlugin(enginePlugin)),
...enginePluginModules.map(pluginModule => core.dynamicallyAddEnginePlugin(pluginModule))
...enginePlugins.map(enginePlugin => core.addEnginePlugin(enginePlugin))
];
await Promise.all(addEnginePromises);
const workspace: string[]|undefined = input.workspace || (input.target ? ['.'] : undefined);
Expand Down
4 changes: 1 addition & 3 deletions src/lib/actions/RunAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,8 @@ export class RunAction {
const telemetryListener: TelemetryEventListener = new TelemetryEventListener(this.dependencies.telemetryEmitter);
telemetryListener.listen(core);
const enginePlugins = this.dependencies.pluginsFactory.create();
const enginePluginModules = config.getCustomEnginePluginModules();
const addEnginePromises: Promise<void>[] = [
...enginePlugins.map(enginePlugin => core.addEnginePlugin(enginePlugin)),
...enginePluginModules.map(pluginModule => core.dynamicallyAddEnginePlugin(pluginModule))
...enginePlugins.map(enginePlugin => core.addEnginePlugin(enginePlugin))
];
await Promise.all(addEnginePromises);
const workspace: Workspace = await createWorkspace(core, input.workspace, input.target);
Expand Down
4 changes: 0 additions & 4 deletions test/lib/actions/RulesAction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,3 @@ describe('RulesAction tests', () => {
});
})
});

// TODO: Whenever we decide to document the custom_engine_plugin_modules flag in our configuration file, then we'll want
// to add in tests to lock in that behavior. But for now, it is a hidden utility for us to use internally, so no tests
// have been added.
4 changes: 0 additions & 4 deletions test/lib/actions/RunAction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,3 @@ describe('RunAction tests', () => {
});
});
});

// TODO: Whenever we decide to document the custom_engine_plugin_modules flag in our configuration file, then we'll want
// to add in tests to lock in that behavior. But for now, it is a hidden utility for us to use internally, so no tests
// have been added.
Loading