Jasig/WebproxyPortlet

View on GitHub

Showing 52 of 60 total issues

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

    @Override
    public void intercept(HttpContentRequestImpl proxyRequest,
            PortletRequest portletRequest) {
        
        // replace the portlet preference fields with user specific entries

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

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

    Method equals has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        public boolean equals(Object obj) {
            if (this == obj)
                return true;
            if (obj == null)

      Method intercept has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        @Override
          public void intercept(HttpContentRequestImpl proxyRequest,
                  PortletRequest portletRequest) {
      
              try {

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

            @Override
            protected void prepareAuthentication(HttpContentRequestImpl contentRequest, PortletRequest portletRequest) {
        
                // retrieve the CAS ticket from the UserInfo map
                @SuppressWarnings("unchecked")

          Method validate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public boolean validate(HttpContentRequestImpl proxyRequest, PortletRequest portletRequest) {
                  boolean allPreferencesSet = true;
                  PortletPreferences prefs = portletRequest.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 showContent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Method search has 27 lines of code (exceeds 25 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[] {});

              Avoid deeply nested control flow statements.
              Open

                                      if (!rslt.containsKey(preferenceName)) {
                                          // retrieve the preference and stuff the value here....
                                          String preferredValue = prefs.getValue(preferenceName, "");
                                          if (parameter.getSecured() && StringUtils.isNotBlank(preferredValue)
                                                  && stringEncryptionService != null) {

                Avoid deeply nested control flow statements.
                Open

                                        if (attributeUrl.contains("://") || attributeUrl.startsWith("//")) {
                                            // do nothing...
                                        }
                
                                        // (2) if the URL is relative to the server base,

                  Method getEnterCredentialsAllowed has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                          public boolean getEnterCredentialsAllowed() {
                              // The way Gateway SSO supports user-provided credentials is by 
                              // piggy-backing on the UserPreferencesPreInterceptor, so the way 
                              // we'll answer this question (for now... until we learn why this 
                              // approach doesn't suit all circumstances) is by checking whether 

                  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 deeply nested control flow statements.
                  Open

                                          if (attributeUrl.toLowerCase().startsWith(p.getPrefix())) {
                                              ignorable = true;
                                          }

                    Method updateUrls has 6 arguments (exceeds 4 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) {

                      Avoid deeply nested control flow statements.
                      Open

                                              if (value != null) {
                                                  pairs.add(new BasicNameValuePair(param.getKey(), value));
                                              }

                        Avoid deeply nested control flow statements.
                        Open

                                                if (StringUtils.isNotBlank(regex)) {
                                                  final Pattern pattern = Pattern.compile(regex);  // TODO share compiled regexes
                                                  if (pattern.matcher(attributeUrl).find()) {
                        
                                                      // record that we've rewritten this URL

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

                              @RenderMapping
                              public ModelAndView getView(RenderRequest request){
                                  final ModelAndView mv = new ModelAndView();
                                  final List<GatewayEntry> entries =  removeInaccessibleEntries(gatewayEntries, request);
                                  final Map<String, Boolean> validations = new HashMap<String, Boolean>();

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

                          Severity
                          Category
                          Status
                          Source
                          Language