mtxr/vscode-sqltools

View on GitHub

Showing 23 of 131 total issues

Function getStatements has a Cognitive Complexity of 62 (exceeds 15 allowed). Consider refactoring.
Open

  static getStatements(query: string, driver: string, delimiter: string): Array<string> {
    var charArray: Array<string> = Array.from(query);
    var previousChar: string = null;
    var nextChar: string = null;
    var isInComment: boolean = false;
Severity: Minor
Found in packages/core/utils/query/parse.ts - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

ConnectionManagerPlugin has 47 functions (exceeds 20 allowed). Consider refactoring.
Open

export default class ConnectionManagerPlugin implements IExtensionPlugin {
  public client: ILanguageClient;
  public resultsWebview: ResultsWebviewManager;
  public settingsWebview: SettingsWebview;
  private context: ExtensionContext;
Severity: Minor
Found in packages/plugins/connection-manager/extension.ts - About 6 hrs to fix

    Tokenizer has 36 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export default class Tokenizer {
      public WHITESPACE_REGEX: RegExp;
      public NUMBER_REGEX: RegExp;
      public OPERATOR_REGEX: RegExp;
      public QUERY_SEPARATOR_REGEX: RegExp;
    Severity: Minor
    Found in packages/formatter/src/core/Tokenizer.ts - About 4 hrs to fix

      Function getStatements has 107 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

        static getStatements(query: string, driver: string, delimiter: string): Array<string> {
          var charArray: Array<string> = Array.from(query);
          var previousChar: string = null;
          var nextChar: string = null;
          var isInComment: boolean = false;
      Severity: Major
      Found in packages/core/utils/query/parse.ts - About 3 hrs to fix

        Function getWebviewConfig has 93 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        module.exports = exports = function getWebviewConfig(outdir) {
          return {
            name: 'ui',
            entry: {
              Settings: path.join(__dirname, 'screens', 'Settings.tsx'),
        Severity: Major
        Found in packages/ui/webpack.config.js - About 2 hrs to fix

          Formatter has 23 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export default class Formatter {
            private tokens: Token[] = [];
            private previousReservedWord: Token = { type: null, value: null };
            private indentation: Indentation;
            private inlineBlock: InlineBlock;
          Severity: Minor
          Found in packages/formatter/src/core/Formatter.ts - About 2 hrs to fix

            Connection has 23 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export default class Connection {
              private tables: NSDatabase.ITable[] = [];
              private columns: NSDatabase.IColumn[] = [];
              private functions: NSDatabase.IFunction[] = [];
              private connected: boolean = false;
            Severity: Minor
            Found in packages/language-server/connection.ts - About 2 hrs to fix

              SQLToolsLanguageServer has 22 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class SQLToolsLanguageServer implements ILanguageServer<any> {
                private _server: IConnection;
                private _docManager = new TextDocuments();
                private onInitializeHooks: Arg0<IConnection['onInitialize']>[] = [];
                private onInitializedHooks: Arg0<IConnection['onInitialized']>[] = [];
              Severity: Minor
              Found in packages/language-server/server.ts - About 2 hrs to fix

                ConnectionExplorer has 21 functions (exceeds 20 allowed). Consider refactoring.
                Open

                export class ConnectionExplorer implements TreeDataProvider<SidebarTreeItem> {
                  private treeView: TreeView<TreeItem>;
                  private _onDidChangeTreeData: EventEmitter<SidebarTreeItem | undefined> = new EventEmitter();
                  private _onConnectionDidChange: EventEmitter<{ conn: IConnection, action: 'added' | 'deleted' | 'changed' }[]> = new EventEmitter();
                  public readonly onDidChangeTreeData = this._onDidChangeTreeData.event;
                Severity: Minor
                Found in packages/plugins/connection-manager/explorer/index.ts - About 2 hrs to fix

                  Function getExtensionConfig has 70 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  function getExtensionConfig(outdir) {
                    /** @type webpack.Configuration */
                    let config = {
                      name: 'ext',
                      target: 'node',
                  Severity: Major
                  Found in packages/extension/webpack.config.js - About 1 hr to fix

                    Function getClientOptions has 57 lines of code (exceeds 50 allowed). Consider refactoring.
                    Open

                      private getClientOptions(): LanguageClientOptions {
                        const telemetryArgs: ITelemetryArgs = {
                          enableTelemetry: ConfigManager.telemetry,
                          extraInfo: {
                            sessId: VSCodeEnv.sessionId,
                    Severity: Major
                    Found in packages/extension/language-client/client.ts - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                            if (
                              isInComment == true &&
                              (((commentChar == '#' || commentChar == '-') && char == '\n') ||
                                (commentChar == '/' && (char == '*' && nextChar == '/')))
                            ) {
                      Severity: Major
                      Found in packages/core/utils/query/parse.ts - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                              if (
                                ((char == '#' && nextChar == ' ') || (char == '-' && nextChar == '-') || (char == '/' && nextChar == '*')) &&
                                isInString == false
                              ) {
                                isInComment = true;
                        Severity: Major
                        Found in packages/core/utils/query/parse.ts - About 1 hr to fix

                          Avoid deeply nested control flow statements.
                          Open

                                      if (tagSymbol == tagChar) {
                                        isInTag = false;
                                      }
                          Severity: Major
                          Found in packages/core/utils/query/parse.ts - About 45 mins to fix

                            Consider simplifying this complex logical expression.
                            Open

                                  if ((char == '#' && nextChar == ' ') || (char == '-' && nextChar == '-') || (char == '/' && nextChar == '*')) {
                                    break;
                                  } else {
                                    if (clearedText == null) {
                                      clearedText = '';
                            Severity: Major
                            Found in packages/core/utils/query/parse.ts - About 40 mins to fix

                              Consider simplifying this complex logical expression.
                              Open

                                    if (
                                      driver === 'mssql'
                                      && char.toLowerCase() === 'g'
                                      && `${charArray[index + 1] || ''}`.toLowerCase() === 'o'
                                      && (
                              Severity: Major
                              Found in packages/core/utils/query/parse.ts - About 40 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                        return lines.slice(start + 1, end).join(EOL);
                                Severity: Major
                                Found in packages/vscode/utils/selector.ts - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                        return data.defaultValue;
                                  Severity: Major
                                  Found in packages/core/config-manager.ts - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                        return Promise.resolve(true);
                                    Severity: Major
                                    Found in packages/plugins/connection-manager/extension.ts - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                              return void this.server.sendNotification(e.data.notification, e.data.args);
                                      Severity: Major
                                      Found in packages/plugins/connection-manager/language-server.ts - About 30 mins to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language