Jasig/WebproxyPortlet

View on GitHub
src/main/java/org/jasig/portlet/proxy/mvc/portlet/gateway/GatewayPortletEditController.java

Summary

Maintainability
C
1 day
Test Coverage

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 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 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 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();

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

      There are no issues that match your filters.

      Category
      Status