Renable Strict TSLint (#5018)

* removes more builder references

* remove builder from profiler

* formatting

* fix profiler dailog

* remove builder from oatuhdialog

* remove the rest of builder references

* formatting

* add more strict null checks to base

* enable strict tslint rules

* fix formatting

* fix compile error

* fix the rest of the hygeny issues and add pipeline step

* fix pipeline files
This commit is contained in:
Anthony Dresser
2019-04-18 00:34:53 -07:00
committed by GitHub
parent b852f032d3
commit ddd89fc52a
431 changed files with 3147 additions and 3789 deletions

View File

@@ -2,10 +2,10 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as azdata from 'azdata';
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
import {ConnectionProfileGroup} from 'sql/platform/connection/common/connectionProfileGroup';
import { ConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
import { equalsIgnoreCase } from 'vs/base/common/strings';
import { ICommandLineProcessing } from 'sql/workbench/services/commandLine/common/commandLine';
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
@@ -20,10 +20,10 @@ import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/co
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { warn } from 'sql/base/common/log';
import { ipcRenderer as ipc} from 'electron';
import { ipcRenderer as ipc } from 'electron';
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IStatusbarService, StatusbarAlignment } from 'vs/platform/statusbar/common/statusbar';
import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
import { localize } from 'vs/nls';
export class CommandLineService implements ICommandLineProcessing {
@@ -32,7 +32,7 @@ export class CommandLineService implements ICommandLineProcessing {
constructor(
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService,
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@IEnvironmentService private _environmentService: IEnvironmentService,
@IEnvironmentService environmentService: IEnvironmentService,
@IQueryEditorService private _queryEditorService: IQueryEditorService,
@IObjectExplorerService private _objectExplorerService: IObjectExplorerService,
@IEditorService private _editorService: IEditorService,
@@ -41,16 +41,15 @@ export class CommandLineService implements ICommandLineProcessing {
@IStatusbarService private _statusBarService: IStatusbarService
) {
if (ipc) {
ipc.on('ads:processCommandLine', (event: any, args: ParsedArgs) => this.onLaunched(args));
ipc.on('ads:processCommandLine', (event: any, args: ParsedArgs) => this.onLaunched(args));
}
// we only get the ipc from main during window reuse
if (_environmentService) {
this.onLaunched(_environmentService.args);
if (environmentService) {
this.onLaunched(environmentService.args);
}
}
private onLaunched(args: ParsedArgs)
{
private onLaunched(args: ParsedArgs) {
const registry = platform.Registry.as<IConnectionProviderRegistry>(ConnectionProviderExtensions.ConnectionProviderContributions);
let sqlProvider = registry.getProperties(Constants.mssqlProviderName);
// We can't connect to object explorer until the MSSQL connection provider is registered
@@ -81,7 +80,7 @@ export class CommandLineService implements ICommandLineProcessing {
if (args.server) {
profile = this.readProfileFromArgs(args);
}
}
}
let showConnectDialogOnStartup: boolean = this._configurationService.getValue('workbench.showConnectDialogOnStartup');
if (showConnectDialogOnStartup && !commandName && !profile && !this._connectionManagementService.hasRegisteredServers()) {
// prompt the user for a new connection on startup if no profiles are registered
@@ -90,9 +89,8 @@ export class CommandLineService implements ICommandLineProcessing {
}
let connectedContext: azdata.ConnectedContext = undefined;
if (profile) {
if (this._statusBarService)
{
this._statusBarService.setStatusMessage(localize('connectingLabel','Connecting:') + profile.serverName, 2500);
if (this._statusBarService) {
this._statusBarService.setStatusMessage(localize('connectingLabel', 'Connecting:') + profile.serverName, 2500);
}
try {
await this._connectionManagementService.connectIfNotConnected(profile, 'connection', true);
@@ -105,15 +103,13 @@ export class CommandLineService implements ICommandLineProcessing {
}
}
if (commandName) {
if (this._statusBarService)
{
this._statusBarService.setStatusMessage(localize('runningCommandLabel','Running command:') + commandName, 2500);
if (this._statusBarService) {
this._statusBarService.setStatusMessage(localize('runningCommandLabel', 'Running command:') + commandName, 2500);
}
await this._commandService.executeCommand(commandName, connectedContext);
} else if (profile) {
if (this._statusBarService)
{
this._statusBarService.setStatusMessage(localize('openingNewQueryLabel','Opening new query:') + profile.serverName, 2500);
if (this._statusBarService) {
this._statusBarService.setStatusMessage(localize('openingNewQueryLabel', 'Opening new query:') + profile.serverName, 2500);
}
// Default to showing new query
try {
@@ -146,29 +142,26 @@ export class CommandLineService implements ICommandLineProcessing {
return this._connectionManagementService ? this.tryMatchSavedProfile(profile) : profile;
}
private tryMatchSavedProfile(profile: ConnectionProfile)
{
private tryMatchSavedProfile(profile: ConnectionProfile) {
let match: ConnectionProfile = undefined;
// If we can find a saved mssql provider connection that matches the args, use it
let groups = this._connectionManagementService.getConnectionGroups([Constants.mssqlProviderName]);
if (groups && groups.length > 0)
{
if (groups && groups.length > 0) {
let rootGroup = groups[0];
let connections = ConnectionProfileGroup.getConnectionsInGroup(rootGroup);
match = connections.find((c) => this.matchProfile(profile, c)) ;
match = connections.find((c) => this.matchProfile(profile, c));
}
return match ? match : profile;
}
// determines if the 2 profiles are a functional match
// profile1 is the profile generated from command line parameters
private matchProfile(profile1: ConnectionProfile, profile2: ConnectionProfile): boolean
{
return equalsIgnoreCase(profile1.serverName,profile2.serverName)
&& equalsIgnoreCase(profile1.providerName, profile2.providerName)
// case sensitive servers can have 2 databases whose name differs only in case
&& profile1.databaseName === profile2.databaseName
&& equalsIgnoreCase(profile1.userName, profile2.userName)
&& profile1.authenticationType === profile2.authenticationType;
private matchProfile(profile1: ConnectionProfile, profile2: ConnectionProfile): boolean {
return equalsIgnoreCase(profile1.serverName, profile2.serverName)
&& equalsIgnoreCase(profile1.providerName, profile2.providerName)
// case sensitive servers can have 2 databases whose name differs only in case
&& profile1.databaseName === profile2.databaseName
&& equalsIgnoreCase(profile1.userName, profile2.userName)
&& profile1.authenticationType === profile2.authenticationType;
}
}