Jasig/WebproxyPortlet

View on GitHub

Showing 52 of 60 total issues

Method updateUrls has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
Open

    protected void updateUrls(final Document document, final IContentResponse proxyResponse, final Map<String, Set<String>> elementSet,
            final RenderRequest request, final RenderResponse response, boolean action) {

        // attempt to retrieve the list of rewritten URLs from the session
        final PortletSession session = request.getPortletSession();

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

    protected HttpUriRequest getHttpRequest(HttpContentRequestImpl proxyRequest, PortletRequest request) {
        final HttpUriRequest httpRequest;

        // if this is a form request, we may need to use a POST or add form parameters
        if (proxyRequest.isForm()) {

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

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

public class ProxyPortletForm {

    /** Constant <code>AUTHENTICATION_TYPE="authType"</code> */
    public static final String AUTHENTICATION_TYPE = "authType";

    Method equals has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        @Override
        public boolean equals(Object obj) {
            if (this == obj)
                return true;
            if (obj == 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 getPreferencesForEntry has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        private TreeMap<String,GatewayPreference> getPreferencesForEntry
                (final GatewayEntry entry, final PortletPreferences prefs) {
    
            TreeMap<String,GatewayPreference> rslt = new TreeMap<String,GatewayPreference>();
    
    

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

        protected void updateUrls(final Document document, final IContentResponse proxyResponse, final Map<String, Set<String>> elementSet,
                final RenderRequest request, final RenderResponse response, boolean action) {
    
            // attempt to retrieve the list of rewritten URLs from the session
            final PortletSession session = request.getPortletSession();

      Method updatePortlet has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @ActionMapping
          public void updatePortlet(@ModelAttribute("form") ProxyPortletForm form, ActionRequest request,
                                    ActionResponse response, @RequestParam(value="Save", required=false) String save)
                                    throws PortletModeException {
              if (StringUtils.isNotBlank(save)) {

        Function webproxyGatewayHandleRequest has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var webproxyGatewayHandleRequest = function ($,data, index, formId) {
            var contentRequests = data.contentRequests;
            var contentRequest = contentRequests[index];
            if (index == contentRequests.length-1) {
                if (contentRequest.form) {
        Severity: Minor
        Found in src/main/webapp/scripts/webproxy.js - About 1 hr to fix

          Method intercept has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

            @Override
              public void intercept(HttpContentRequestImpl proxyRequest,
                      PortletRequest portletRequest) {
          
                  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 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Override
              public List<SearchResult> search(SearchRequest searchQuery,
                      EventRequest request, org.jsoup.nodes.Document ignore) {
                  
                  List<SearchResult> searchResults = new ArrayList<SearchResult>();
          Severity: Minor
          Found in src/main/java/org/jasig/portlet/proxy/search/GsaSearchStrategy.java - About 1 hr to fix

            Method getHttpRequest has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected HttpUriRequest getHttpRequest(HttpContentRequestImpl proxyRequest, PortletRequest request) {
                    final HttpUriRequest httpRequest;
            
                    // if this is a form request, we may need to use a POST or add form parameters
                    if (proxyRequest.isForm()) {

              Method prepareGatewayResponse has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  private void prepareGatewayResponse(ResourceRequest portletRequest, ResourceResponse portletResponse,
                                                      String beanName, Model model) throws IOException {
                      // get the requested gateway link entry from the list configured for
                      // this portlet
                      final List<GatewayEntry> entries =  gatewayEntries;

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

                  @ActionMapping(params = {"action=savePreferences"})
                  public void savePreferences(ActionRequest request, ActionResponse response,
                                              @RequestParam String entryName) throws Exception {
                      PortletPreferences prefs = 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

              Method updatePortlet has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  @ActionMapping
                  public void updatePortlet(@ModelAttribute("form") ProxyPortletForm form, ActionRequest request,
                                            ActionResponse response, @RequestParam(value="Save", required=false) String save)
                                            throws PortletModeException {
                      if (StringUtils.isNotBlank(save)) {

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

                  private IFormField getPortletPreferenceFormField(String fieldName) {
                      IFormField formField = null;
                      for (GatewayEntry entry: gatewayEntries) {
                          for (Map.Entry<HttpContentRequestImpl, List<IPreInterceptor>> requestEntry
                                  : entry.getContentRequests().entrySet()){

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

                  private void prepareGatewayResponse(ResourceRequest portletRequest, ResourceResponse portletResponse,
                                                      String beanName, Model model) throws IOException {
                      // get the requested gateway link entry from the list configured for
                      // this portlet
                      final List<GatewayEntry> entries =  gatewayEntries;

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

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

                  Method getForm has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public ProxyPortletForm getForm(PortletRequest request) {
                          final PortletPreferences preferences = request.getPreferences();
                          final ProxyPortletForm form = new ProxyPortletForm();
                  
                          form.setContentService(preferences.getValue(ProxyPortletController.CONTENT_SERVICE_KEY, null));

                    Method savePreferences has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @ActionMapping(params = {"action=savePreferences"})
                        public void savePreferences(ActionRequest request, ActionResponse response,
                                                    @RequestParam String entryName) throws Exception {
                            PortletPreferences prefs = request.getPreferences();
                    
                    

                      Function webproxyGatewayHandleRequest has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                      var webproxyGatewayHandleRequest = function ($,data, index, formId) {
                          var contentRequests = data.contentRequests;
                          var contentRequest = contentRequests[index];
                          if (index == contentRequests.length-1) {
                              if (contentRequest.form) {
                      Severity: Minor
                      Found in src/main/webapp/scripts/webproxy.js - About 1 hr 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

                      Severity
                      Category
                      Status
                      Source
                      Language