uchaindb/UClient

View on GitHub

Showing 2,037 of 2,037 total issues

Function getPager has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static getPager(totalItems: number, currentPage: number = 1, pageSize: number = 10): PaginationType {
        // calculate total pages
        let totalPages = Math.ceil(totalItems / pageSize);

        let startPage: number, endPage: number;
Severity: Minor
Found in src/ClientApp/app/services/utilities.ts - About 1 hr to fix

    Function appendAction has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        appendAction(defs) {
            if (this.selectedType == "data") {
                if (this.dataActions.length >= 10)
                    this.alertService.showMessage(this.translations.dataActionExceedsMessage);
                else
    Severity: Minor
    Found in src/ClientApp/app/components/database/create.page.ts - About 1 hr 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

    Function getLockTxHashContent has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        private getLockTxHashContent(initiator: Address, witness: string, lockScripts: string, targets: Array<LockTarget>, unlockScripts: string = null): string {
            let mapColumns = (columns: Array<LockTarget>): Array<string> =>
                columns.map(_ => `[${_.TargetType}][${_.PublicPermission}]${(!_.TableName ? '' : _.TableName)}:${(!_.PrimaryKey ? '' : _.PrimaryKey)}:${(!_.ColumnName ? '' : _.ColumnName)}`);
            let unlockContent = unlockScripts ? unlockScripts + "|" : "";
            return `${unlockContent}${initiator.toB58String()}|${witness}|${lockScripts ? lockScripts : ''}|${mapColumns(targets).join(",")}`
    Severity: Minor
    Found in src/ClientApp/app/services/chain-db.service.ts - About 1 hr 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

            let dacts = txs
                .filter(_ => _.Type == "DataTx")
                .map(_ => _.Actions)
                .reduce((a, b) => a.concat(b), []);
    Severity: Major
    Found in src/ClientApp/app/components/database/action.component.ts and 1 other location - About 1 hr to fix
    src/ClientApp/app/components/database/action.component.ts on lines 96..99

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

    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

            this.schemaActions = txs
                .filter(_ => _.Type == "SchemaTx")
                .map(_ => _.Actions)
                .reduce((a, b) => a.concat(b), []);
    Severity: Major
    Found in src/ClientApp/app/components/database/action.component.ts and 1 other location - About 1 hr to fix
    src/ClientApp/app/components/database/action.component.ts on lines 52..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 60.

    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 printDuration has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public static printDuration(start: Date, end: Date) {
    
            start = new Date(start);
            end = new Date(end);
    
    
    Severity: Minor
    Found in src/ClientApp/app/services/utilities.ts - About 1 hr 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

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

            let obs = config
                ? this.alarmService.removeConfig(config)
                    .map(() => this.alertService.showMessage(this.translations.toggleMonitorRemovedTitle, this.translations.toggleMonitorRemovedContent, MessageSeverity.success))
                : this.alarmService.addConfig({
                    type: type,
    Severity: Major
    Found in src/ClientApp/app/components/database/table.page.ts and 2 other locations - About 1 hr to fix
    src/ClientApp/app/components/database/detail.page.ts on lines 130..136
    src/ClientApp/app/components/database/table.component.ts on lines 113..122

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

    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 showToast has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        showToast(message: AlertMessage, isSticky: boolean) {
            if (message == null) {
                for (let id of this.stickyToasties.slice(0)) {
                    this.toastyService.clear(id);
                }
    Severity: Minor
    Found in src/ClientApp/app/components/app/app.component.ts - About 1 hr to fix

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

              let obs = config
                  ? this.alarmService.removeConfig(config)
                      .map(() => this.alertService.showMessage(this.translations.toggleMonitorRemovedTitle, this.translations.toggleMonitorRemovedContent, MessageSeverity.success))
                  : this.alarmService.addConfig({
                      type: "chain-fork",
      Severity: Major
      Found in src/ClientApp/app/components/database/detail.page.ts and 2 other locations - About 1 hr to fix
      src/ClientApp/app/components/database/table.component.ts on lines 113..122
      src/ClientApp/app/components/database/table.page.ts on lines 102..109

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

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

              let obs = config
                  ? this.alarmService.removeConfig(config)
                      .map(() => this.alertService.showMessage(this.translations.toggleMonitorRemovedTitle, this.translations.toggleMonitorRemovedContent, MessageSeverity.success))
                  : this.alarmService.addConfig({
                      type: type,
      Severity: Major
      Found in src/ClientApp/app/components/database/table.component.ts and 2 other locations - About 1 hr to fix
      src/ClientApp/app/components/database/detail.page.ts on lines 130..136
      src/ClientApp/app/components/database/table.page.ts on lines 102..109

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

      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

          private removeFromSessionStorage(keyToRemove: string) {
      
              this.removeFromSessionStorageHelper(keyToRemove);
              this.removeFromSyncKeysBackup(keyToRemove);
      
      
      Severity: Major
      Found in src/ClientApp/app/services/local-store-manager.service.ts and 2 other locations - About 1 hr to fix
      src/ClientApp/app/services/local-store-manager.service.ts on lines 211..218
      src/ClientApp/app/services/local-store-manager.service.ts on lines 252..259

      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

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

          private removeFromSyncKeys(key: string) {
      
              this.removeFromSyncKeysHelper(key);
              this.removeFromSyncKeysBackup(key);
      
      
      Severity: Major
      Found in src/ClientApp/app/services/local-store-manager.service.ts and 2 other locations - About 1 hr to fix
      src/ClientApp/app/services/local-store-manager.service.ts on lines 158..165
      src/ClientApp/app/services/local-store-manager.service.ts on lines 211..218

      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

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

          private addToSyncKeys(key: string) {
      
              this.addToSyncKeysHelper(key);
              this.addToSyncKeysBackup(key);
      
      
      Severity: Major
      Found in src/ClientApp/app/services/local-store-manager.service.ts and 2 other locations - About 1 hr to fix
      src/ClientApp/app/services/local-store-manager.service.ts on lines 158..165
      src/ClientApp/app/services/local-store-manager.service.ts on lines 252..259

      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

      Function getSchemaActions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          static getSchemaActions(arr: Array<SchemaActionCreationType>): Array<SchemaAction> {
              let getSchemaType = (type: SchemaActionCreationTypeEnum): SchemaActionEnum =>
                  type == "create" ? "CreateSchemaAction"
                      : type == "modify" ? "ModifySchemaAction"
                          : "DropSchemaAction";
      Severity: Minor
      Found in src/ClientApp/app/components/database/create.page.function.ts - About 1 hr to fix

        Function parseDate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public static parseDate(date) {
        
                if (date) {
        
                    if (date instanceof Date) {
        Severity: Minor
        Found in src/ClientApp/app/services/utilities.ts - About 1 hr 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

        Function to_b58 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            private static to_b58(buffer: Uint8Array): string {
                this.initb58();
                var carry, digits, j, i;
                if (buffer.length === 0) {
                    return "";
        Severity: Minor
        Found in src/ClientApp/app/services/b58.ts - About 1 hr 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

        Function ngOnInit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            ngOnInit() {
                this.route.paramMap
                    .subscribe((params: ParamMap) => {
                        let dbid = params.get('dbid');
                        let tid = params.get('tid');
        Severity: Minor
        Found in src/ClientApp/app/components/database/cell.page.ts - About 1 hr to fix

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

          (global as any).localStorage = {
              getItem: function (key) {
                  return this[key];
              },
              setItem: function (key, value) {
          Severity: Major
          Found in src/ClientApp/app/app.module.server.ts and 1 other location - About 1 hr to fix
          src/ClientApp/app/app.module.server.ts on lines 74..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 56.

          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

          (global as any).sessionStorage = {
              getItem: function (key) {
                  return this[key];
              },
              setItem: function (key, value) {
          Severity: Major
          Found in src/ClientApp/app/app.module.server.ts and 1 other location - About 1 hr to fix
          src/ClientApp/app/app.module.server.ts on lines 64..71

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

          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 getHttpResponseMessage has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static getHttpResponseMessage(data: Response | any): string[] {
          
                  let responses: string[] = [];
          
                  if (data instanceof Response) {
          Severity: Minor
          Found in src/ClientApp/app/services/utilities.ts - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language