adorsys/datasafe

View on GitHub

Showing 28 of 106 total issues

Method writeVersionedDocument has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public void writeVersionedDocument(@RequestHeader String user,
                                       @RequestHeader String password,
                                       @RequestHeader(defaultValue = StorageIdentifier.DEFAULT_ID) String storageId,
                                       @PathVariable String path,
                                       @RequestParam("file") MultipartFile file) {

    Method writeDocument has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public void writeDocument(@RequestHeader String user,
                                  @RequestHeader String password,
                                  @RequestHeader(defaultValue = StorageIdentifier.DEFAULT_ID) String storageId,
                                  @PathVariable String path,
                                  @RequestParam("file") MultipartFile file) {

      Function toggleNode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        toggleNode(node: DynamicFlatNode, expand: boolean) {
          const children = this.database.getChildren(node.path);
          const index = this.data.indexOf(node);
          if (!children || index < 0) { // If no children, or cannot find the node, no op
            return;
      Severity: Minor
      Found in frontend/datasafe-ui/src/app/component/filetree/filetree.component.ts - About 35 mins 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

      Avoid too many return statements within this method.
      Open

              return computeSha(value);

        Method findAnnotatedConstructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private <A extends Annotation> ExecutableElement findAnnotatedConstructor(TypeElement element,
                                                                                      Class<A> annotation) {
                Set<ExecutableElement> annotated = new HashSet<>();
        
                for (Element inner : element.getEnclosedElements()) {

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

            private UsernamePasswordAuthenticationToken getAuthentication(HttpServletRequest request) {
                String token = request.getHeader(SecurityConstants.TOKEN_HEADER);
                if (Strings.isNullOrEmpty(token)) {
                    return null;
                }

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

            public String withoutAuthority(URI uri, Function<String, String> decode) {
                if (uri == null) {
                    return null;
                }
        
        

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

            @Override
            @SneakyThrows
            public List<PublicKeyIDWithPublicKey> getPublicKeys(KeyStoreAccess keyStoreAccess) {
                log.debug("get public keys");
                List<PublicKeyIDWithPublicKey> result = new ArrayList<>();

        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

        Severity
        Category
        Status
        Source
        Language