uchaindb/UClient

View on GitHub

Showing 2,037 of 2,037 total issues

Function submit has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    submit() {
        if (this.codeMode) {
            this.alertService.showDialog(this.translations.forbidSubmitInCodeModeMessage, DialogType.alert);
            return;
        }
Severity: Minor
Found in src/ClientApp/app/components/database/create.page.ts - About 1 hr to fix

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

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

      Function to_b58 has 38 lines of code (exceeds 25 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

        Function showStickyMessage has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            showStickyMessage(data: string | string[] | Response, separatorOrDetail?: string, severity?: MessageSeverity, error?: any) {
        
                if (!severity)
                    severity = MessageSeverity.default;
        
        
        Severity: Minor
        Found in src/ClientApp/app/services/alert.service.ts - About 1 hr to fix

          Function getQueryCell has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              getQueryCell(db: ChainDb, tableName: string, primaryKeyValue: string, columnName: string, columns: string[]): Observable<QueryCellResponse> {
                  if (!db) throw 'db not exist calling getQueryCell';
                  columns = columns || [];
                  return this.rpcCall(db.address, "QueryCell", [tableName, primaryKeyValue, columnName, ...columns])
                      .map((_: QueryCellRpcResponse) => {
          Severity: Minor
          Found in src/ClientApp/app/services/chain-db.service.ts - About 1 hr to fix

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

                constructor(
                    http: Http,
                    configurations: ConfigurationService,
                    injector: Injector,
                    private localStoreManager: LocalStoreManager,
            Severity: Major
            Found in src/ClientApp/app/services/chain-db.service.ts and 1 other location - About 1 hr to fix
            src/ClientApp/app/services/private-key.service.ts on lines 19..28

            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

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

                constructor(
                    http: Http,
                    configurations: ConfigurationService,
                    injector: Injector,
                    private localStoreManager: LocalStoreManager,
            Severity: Major
            Found in src/ClientApp/app/services/private-key.service.ts and 1 other location - About 1 hr to fix
            src/ClientApp/app/services/chain-db.service.ts on lines 23..32

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

                public moveDataToSyncedSessionStorage(key = LocalStoreManager.DBKEY_USER_DATA) {
            
                    this.testForInvalidKeys(key);
            
                    let data = this.getData(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 301..311
            src/ClientApp/app/services/local-store-manager.service.ts on lines 327..337

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

                public moveDataToSessionStorage(key = LocalStoreManager.DBKEY_USER_DATA) {
            
                    this.testForInvalidKeys(key);
            
                    let data = this.getData(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 314..324
            src/ClientApp/app/services/local-store-manager.service.ts on lines 327..337

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

                    return actions
                        .map<DataActionCreationType>(_ => ({
                            type: getDataType(_.Type),
                            tableName: _.SchemaName,
                            columns: mapColumnData(_.Columns),
            src/ClientApp/app/components/database/create.page.function.ts on lines 85..91

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

                    var da = arr
                        .map<DataAction>(_ => ({
                            Type: getDataType(_.type),
                            SchemaName: _.tableName,
                            Columns: mapColumnData(_.columns),
            src/ClientApp/app/components/database/create.page.function.ts on lines 111..117

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

                public moveDataToPermanentStorage(key = LocalStoreManager.DBKEY_USER_DATA) {
            
                    this.testForInvalidKeys(key);
            
                    let data = this.getData(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 301..311
            src/ClientApp/app/services/local-store-manager.service.ts on lines 314..324

            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

            Method Prerender has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public async Task<PrerenderStatus> Prerender(HttpContext httpContext)
                    {
                        var expired = this.IsFileCacheExpired(httpContext);
                        if (!expired) return PrerenderStatus.CacheNotExpired;
            
            
            Severity: Minor
            Found in src/Controllers/PrerenderHelper.cs - About 1 hr to fix

              Function showStickyMessage has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  showStickyMessage(data: string | string[] | Response, separatorOrDetail?: string, severity?: MessageSeverity, error?: any) {
              
                      if (!severity)
                          severity = MessageSeverity.default;
              
              
              Severity: Minor
              Found in src/ClientApp/app/services/alert.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

              Function onPermissionChange has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  onPermissionChange(target: LockTargetCreationType, name: LockPermissionEnum, event) {
                      target.permissions = target.permissions || [];
                      let uncheckAllExcept = (except: LockPermissionEnum) => {
                          target.permissions = [except];
                      }
              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

              Method Index has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      public async Task<IActionResult> Index()
                      {
                          string html = null, js = null, title = null;
                          try
                          {
              Severity: Minor
              Found in src/Controllers/HomeController.cs - About 1 hr to fix

                Function showDialog has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    showDialog(dialog: AlertDialog) {
                        let labels = {
                            ok: dialog.okLabel || this.translations.okLabel,
                            cancel: dialog.cancelLabel || this.translations.cancelLabel
                        };
                Severity: Minor
                Found in src/ClientApp/app/components/app/app.component.ts - About 1 hr to fix

                  Method Configure has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
                          {
                              loggerFactory.AddConsole(this.Configuration.GetSection("Logging"));
                              loggerFactory.AddDebug(LogLevel.Warning);
                              loggerFactory.AddFile(this.Configuration.GetSection("Logging"));
                  Severity: Minor
                  Found in src/Startup.cs - About 1 hr to fix

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

                        onPermissionChange(target: LockTargetCreationType, name: LockPermissionEnum, event) {
                            target.permissions = target.permissions || [];
                            let uncheckAllExcept = (except: LockPermissionEnum) => {
                                target.permissions = [except];
                            }
                    Severity: Minor
                    Found in src/ClientApp/app/components/database/create.page.ts - About 1 hr to fix

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

                          protected handleError(error, continuation: () => Observable<any>) {
                      
                              if (error.status == 401) {
                                  if (this.isRefreshingLogin) {
                                      return this.pauseTask(continuation);
                      Severity: Minor
                      Found in src/ClientApp/app/services/endpoint-factory.service.ts - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language