LearnPAd/learnpad

View on GitHub
lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/HistorySummaryImpl.java

Summary

Maintainability
F
4 days
Test Coverage

File HistorySummaryImpl.java has 351 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 */
package eu.learnpad.transformations.metamodel_corpus.xwiki.impl;

import javax.xml.datatype.XMLGregorianCalendar;

    HistorySummaryImpl has 34 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class HistorySummaryImpl extends LinkCollectionImpl implements HistorySummary {
        /**
         * The default value of the '{@link #getPageId() <em>Page Id</em>}' attribute.
         * <!-- begin-user-doc -->
         * <!-- end-user-doc -->

      Method eIsSet has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public boolean eIsSet(int featureID) {
              switch (featureID) {
                  case XwikiPackage.HISTORY_SUMMARY__PAGE_ID:
                      return PAGE_ID_EDEFAULT == null ? pageId != null : !PAGE_ID_EDEFAULT.equals(pageId);

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

          @Override
          public void eSet(int featureID, Object newValue) {
              switch (featureID) {
                  case XwikiPackage.HISTORY_SUMMARY__PAGE_ID:
                      setPageId((String)newValue);

        Method eUnset has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public void eUnset(int featureID) {
                switch (featureID) {
                    case XwikiPackage.HISTORY_SUMMARY__PAGE_ID:
                        setPageId(PAGE_ID_EDEFAULT);

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

              @Override
              public String toString() {
                  if (eIsProxy()) return super.toString();
          
                  StringBuffer result = new StringBuffer(super.toString());

            Method eGet has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                @Override
                public Object eGet(int featureID, boolean resolve, boolean coreType) {
                    switch (featureID) {
                        case XwikiPackage.HISTORY_SUMMARY__PAGE_ID:
                            return getPageId();

              Method eIsSet has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  @Override
                  public boolean eIsSet(int featureID) {
                      switch (featureID) {
                          case XwikiPackage.HISTORY_SUMMARY__PAGE_ID:
                              return PAGE_ID_EDEFAULT == null ? pageId != null : !PAGE_ID_EDEFAULT.equals(pageId);

                Avoid too many return statements within this method.
                Open

                                return;

                  Avoid too many return statements within this method.
                  Open

                                  return;

                    Avoid too many return statements within this method.
                    Open

                                    return;

                      Avoid too many return statements within this method.
                      Open

                                      return;

                        Avoid too many return statements within this method.
                        Open

                                        return;

                          Avoid too many return statements within this method.
                          Open

                                          return;

                            Avoid too many return statements within this method.
                            Open

                                            return;

                              Avoid too many return statements within this method.
                              Open

                                              return;

                                Avoid too many return statements within this method.
                                Open

                                                return;

                                  Avoid too many return statements within this method.
                                  Open

                                                  return;

                                    Avoid too many return statements within this method.
                                    Open

                                                    return;

                                      Avoid too many return statements within this method.
                                      Open

                                                      return;

                                        Avoid too many return statements within this method.
                                        Open

                                                        return;

                                          Avoid too many return statements within this method.
                                          Open

                                                          return;

                                            Avoid too many return statements within this method.
                                            Open

                                                            return;

                                              Avoid too many return statements within this method.
                                              Open

                                                              return;

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

                                                    @Override
                                                    public String toString() {
                                                        if (eIsProxy()) return super.toString();
                                                
                                                        StringBuffer result = new StringBuffer(super.toString());

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

                                                    @Override
                                                    public void eSet(int featureID, Object newValue) {
                                                        switch (featureID) {
                                                            case XwikiPackage.HISTORY_SUMMARY__PAGE_ID:
                                                                setPageId((String)newValue);
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/AttachmentImpl.java on lines 625..666
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/ObjectSummaryImpl.java on lines 623..664

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

                                                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

                                                    @Override
                                                    public Object eGet(int featureID, boolean resolve, boolean coreType) {
                                                        switch (featureID) {
                                                            case XwikiPackage.HISTORY_SUMMARY__PAGE_ID:
                                                                return getPageId();
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/AttachmentImpl.java on lines 589..618
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/ObjectSummaryImpl.java on lines 587..616

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

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

                                                    public void setMajorVersion(int newMajorVersion) {
                                                        int oldMajorVersion = majorVersion;
                                                        majorVersion = newMajorVersion;
                                                        boolean oldMajorVersionESet = majorVersionESet;
                                                        majorVersionESet = true;
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/AttachmentImpl.java on lines 363..370
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/CommentImpl.java on lines 246..253
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/CommentImpl.java on lines 418..425
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/HistorySummaryImpl.java on lines 481..488
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/ObjectSummaryImpl.java on lines 529..536
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/PageImpl.java on lines 330..337
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/PageImpl.java on lines 376..383
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/SearchResultImpl.java on lines 700..707
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/SearchResultImpl.java on lines 767..774

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

                                                    public void setMinorVersion(int newMinorVersion) {
                                                        int oldMinorVersion = minorVersion;
                                                        minorVersion = newMinorVersion;
                                                        boolean oldMinorVersionESet = minorVersionESet;
                                                        minorVersionESet = true;
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/AttachmentImpl.java on lines 363..370
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/CommentImpl.java on lines 246..253
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/CommentImpl.java on lines 418..425
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/HistorySummaryImpl.java on lines 435..442
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/ObjectSummaryImpl.java on lines 529..536
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/PageImpl.java on lines 330..337
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/PageImpl.java on lines 376..383
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/SearchResultImpl.java on lines 700..707
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/SearchResultImpl.java on lines 767..774

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

                                                    public void unsetMajorVersion() {
                                                        int oldMajorVersion = majorVersion;
                                                        boolean oldMajorVersionESet = majorVersionESet;
                                                        majorVersion = MAJOR_VERSION_EDEFAULT;
                                                        majorVersionESet = false;
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/AttachmentImpl.java on lines 377..384
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/CommentImpl.java on lines 260..267
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/CommentImpl.java on lines 432..439
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/HistorySummaryImpl.java on lines 495..502
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/ObjectSummaryImpl.java on lines 543..550
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/PageImpl.java on lines 344..351
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/PageImpl.java on lines 390..397
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/SearchResultImpl.java on lines 714..721
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/SearchResultImpl.java on lines 781..788

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

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

                                                    public void unsetMinorVersion() {
                                                        int oldMinorVersion = minorVersion;
                                                        boolean oldMinorVersionESet = minorVersionESet;
                                                        minorVersion = MINOR_VERSION_EDEFAULT;
                                                        minorVersionESet = false;
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/AttachmentImpl.java on lines 377..384
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/CommentImpl.java on lines 260..267
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/CommentImpl.java on lines 432..439
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/HistorySummaryImpl.java on lines 449..456
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/ObjectSummaryImpl.java on lines 543..550
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/PageImpl.java on lines 344..351
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/PageImpl.java on lines 390..397
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/SearchResultImpl.java on lines 714..721
                                                lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/SearchResultImpl.java on lines 781..788

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

                                                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