mtxr/vscode-sqltools

View on GitHub

Showing 122 of 122 total issues

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

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

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

        super(1000, `Missing module "${deps.map((d, i) => `${d.name}@${d.version || 'latest'}${i === deps.length - 2 ? ' and ' : (i === deps.length - 1 ? '' : ', ')}`).join('')}". Need to ${mustUpgrade ? 'upgrade' : 'install'}.`, {
    Severity: Major
    Found in packages/base-driver/src/lib/exception/missing-module.ts and 1 other location - About 2 hrs to fix
    packages/plugins/connection-manager/dependency-manager/extension.ts on lines 31..31

    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 87.

    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

        const dependenciesName = deps.map((d, i) => `${d.name}@${d.version || 'latest'}${i === deps.length - 2 ? ' and ' : (i === deps.length - 1 ? '' : ', ')}`).join('');
    packages/base-driver/src/lib/exception/missing-module.ts on lines 7..7

    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 87.

    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

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

    export default class Connection {
      private connected: boolean = false;
      private conn: IConnectionDriver;
      constructor(private credentials: IConnection, getWorkspaceFolders: LSIconnection['workspace']['getWorkspaceFolders']) {
        if (!LSContext.drivers.has(credentials.driver)) {
    Severity: Minor
    Found in packages/language-server/connection.ts - About 2 hrs to fix

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

        try {
          schema = JSON.parse(fs.readFileSync(PluginResourcesMap.get<string>(buildResouceKey({ type: 'driver', name: driver, resource: 'connection-schema' }))).toString()) || {};
        }
        catch (error) { }
      Severity: Major
      Found in packages/plugins/connection-manager/extension-util.ts and 1 other location - About 2 hrs to fix
      packages/plugins/connection-manager/extension-util.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 81.

      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

        try {
          uiSchema = JSON.parse(fs.readFileSync(PluginResourcesMap.get<string>(buildResouceKey({ type: 'driver', name: driver, resource: 'ui-schema' }))).toString()) || {};
        }
        catch (error) { }
      Severity: Major
      Found in packages/plugins/connection-manager/extension-util.ts and 1 other location - About 2 hrs to fix
      packages/plugins/connection-manager/extension-util.ts on lines 15..18

      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 81.

      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 Screen has a Cognitive Complexity of 27 (exceeds 15 allowed). Consider refactoring.
      Open

      const Screen: React.SFC<Props> = () => {
        const [state, dispatch, stateRef] = useReducer(reducer, initialState);
        const {
          loading,
          error,
      Severity: Minor
      Found in packages/plugins/connection-manager/ui/screens/Results/Main.tsx - About 2 hrs 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

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

                <select defaultValue={this.state.options.linesBetweenQueries} onChange={e => this.setState({ options: { ...this.state.options, linesBetweenQueries: e.target.value as any }})}>
                  <option value='preserve'>Preserve</option>
                  <option value="1">1 line</option>
                  <option value="2">2 line</option>
                  <option value="3">3 line</option>
      Severity: Major
      Found in docs/src/components/Playground/Formatter.tsx and 1 other location - About 2 hrs to fix
      docs/src/components/Playground/Formatter.tsx on lines 91..95

      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 78.

      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

                <select defaultValue={this.state.options.reservedWordCase} onChange={e => this.setState({ options: { ...this.state.options, reservedWordCase: e.target.value as any }})}>
                  <option>Preserve</option>
                  <option value="upper">Uppercase</option>
                  <option value="lower">Lowercase</option>
                </select>
      Severity: Major
      Found in docs/src/components/Playground/Formatter.tsx and 1 other location - About 2 hrs to fix
      docs/src/components/Playground/Formatter.tsx on lines 99..106

      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 78.

      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 fetchRecords: IBaseQueries['fetchRecords'] = queryFactory`
      SELECT *
      FROM ${p => escapeTableName(p.table)}
      LIMIT ${p => p.limit || 50}
      OFFSET ${p => p.offset || 0};
      Severity: Major
      Found in packages/driver.sqlite/src/ls/queries.ts and 1 other location - About 2 hrs to fix
      packages/driver.pg/src/ls/queries.ts on lines 49..54

      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 76.

      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 fetchRecords: IBaseQueries['fetchRecords'] = queryFactory`
      SELECT *
      FROM ${p => escapeTableName(p.table)}
      LIMIT ${p => p.limit || 50}
      OFFSET ${p => p.offset || 0};
      Severity: Major
      Found in packages/driver.pg/src/ls/queries.ts and 1 other location - About 2 hrs to fix
      packages/driver.sqlite/src/ls/queries.ts on lines 25..30

      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 76.

      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

      const YourDriverPlugin: ILanguageServerPlugin = {
        register(server) {
          DRIVER_ALIASES.forEach(({ value }) => {
            server.getContext().drivers.set(value, YourDriver as any);
          });
      packages/driver.sqlite/src/ls/plugin.ts on lines 5..11

      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 73.

      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

      const SQLiteDriverPlugin: ILanguageServerPlugin = {
        register(server) {
          DRIVER_ALIASES.forEach(({ value }) => {
            server.getContext().drivers.set(value, SQLite as any);
          });
      Severity: Major
      Found in packages/driver.sqlite/src/ls/plugin.ts and 1 other location - About 1 hr to fix
      packages/generator-sqltools-driver/generators/app/templates/driver-ts/src/ls/plugin.ts on lines 5..11

      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 73.

      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 activate has 69 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.mysql/src/extension.ts - About 1 hr to fix

        Function activate has 69 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.pg/src/extension.ts - About 1 hr to fix

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

            render() {
              const { rows, columns, columnNames, pageSize, footerButtons, error, showPagination, page, total, changePage } = this.props;
              const { filters, selection, contextMenu } = this.state;
              const columnExtensions = this.state.columnExtensions || generateColumnExtensions(columnNames, rows);
              let pagingProps: PagingStateProps = {};

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

            const MSSQLDriverPlugin: ILanguageServerPlugin = {
              register(server) {
                DRIVER_ALIASES.forEach(({ value }) => {
                  server.getContext().drivers.set(value, MSSQL);
                });
            Severity: Major
            Found in packages/driver.mssql/src/ls/plugin.ts and 2 other locations - About 1 hr to fix
            packages/driver.mysql/src/ls/plugin.ts on lines 5..11
            packages/driver.pg/src/ls/plugin.ts on lines 5..11

            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 69.

            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 3 locations. Consider refactoring.
            Open

            const PGDriverPlugin: ILanguageServerPlugin = {
              register(server) {
                DRIVER_ALIASES.forEach(({ value }) => {
                  server.getContext().drivers.set(value, PostgreSQL);
                });
            Severity: Major
            Found in packages/driver.pg/src/ls/plugin.ts and 2 other locations - About 1 hr to fix
            packages/driver.mssql/src/ls/plugin.ts on lines 5..11
            packages/driver.mysql/src/ls/plugin.ts on lines 5..11

            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 69.

            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 3 locations. Consider refactoring.
            Open

            const MySQLDriverPlugin: ILanguageServerPlugin = {
              register(server) {
                DRIVER_ALIASES.forEach(({ value }) => {
                  server.getContext().drivers.set(value, MySQL);
                });
            Severity: Major
            Found in packages/driver.mysql/src/ls/plugin.ts and 2 other locations - About 1 hr to fix
            packages/driver.mssql/src/ls/plugin.ts on lines 5..11
            packages/driver.pg/src/ls/plugin.ts on lines 5..11

            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 69.

            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 activate has 64 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.mssql/src/extension.ts - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language