mtxr/vscode-sqltools

View on GitHub

Showing 122 of 122 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

const searchTables: IBaseQueries['searchTables'] = queryFactory`
SELECT name AS label,
  type
FROM sqlite_master
${p => p.search ? `WHERE LOWER(name) LIKE '%${p.search.toLowerCase()}%'` : ''}
Severity: Major
Found in packages/driver.sqlite/src/ls/queries.ts and 1 other location - About 1 hr to fix
packages/generator-sqltools-driver/generators/app/templates/driver-ts/src/ls/queries.ts on lines 47..53

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 66.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

const searchTables: IBaseQueries['searchTables'] = queryFactory`
SELECT name AS label,
  type
FROM sqlite_master
${p => p.search ? `WHERE LOWER(name) LIKE '%${p.search.toLowerCase()}%'` : ''}
packages/driver.sqlite/src/ls/queries.ts on lines 49..55

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 66.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      child.stdout.on('data', chunk => {
        stdout += chunk.toString();
        output += chunk.toString();
        process.stdout.write(chunk);
      });
packages/plugins/connection-manager/dependency-manager/lib/execPromise.ts on lines 25..29

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      child.stderr.on('data', chunk => {
        stderr += chunk.toString();
        output += chunk.toString();
        process.stderr.write(chunk);
      });
packages/plugins/connection-manager/dependency-manager/lib/execPromise.ts on lines 20..24

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function exports has 62 lines of code (exceeds 50 allowed). Consider refactoring.
Open

