alsutton/enterprisepasswordsafe

View on GitHub

Showing 189 of 206 total issues

GroupAccessControlDAO has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

public class GroupAccessControlDAO
    extends AbstractAccessControlDAO
        implements AccessControlDAOInterface<Group, GroupAccessControl> {

    /**

    Method doPost has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        protected void doPost(final HttpServletRequest request, final HttpServletResponse response)
                throws ServletException, IOException {
            String id = request.getParameter(ID_PARAMETER);
            PasswordRestrictionDAO prDAO = PasswordRestrictionDAO.getInstance();

      Method doPost has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          protected void doPost(final HttpServletRequest request, final HttpServletResponse response)
                  throws ServletException, IOException {
              request.setAttribute("error_page", "/admin/PasswordRestrictionsAddStage1");
              int specialCount;

        Method doPost has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            @Override
            protected void doPost( final HttpServletRequest request, final HttpServletResponse response)
                throws ServletException, IOException {
                try {
                    User remoteUser = SecurityUtils.getRemoteUser(request);

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

            public void setCustomFields(final Map<String, String> fields) {
                Map<String, String> existingFields = getAllCustomFields();
        
                if(fields == null || fields.isEmpty()) {
                    if(existingFields != null) {
        Severity: Minor
        Found in src/main/java/com/enterprisepasswordsafe/database/Password.java - About 2 hrs 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 doGet has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
                    throws IOException {
                String id = ServletUtils.getInstance().getParameterValue(request, SharedParameterNames.PASSWORD_ID_PARAMETER);
                String dt = request.getParameter(BaseServlet.DATE_TIME_PARAMETER);

          Method create has 16 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public Password create(final User theCreator, final Group adminGroup,
                                     final String username, final String password, final String location,
                                     final String notes, final AuditingLevel audit, final boolean history,
                                     final long expiry, final String parentNode, final String restrictionId,
                                     final boolean raEnabled, final int raApprovers, final int raBlockers,
          Severity: Major
          Found in src/main/java/com/enterprisepasswordsafe/database/PasswordDAO.java - About 2 hrs to fix

            Method generate has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public String generate( final int upperCount, final int lowerCount,
                        final int numericCount, int specialCount, int minLength,
                        int maxLength, final String specialChars, boolean startSpecial ) {
                    if(    specialChars.length() > 0
                    &&  specialCount > 0

              Method doEndTag has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public int doEndTag() {
                      try {
                          String day;
                          String month;
                          String year;

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

                    @Override
                    protected void doPost(final HttpServletRequest request, final HttpServletResponse response)
                            throws IOException, ServletException{
                        String csrfToken = request.getParameter("token");
                        if(csrfToken == null || !csrfToken.equals(request.getSession(true).getAttribute("csrfToken"))) {

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

                      public Set<ScriptProperties> getCurrentPropertySettings(
                              final HttpServletRequest request,
                              final IntegrationModule module,
                              final IntegrationModuleScript scriptDetails)
                              throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {

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

                      @Override
                      public void process(final HierarchyNode node, final Password testPassword)
                          throws  GeneralSecurityException, SQLException, UnsupportedEncodingException {
                          if (testPassword == null || !testPassword.expires()) {
                              return;

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

                      public void runScript( Map<String,String> parameters, String script ) 
                          throws IOException {
                  
                          try (LineNumberReader lnr = new LineNumberReader(new StringReader(script))) {
                              String nextLine;

                    Method doPost has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        @Override
                        protected void doPost(final HttpServletRequest request, final HttpServletResponse response)
                                throws IOException, ServletException {
                            request.setAttribute("error_page", "/admin/CreateUser");
                    
                    

                      Method doPost has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          @Override
                          protected void doPost(final HttpServletRequest request, final HttpServletResponse response)
                                  throws IOException, ServletException {
                              request.setAttribute("error_page", "/system/CreatePassword");
                              try {

                        Method doPost has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            @Override
                            protected void doPost( final HttpServletRequest request, final HttpServletResponse response)
                                    throws ServletException, IOException {
                                String id = request.getParameter(SecurityUtils.USER_ID_PARAMETER);
                                String internalpassword = request.getParameter(INTERNAL_PASSWORD_PARAMETER);

                          Method doEndTag has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public int doEndTag() {
                                  try {            
                                      pageContext.getOut().print("<select name=\"" );
                                      pageContext.getOut().print(name);
                                      pageContext.getOut().print("\">");

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

                              @Override
                              protected void doPost(final HttpServletRequest request, final HttpServletResponse response)
                                      throws ServletException {
                                  try {
                                      User thisUser = SecurityUtils.getRemoteUser(request);

                            Method doPost has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                @Override
                                protected void doPost(final HttpServletRequest request, final HttpServletResponse response)
                                        throws ServletException, IOException {
                                    try {
                                        String moduleId = (String) request.

                              Method doPost has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  @Override
                                  protected void doPost(final HttpServletRequest request, final HttpServletResponse response)
                                          throws IOException, ServletException {
                                      String csrfToken = request.getParameter("token");
                                      if(csrfToken == null
                                Severity
                                Category
                                Status
                                Source
                                Language