LearnPAd/learnpad

View on GitHub
lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java

Summary

Maintainability
D
3 days
Test Coverage

Method execute has 143 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private int execute(String contenthtml, 
            List<Annotation> listannotation) {
        int id = 0;
        int offset = 2300;
        id = offset;

    Method execute has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

        private int execute(String contenthtml, 
                List<Annotation> listannotation) {
            int id = 0;
            int offset = 2300;
            id = offset;

    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

        public AnnotatedCollaborativeContentAnalysis check(
                CollaborativeContentAnalysis collaborativeContentInput) {
            String title = collaborativeContentInput.getCollaborativeContent().getTitle();
            String idc = collaborativeContentInput.getCollaborativeContent().getId();
            String contenthtml = collaborativeContentInput.getCollaborativeContent().getContenthtml();
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/completeness/Completeness.java on lines 116..143

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

    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

        private AnnotatedStaticContentAnalysis check(StaticContentAnalysis staticContentInput) {
            String title = staticContentInput.getStaticContent().getTitle();
            String idc = staticContentInput.getStaticContent().getId();
            String contenthtml = staticContentInput.getStaticContent().getContenthtml();
    
    
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/completeness/Completeness.java on lines 82..108

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

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

        public void run() {
            lStartTime = System.currentTimeMillis();
            //some tasks
            if (collaborativeContentInput != null) {
                check(collaborativeContentInput);
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/completeness/Completeness.java on lines 63..79
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/contentclarity/ContentClarity.java on lines 46..62
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/non_ambiguity/NonAmbiguity.java on lines 49..64
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/simplicity/Simplicity.java on lines 51..66

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

    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

                    if(!PSPrule2){
                        String rec = String.format(Messages.getString("PresentationClarity.PoorSectionParagraphRecomandation",language), num_p_tag_max); //$NON-NLS-1$ //$NON-NLS-2$
                        Annotation rule2 = new Annotation(id,type,0,0,rec);
                        listannotation.add(rule2);
                        log.trace(rec);
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 300..306
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 318..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 68.

    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

                    if(!ERrule1){
                        String rec = String.format(Messages.getString("PresentationClarity.ExcessiveReferencesRecomandation",language),num_min_ref); //$NON-NLS-1$ //$NON-NLS-2$
                        Annotation rule1 = new Annotation(id,type,0,0,rec);
                        listannotation.add(rule1);
                        log.trace(rec);
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 191..197
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 300..306

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

    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

                    if(!ELDrule1){
                        String rec = String.format(Messages.getString("PresentationClarity.TooLongContentRecomandation",language), num_max_word); //$NON-NLS-1$ //$NON-NLS-2$
                        Annotation rule1 = new Annotation(id,type,0,0,rec);
                        listannotation.add(rule1);
                        log.trace(rec);
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 191..197
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 318..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 68.

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

                    if(!ENIPrule1){
                        String rec = Messages.getString("PresentationClarity.MaxListRecomandation",language); //$NON-NLS-1$
                        Annotation rule1 = new Annotation(id,type,0,0,rec);
                        listannotation.add(rule1);
                        log.trace(rec);
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 180..186
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 222..228
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 232..239
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 251..257

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

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

                    if(!RCErule1){
                        String rec = Messages.getString("PresentationClarity.RelevantContentRecomandation",language); //$NON-NLS-1$
                        Annotation rule1 = new Annotation(id,type,0,0,rec);
                        listannotation.add(rule1);
                        log.trace(rec);
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 180..186
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 232..239
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 251..257
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 282..288

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

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

                    if(!PSPrule1){
                        String rec = Messages.getString("PresentationClarity.PoorSectionRecomandation",language); //$NON-NLS-1$
                        Annotation rule1 = new Annotation(id,type,0,0,rec);
                        listannotation.add(rule1);
                        log.trace(rec);
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 222..228
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 232..239
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 251..257
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 282..288

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

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

                    if(!IHIPrule1){
                        String rec = Messages.getString("PresentationClarity.MinListRecomandation",language); //$NON-NLS-1$
                        Annotation rule1 = new Annotation(id,type,0,0,rec);
                        listannotation.add(rule1);
                        log.trace(rec);
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 180..186
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 222..228
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 232..239
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 282..288

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

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

                    if(!RCErule2){
                        String rec = Messages.getString("PresentationClarity.BoldRecomandation",language); //$NON-NLS-1$
                        // TODO: Ritestare
                        Annotation rule1 = new Annotation(id,type,0,0,rec);
                        listannotation.add(rule1);
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 180..186
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 222..228
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 251..257
    lp-content-analysis/src/main/java/eu/learnpad/ca/analysis/presentation/PresentationClarity.java on lines 282..288

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

    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