module.exports = function(env = {}) {
  env.pkg = env.pkg || [];
  if (typeof env.pkg === 'string') {
    env.pkg = [env.pkg];
  }
Severity: Major
Found in build-tools/webpack.config.js - About 1 hr to fix

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

    if (!fs.existsSync(SQLTOOLS_PATHS.data)) {
      mkdir.sync(SQLTOOLS_PATHS.data);
      log.extend('debug')(`Created data path ${SQLTOOLS_PATHS.data}`);
    }
    Severity: Major
    Found in packages/util/path/index.ts and 3 other locations - About 1 hr to fix
    packages/util/path/index.ts on lines 11..14
    packages/util/path/index.ts on lines 19..22
    packages/base-driver/src/lib/require.ts on lines 11..14

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 64.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

    if (!fs.existsSync(SQLTOOLS_PATHS.data)) {
      mkdir.sync(SQLTOOLS_PATHS.data);
      log.extend('debug')(`Created data path ${SQLTOOLS_PATHS.data}`);
    }
    Severity: Major
    Found in packages/base-driver/src/lib/require.ts and 3 other locations - About 1 hr to fix
    packages/util/path/index.ts on lines 11..14
    packages/util/path/index.ts on lines 15..18
    packages/util/path/index.ts on lines 19..22

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 64.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

    if (!fs.existsSync(SQLTOOLS_PATHS.cache)) {
      mkdir.sync(SQLTOOLS_PATHS.cache);
      log.extend('debug')(`Created cache path ${SQLTOOLS_PATHS.cache}`);
    }
    Severity: Major
    Found in packages/util/path/index.ts and 3 other locations - About 1 hr to fix
    packages/util/path/index.ts on lines 11..14
    packages/util/path/index.ts on lines 15..18
    packages/base-driver/src/lib/require.ts on lines 11..14

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 64.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

    if (!fs.existsSync(SQLTOOLS_PATHS.config)) {
      mkdir.sync(SQLTOOLS_PATHS.config);
      log.extend('debug')(`Created config path ${SQLTOOLS_PATHS.config}`);
    }
    Severity: Major
    Found in packages/util/path/index.ts and 3 other locations - About 1 hr to fix
    packages/util/path/index.ts on lines 15..18
    packages/util/path/index.ts on lines 19..22
    packages/base-driver/src/lib/require.ts on lines 11..14

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 64.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

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

      Function activate has 59 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      export async function activate(extContext: ExtensionContext): Promise<IDriverExtensionApi> {
        const sqltools = extensions.getExtension<IExtension>('mtxr.sqltools');
        if (!sqltools) {
          throw new Error('SQLTools not installed');
        }
      Severity: Major
      Found in packages/driver.sqlite/src/extension.ts - About 1 hr to fix

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

          public sendNotification: LanguageClient['sendNotification'] = async function () {
            await this.client.onReady();
            return this.client.sendNotification.apply(this.client, arguments);
          }
        Severity: Major
        Found in packages/extension/language-client/client.ts and 3 other locations - About 1 hr to fix
        packages/extension/language-client/client.ts on lines 68..71
        packages/extension/language-client/client.ts on lines 73..76
        packages/extension/language-client/client.ts on lines 82..85

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

          public sendRequest: LanguageClient['sendRequest'] = async function () {
            await this.client.onReady();
            return this.client.sendRequest.apply(this.client, arguments);
          }
        Severity: Major
        Found in packages/extension/language-client/client.ts and 3 other locations - About 1 hr to fix
        packages/extension/language-client/client.ts on lines 73..76
        packages/extension/language-client/client.ts on lines 78..81
        packages/extension/language-client/client.ts on lines 82..85

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

          public onRequest: LanguageClient['onRequest'] = async function () {
            await this.client.onReady();
            return this.client.onRequest.apply(this.client, arguments);
          }
        Severity: Major
        Found in packages/extension/language-client/client.ts and 3 other locations - About 1 hr to fix
        packages/extension/language-client/client.ts on lines 68..71
        packages/extension/language-client/client.ts on lines 78..81
        packages/extension/language-client/client.ts on lines 82..85

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

          public onNotification: LanguageClient['onNotification'] = async function () {
            await this.client.onReady();
            return this.client.onNotification.apply(this.client, arguments);
          }
        Severity: Major
        Found in packages/extension/language-client/client.ts and 3 other locations - About 1 hr to fix
        packages/extension/language-client/client.ts on lines 68..71
        packages/extension/language-client/client.ts on lines 73..76
        packages/extension/language-client/client.ts on lines 78..81

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          getIdentNamedPlaceholderToken(input: string): Token {
            return this.getPlaceholderTokenWithKey({
              input,
              regex: this.IDENT_NAMED_PLACEHOLDER_REGEX,
              parseKey: v => v.slice(1),
        Severity: Major
        Found in packages/formatter/src/core/Tokenizer.ts and 1 other location - About 1 hr to fix
        packages/formatter/src/core/Tokenizer.ts on lines 259..265

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          getIndexedPlaceholderToken(input: string): Token {
            return this.getPlaceholderTokenWithKey({
              input,
              regex: this.INDEXED_PLACEHOLDER_REGEX,
              parseKey: v => v.slice(1),
        Severity: Major
        Found in packages/formatter/src/core/Tokenizer.ts and 1 other location - About 1 hr to fix
        packages/formatter/src/core/Tokenizer.ts on lines 243..249

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 62.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function render has 55 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

          public render() {
            const {
              step,
              driver,
              loading,
        Severity: Major
        Found in packages/plugins/connection-manager/ui/screens/Settings/Screen.tsx - About 1 hr to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                {!loading && drivers.length > 0 && <div>
                  <p>
                    <a href={`command:workbench.extensions.search?${encodeURIComponent('"@tag:sqltools-driver"')}`}>
                      Get more drivers
                    </a>
          packages/plugins/connection-manager/ui/screens/Settings/Widget/DriverSelector.tsx on lines 61..68

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 58.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

          const fetchTablesAndViews = (type: ContextValue, tableType = 'table'): IBaseQueries['fetchTables'] => queryFactory`
          SELECT name AS label,
            '${type}' AS type
          FROM sqlite_master
          WHERE LOWER(type) LIKE '${tableType.toLowerCase()}'
          packages/driver.sqlite/src/ls/queries.ts on lines 37..44

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 58.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Severity
          Category
          Status
          Source
          Language