Jasig/WebproxyPortlet

View on GitHub

Showing 60 of 60 total issues

Method decrypt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private String decrypt(final String cryptotext, boolean logError) {
        try {
            return this.encryptor.decrypt(cryptotext);
        } catch (EncryptionInitializationException e) {
            if (logError) {

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

    public void updateUrls(final String searchResultUrl,
            final PortletRequest request, String[] whitelistRegexes) {
        final String REWRITTEN_URLS_KEY = "rewrittenUrls";
        
        // attempt to retrieve the list of rewritten URLs from the session
Severity: Minor
Found in src/main/java/org/jasig/portlet/proxy/search/util/SearchUtil.java - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method proxyTarget has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    @ActionMapping
    public void proxyTarget(final @RequestParam("proxy.url") String url, final ActionRequest request,
                            final ActionResponse response) throws IOException {
        log.debug("Entering action mapping");
        IContentResponse proxyResponse = null;

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method showContent has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    @RequestMapping
    public ModelAndView showContent(PortletRequest request) {
        final ModelAndView mv = new ModelAndView();
        
        final PortletPreferences preferences = request.getPreferences();

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 false;

    Avoid too many return statements within this method.
    Open

                return false;

      Avoid too many return statements within this method.
      Open

              return true;

        Avoid too many return statements within this method.
        Open

                    return false;

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

                  if (fieldValue == null) {
                      if (other.fieldValue != null)
                          return false;
                  } else if (!fieldValue.equals(other.fieldValue))
                      return false;
          src/main/java/org/jasig/portlet/proxy/mvc/portlet/gateway/GatewayPreference.java on lines 173..177
          src/main/java/org/jasig/portlet/proxy/mvc/portlet/gateway/GatewayPreference.java on lines 178..182
          src/main/java/org/jasig/portlet/proxy/mvc/portlet/gateway/GatewayPreference.java on lines 185..189

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

          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

          Avoid too many return statements within this method.
          Open

                          return false;

            Avoid too many return statements within this method.
            Open

                            return false;

              Avoid too many return statements within this method.
              Open

                          return false;

                Avoid too many return statements within this method.
                Open

                                return false;

                  Identical blocks of code found in 4 locations. Consider refactoring.
                  Open

                          if (logicalFieldName == null) {
                              if (other.logicalFieldName != null)
                                  return false;
                          } else if (!logicalFieldName.equals(other.logicalFieldName))
                              return false;
                  src/main/java/org/jasig/portlet/proxy/mvc/portlet/gateway/GatewayPreference.java on lines 168..172
                  src/main/java/org/jasig/portlet/proxy/mvc/portlet/gateway/GatewayPreference.java on lines 178..182
                  src/main/java/org/jasig/portlet/proxy/mvc/portlet/gateway/GatewayPreference.java on lines 185..189

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

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

                          if (preferenceName == null) {
                              if (other.preferenceName != null)
                                  return false;
                          } else if (!preferenceName.equals(other.preferenceName))
                              return false;
                  src/main/java/org/jasig/portlet/proxy/mvc/portlet/gateway/GatewayPreference.java on lines 168..172
                  src/main/java/org/jasig/portlet/proxy/mvc/portlet/gateway/GatewayPreference.java on lines 173..177
                  src/main/java/org/jasig/portlet/proxy/mvc/portlet/gateway/GatewayPreference.java on lines 185..189

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

                  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

                  Avoid too many return statements within this method.
                  Open

                              return false;

                    Identical blocks of code found in 4 locations. Consider refactoring.
                    Open

                            if (system == null) {
                                if (other.system != null)
                                    return false;
                            } else if (!system.equals(other.system))
                                return false;
                    src/main/java/org/jasig/portlet/proxy/mvc/portlet/gateway/GatewayPreference.java on lines 168..172
                    src/main/java/org/jasig/portlet/proxy/mvc/portlet/gateway/GatewayPreference.java on lines 173..177
                    src/main/java/org/jasig/portlet/proxy/mvc/portlet/gateway/GatewayPreference.java on lines 178..182

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

                    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

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

                        @RenderMapping
                        public void showContent(final RenderRequest request, final RenderResponse response) {
                            log.debug("Entering render mapping");
                            IContentResponse proxyResponse = null;
                            try {

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

                        @Override
                        public List<SearchResult> search(SearchRequest searchQuery,
                                EventRequest request, Document document) {
                            List<SearchResult> results = new ArrayList<SearchResult>();
                            final String[] whitelistRegexes = request.getPreferences().getValues("anchorWhitelistRegex", new String[] {});
                    Severity: Minor
                    Found in src/main/java/org/jasig/portlet/proxy/search/AnchorSearchStrategy.java - About 25 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 getAccessibleEntry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected GatewayEntry getAccessibleEntry(List<GatewayEntry> entries, PortletRequest request, String beanName) {
                            for (GatewayEntry entry : entries) {
                                if (entry.getName().equals(beanName)) {
                                    if (entry.entryIsAccessible(request)) {
                                        return entry;

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Severity
                    Category
                    Status
                    Source
                    Language