LearnPAd/learnpad

View on GitHub
lp-content-analysis/src/main/java/eu/learnpad/ca/impl/BridgeImpl.java

Summary

Maintainability
F
4 days
Test Coverage

Method putValidateCollaborativeContent has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    @Path("/validatecollaborativecontent")
    @POST
    @Consumes(MediaType.APPLICATION_XML)
    public String putValidateCollaborativeContent(CollaborativeContentAnalysis contentFile)
            throws LpRestException{
Severity: Minor
Found in lp-content-analysis/src/main/java/eu/learnpad/ca/impl/BridgeImpl.java - About 5 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

Method putValidateStaticContent has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    @Path("/validatestaticcontent")
    @POST
    public String putValidateStaticContent(StaticContentAnalysis contentFile)
            throws LpRestException {
        try{
Severity: Minor
Found in lp-content-analysis/src/main/java/eu/learnpad/ca/impl/BridgeImpl.java - About 5 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

File BridgeImpl.java has 355 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package eu.learnpad.ca.impl;

import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
Severity: Minor
Found in lp-content-analysis/src/main/java/eu/learnpad/ca/impl/BridgeImpl.java - About 4 hrs to fix

    Method putValidateStaticContent has 65 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Path("/validatestaticcontent")
        @POST
        public String putValidateStaticContent(StaticContentAnalysis contentFile)
                throws LpRestException {
            try{
    Severity: Major
    Found in lp-content-analysis/src/main/java/eu/learnpad/ca/impl/BridgeImpl.java - About 2 hrs to fix

      Method putValidateCollaborativeContent has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Path("/validatecollaborativecontent")
          @POST
          @Consumes(MediaType.APPLICATION_XML)
          public String putValidateCollaborativeContent(CollaborativeContentAnalysis contentFile)
                  throws LpRestException{
      Severity: Major
      Found in lp-content-analysis/src/main/java/eu/learnpad/ca/impl/BridgeImpl.java - About 2 hrs to fix

        Method getCollaborativeContentVerifications has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            @Path("/validatecollaborativecontent/{idAnnotatedCollaborativeContentAnalysis:\\d+}")
            @GET
            public AnnotatedCollaborativeContentAnalyses getCollaborativeContentVerifications(@PathParam("idAnnotatedCollaborativeContentAnalysis") String contentID)
                    throws LpRestException{
                try{
        Severity: Minor
        Found in lp-content-analysis/src/main/java/eu/learnpad/ca/impl/BridgeImpl.java - About 45 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

        Method getStaticContentVerifications has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            @Path("/validatestaticcontent/{idAnnotatedStaticContentAnalysis:\\d+}")
            @GET
            public AnnotatedStaticContentAnalyses getStaticContentVerifications(
                    @PathParam("idAnnotatedStaticContentAnalysis") String contentID) throws LpRestException {
                try{
        Severity: Minor
        Found in lp-content-analysis/src/main/java/eu/learnpad/ca/impl/BridgeImpl.java - About 45 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

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

            @Path("/validatecollaborativecontent/{idAnnotatedCollaborativeContentAnalysis:\\d+}")
            @GET
            public AnnotatedCollaborativeContentAnalyses getCollaborativeContentVerifications(@PathParam("idAnnotatedCollaborativeContentAnalysis") String contentID)
                    throws LpRestException{
                try{
        lp-content-analysis/src/main/java/eu/learnpad/ca/impl/BridgeImpl.java on lines 387..413

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

        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

            @Path("/validatestaticcontent/{idAnnotatedStaticContentAnalysis:\\d+}")
            @GET
            public AnnotatedStaticContentAnalyses getStaticContentVerifications(
                    @PathParam("idAnnotatedStaticContentAnalysis") String contentID) throws LpRestException {
                try{
        lp-content-analysis/src/main/java/eu/learnpad/ca/impl/BridgeImpl.java on lines 179..207

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

        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

            @Path("/validatecollaborativecontent/{idAnnotatedCollaborativeContentAnalysis:\\d+}/status")
            @GET
            public String getStatusCollaborativeContentVerifications(@PathParam("idAnnotatedCollaborativeContentAnalysis") String contentID)
                    throws LpRestException{
                try{
        lp-content-analysis/src/main/java/eu/learnpad/ca/impl/BridgeImpl.java on lines 415..439

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

        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

            @Path("/validatestaticcontent/{idAnnotatedStaticContentAnalysis:\\d+}/status")
            @GET
            public String getStatusStaticContentVerifications(@PathParam("idAnnotatedStaticContentAnalysis") String contentID)
                    throws LpRestException {
                try{
        lp-content-analysis/src/main/java/eu/learnpad/ca/impl/BridgeImpl.java on lines 209..230

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

        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

                            }else{
                                if(contentFile.getLanguage().toLowerCase().equals("italian")){
                                    lang = new Italian();
                                }else
                                    if(contentFile.getLanguage().toLowerCase().equals("english uk")){
        lp-content-analysis/src/main/java/eu/learnpad/ca/impl/BridgeImpl.java on lines 314..325

        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

                            }else{
                                if(contentFile.getLanguage().toLowerCase().equals("italian")){
                                    lang = new Italian();
                                }else
                                    if(contentFile.getLanguage().toLowerCase().equals("english uk")){
        lp-content-analysis/src/main/java/eu/learnpad/ca/impl/BridgeImpl.java on lines 82..93

        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

            @Path("/validatecollaborativecontent/{idAnnotatedCollaborativeContentAnalysis:\\d+}/view")
            @GET
            public String getCollaborativeContentVerificationsView(@PathParam("idAnnotatedCollaborativeContentAnalysis") String contentID)
                    throws LpRestException {
        //        String ip,port="";
        lp-content-analysis/src/main/java/eu/learnpad/ca/impl/BridgeImpl.java on lines 441..462

        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

            @Path("/validatestaticcontent/{idAnnotatedStaticContentAnalysis:\\d+}/view")
            @GET
            public String getStaticContentVerificationsView(@PathParam("idAnnotatedCollaborativeContentAnalysis") String contentID)
                    throws LpRestException {
        //        String ip,port="";
        lp-content-analysis/src/main/java/eu/learnpad/ca/impl/BridgeImpl.java on lines 232..253

        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

            public BridgeImpl() {
                String confFileName = System.getProperty(configFileLocationLabel);
                if (confFileName == null) {
                    this.conf = new PropertyUtil();
                } else {
        lp-content-analysis/src/main/java/eu/learnpad/ca/main/Main.java on lines 29..36

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

        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

        There are no issues that match your filters.

        Category
        Status