adorsys/datasafe

View on GitHub

Showing 63 of 93 total issues

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

fs.readFile(f_angular, 'utf8', function (err, data) {
  if (err) {
    return console.log(err);
  }
  var result = data.replace(/target: "electron-renderer",/g, '');
Severity: Major
Found in frontend/datasafe-ui/postinstall.js and 1 other location - About 4 hrs to fix
frontend/datasafe-ui/postinstall-web.js on lines 5..16

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

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

fs.readFile(f_angular, 'utf8', function (err, data) {
  if (err) {
    return console.log(err);
  }
  var result = data.replace(/target: "electron-renderer",/g, '');
Severity: Major
Found in frontend/datasafe-ui/postinstall-web.js and 1 other location - About 4 hrs to fix
frontend/datasafe-ui/postinstall.js on lines 5..16

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

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

File WithStorageProvider.java has 324 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package de.adorsys.datasafe.teststorage;

import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.client.builder.AwsClientBuilder;

    File filetree.component.ts has 271 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {CollectionViewer, SelectionChange} from '@angular/cdk/collections';
    import {FlatTreeControl} from '@angular/cdk/tree';
    import {Component, Inject, Injectable} from '@angular/core';
    import {BehaviorSubject, merge, Observable} from 'rxjs';
    import {map} from 'rxjs/operators';
    Severity: Minor
    Found in frontend/datasafe-ui/src/app/component/filetree/filetree.component.ts - About 2 hrs to fix

      Method generate has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public KeyStore generate() {
              if (config.getEncKeyNumber() == 0 &&
                      secretKeys.isEmpty() &&
                      config.getSignKeyNumber() == 0) {
                  throw new KeyStoreConfigException("Configuration of keystore must at least contain one key");

        Method build has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @SneakyThrows
            public X509CertificateHolder build(PrivateKey issuerPrivatekey) {
                if (dirty) throw new IllegalStateException("Builder can not be reused");
                dirty = true;
        
        

          Method build has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              @SneakyThrows
              public X509CertificateHolder build(PrivateKey issuerPrivatekey) {
                  if (dirty) throw new IllegalStateException("Builder can not be reused");
                  dirty = true;
          
          

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

              private void finishMultiPartUpload() throws IOException {
                  completionService.submit(
                          new UploadChunkResultCallable(ChunkUploadRequest.builder()
                                  .amazonS3(amazonS3)
                                  .content(currentOutputStream.toByteArray())

            Method startCeph has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static void startCeph() {
                    log.info("Starting CEPH");
                    cephContainer = new GenericContainer("ceph/daemon")
                            .withExposedPorts(8000)
                            .withEnv("RGW_FRONTEND_PORT", "8000")

              Method process has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  @Override
                  public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
                      RuntimeDelegateGenerator generator = new RuntimeDelegateGenerator();
              
                      for (TypeElement annotation : annotations) {

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

                  @Override
                  public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
                      RuntimeDelegateGenerator generator = new RuntimeDelegateGenerator();
              
                      for (TypeElement annotation : annotations) {

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

                    @SneakyThrows
                    @PutMapping(value = "/versioned/{path:.*}", consumes = MULTIPART_FORM_DATA_VALUE)
                    public void writeVersionedDocument(@RequestHeader String user,
                                              @RequestHeader String password,
                                              @PathVariable String path,
                datasafe-rest-impl/src/main/java/de/adorsys/datasafe/rest/impl/controller/DocumentController.java on lines 68..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 83.

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

                function createWindow() {
                    var electronScreen = electron_1.screen;
                    var size = electronScreen.getPrimaryDisplay().workAreaSize;
                    // Create the browser window.
                    win = new electron_1.BrowserWindow({
                Severity: Minor
                Found in frontend/datasafe-ui/main.js - About 1 hr to fix

                  Function createWindow has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function createWindow() {
                  
                    const electronScreen = screen;
                    const size = electronScreen.getPrimaryDisplay().workAreaSize;
                  
                  
                  Severity: Minor
                  Found in frontend/datasafe-ui/main.ts - About 1 hr to fix

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

                                {
                                    KeyPairGenerator signKeyPairGenerator = config.getSignKeyPairGenerator(keyStoreID);
                                    int numberOfSignKeyPairs = config.getSignKeyNumber();
                                    for (int i = 0; i < numberOfSignKeyPairs; i++) {
                                        KeyPairEntry signatureKeyPair = signKeyPairGenerator.generateSignatureKey(
                    datasafe-encryption/datasafe-encryption-impl/src/main/java/de/adorsys/datasafe/encrypiton/impl/keystore/KeyStoreGenerator.java on lines 67..78

                    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

                                {
                                    KeyPairGenerator encKeyPairGenerator = config.getEncKeyPairGenerator(keyStoreID);
                                    int numberOfEncKeyPairs = config.getEncKeyNumber();
                                    for (int i = 0; i < numberOfEncKeyPairs; i++) {
                                        KeyPairEntry signatureKeyPair = encKeyPairGenerator.generateEncryptionKey(
                    datasafe-encryption/datasafe-encryption-impl/src/main/java/de/adorsys/datasafe/encrypiton/impl/keystore/KeyStoreGenerator.java on lines 79..90

                    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

                    Method constructor has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private MethodSpec constructor(TypeElement forClass, Class contextClass,
                                                       ExecutableElement usingConstructor, Set<Class> addAnnotations) {
                            MethodSpec.Builder method = MethodSpec.constructorBuilder().addModifiers(Modifier.PUBLIC);
                            ParameterSpec contextParam = ParameterSpec.builder(
                                    ClassName.get(contextClass),

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

                          @Inject
                          public DFSPrivateKeyServiceImpl(KeyStoreCache keystoreCache,
                                                          KeyStoreService keyStoreService, DFSConfig dfsConfig,
                                                          BucketAccessService bucketAccessService, ProfileRetrievalService profile,
                                                          StorageReadService readService) {
                      datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/operations/actions/ProfileRegistrationServiceImpl.java on lines 38..48
                      datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/operations/actions/ProfileRetrievalServiceImpl.java on lines 34..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 75.

                      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

                          @Inject
                          ProfileRetrievalServiceImpl(DFSConfig dfsConfig, StorageReadService readService,
                                                             StorageCheckService checkService, BucketAccessService access, GsonSerde serde,
                                                             UserProfileCache userProfileCache) {
                              this.dfsConfig = dfsConfig;
                      datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/keys/DFSPrivateKeyServiceImpl.java on lines 43..54
                      datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/operations/actions/ProfileRegistrationServiceImpl.java on lines 38..48

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

                      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

                          @Inject
                          ProfileRegistrationServiceImpl(KeyStoreService keyStoreService, BucketAccessService access,
                                                                StorageCheckService checkService, StorageWriteService writeService,
                                                                GsonSerde serde, DFSConfig dfsConfig) {
                              this.keyStoreService = keyStoreService;
                      datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/keys/DFSPrivateKeyServiceImpl.java on lines 43..54
                      datasafe-directory/datasafe-directory-impl/src/main/java/de/adorsys/datasafe/directory/impl/profile/operations/actions/ProfileRetrievalServiceImpl.java on lines 34..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 75.

                      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