LearnPAd/learnpad

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

Summary

Maintainability
F
4 days
Test Coverage

File PageSummaryImpl.java has 415 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

import org.eclipse.emf.common.notify.Notification;

    PageSummaryImpl has 38 methods (exceeds 20 allowed). Consider refactoring.
    Open

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

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

          @Override
          public boolean eIsSet(int featureID) {
              switch (featureID) {
                  case XwikiPackage.PAGE_SUMMARY__ID:
                      return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);

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

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

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

            @Override
            public void eUnset(int featureID) {
                switch (featureID) {
                    case XwikiPackage.PAGE_SUMMARY__ID:
                        setId(ID_EDEFAULT);

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

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

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

                @Override
                public boolean eIsSet(int featureID) {
                    switch (featureID) {
                        case XwikiPackage.PAGE_SUMMARY__ID:
                            return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);

              Method toString has 32 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 setTranslations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public void setTranslations(Translations newTranslations) {
                        if (newTranslations != translations) {
                            NotificationChain msgs = null;
                            if (translations != null)
                                msgs = ((InternalEObject)translations).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XwikiPackage.PAGE_SUMMARY__TRANSLATIONS, null, msgs);

                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;

                  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;

                                                  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;

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

                                                                public void setTranslations(Translations newTranslations) {
                                                                    if (newTranslations != translations) {
                                                                        NotificationChain msgs = null;
                                                                        if (translations != null)
                                                                            msgs = ((InternalEObject)translations).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XwikiPackage.PAGE_SUMMARY__TRANSLATIONS, null, msgs);
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/ADOXMLTypeImpl.java on lines 252..264
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/ADOXMLTypeImpl.java on lines 295..307
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/ADOXMLTypeImpl.java on lines 338..350
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/ADOXMLTypeImpl.java on lines 381..393
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/ATTRIBUTEPROFILESTypeImpl.java on lines 102..114
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/ATTRIBUTEPROFILESTypeImpl.java on lines 145..157
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/CONNECTORTypeImpl.java on lines 169..181
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/CONNECTORTypeImpl.java on lines 212..224
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/MODELTypeImpl.java on lines 247..259
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/SearchResultImpl.java on lines 828..840
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/XWikiImpl.java on lines 129..141

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

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

                                                                public NotificationChain basicSetTranslations(Translations newTranslations, NotificationChain msgs) {
                                                                    Translations oldTranslations = translations;
                                                                    translations = newTranslations;
                                                                    if (eNotificationRequired()) {
                                                                        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XwikiPackage.PAGE_SUMMARY__TRANSLATIONS, oldTranslations, newTranslations);
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/ADOXMLTypeImpl.java on lines 237..245
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/ADOXMLTypeImpl.java on lines 280..288
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/ADOXMLTypeImpl.java on lines 323..331
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/ADOXMLTypeImpl.java on lines 366..374
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/ATTRIBUTEPROFILESTypeImpl.java on lines 87..95
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/ATTRIBUTEPROFILESTypeImpl.java on lines 130..138
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/CONNECTORTypeImpl.java on lines 154..162
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/CONNECTORTypeImpl.java on lines 197..205
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/ado/impl/MODELTypeImpl.java on lines 232..240
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/SearchResultImpl.java on lines 813..821
                                                            lp-model-transformer/src/main/java/eu/learnpad/transformations/metamodel_corpus/xwiki/impl/XWikiImpl.java on lines 114..122

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

                                                            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