alsutton/enterprisepasswordsafe

View on GitHub

Showing 206 of 206 total issues

Method doGet has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
            throws ServletException, IOException {

        try {

    Method doGet has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

         @Override
        protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
            throws ServletException {
            response.setContentType("text/csv");
            response.setHeader("Content-Disposition", "attachment; filename=\"AllPasswords.csv\"");

      Method doGet has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Method getSummaries has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public Set<AccessSummary> getSummaries(final AccessControledObject item)
                    throws SQLException {
                Set<AccessSummary> summaries = new TreeSet<>();
        
                try(PreparedStatement uacPS = BOMFactory.getCurrentConntection().prepareStatement(GET_UAC_SUMMARIES_UAC_SQL)) {

          Method getSummaries has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public Set<AccessSummary> getSummaries(final AccessControledObject item)
                      throws SQLException {
                  Set<AccessSummary> summaries = new TreeSet<>();
          
                  Connection conn = BOMFactory.getCurrentConntection();

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

                static GroupAccessControl buildFromResultSet(final ResultSet rs,
                                                             final AccessControlDecryptor decryptor)
                        throws SQLException, GeneralSecurityException {
                    return GroupAccessControl.builder()
                            .withItemId(rs.getString(1))
            src/main/java/com/enterprisepasswordsafe/database/UserAccessControlDAO.java on lines 238..250

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

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

                static UserAccessControl buildFromResultSet(final ResultSet rs,
                                                            final AccessControlDecryptor decryptor)
                        throws SQLException, GeneralSecurityException {
                    return UserAccessControl.builder()
                            .withItemId(rs.getString(1))
            src/main/java/com/enterprisepasswordsafe/database/GroupAccessControlDAO.java on lines 337..349

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

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

                @Override
                protected void doPost(final HttpServletRequest request, final HttpServletResponse response)
                        throws ServletException, IOException {
                    try {
                        String passwordId = request.getParameter("id");

              Method sendUserCreationEmailToUserIfNeccessary has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private void sendUserCreationEmailToUserIfNeccessary(User createdUser, String password)
                          throws SQLException, MessagingException {
                      String usersEmailAddress = createdUser.getEmail();
                      if( usersEmailAddress == null || usersEmailAddress.isEmpty()) {
                          return;

                Method getCurrentPropertySettings has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Method doPost has 26 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

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

                      Method processSelection has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private void processSelection(HttpServletRequest request, String action, final HierarchyNode node)
                                  throws SQLException {
                              String[] nodes = request.getParameterValues(BaseServlet.NODE_LIST_PARAMETER);
                              if (nodes == null || nodes.length == 0) {
                                  StringBuilder message = new StringBuilder();

                      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 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                              @Override
                              public void process(final HierarchyNode node, final Password password) {
                                  if (password == null || password.getPasswordType() == Password.TYPE_PERSONAL) {
                                      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 checkLoginRestrictions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private void checkLoginRestrictions(HttpServletRequest request, User user)
                                  throws GeneralSecurityException, SQLException, UnknownHostException, ServletException, RedirectException {
                              String address = request.getRemoteAddr();
                              String userId = user.getId();
                              List<UserIPZoneRestriction> restrictions = UserIPZoneRestrictionDAO.getInstance().getApplicable(userId, address);

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

                          public static String substituteParameters( final Map<String,String> values, 
                                  final String text ) {
                              
                              String textToModify = text;
                              while( true ) {

                      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 a Cognitive Complexity of 9 (exceeds 5 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();

                      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 needsUpdate has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          private boolean needsUpdate(AccessControl adminAc, AccessControl currentAccessControl,
                                                      UserAccessControlDAO accessControlDAO,
                                                      User entity, Password thePassword, String access,
                                                      AccessControlBuilder<UserAccessControl> accessControlBuilder)

                        Method needsUpdate has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            private boolean needsUpdate(AccessControl adminAc, AccessControl currentAccessControl,
                                                        GroupAccessControlDAO accessControlDAO,
                                                        Group entity, Password thePassword, String access,
                                                        AccessControlBuilder<GroupAccessControl> accessControlBuilder)

                          Method getEventsForDateRange has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public List<EventsForDay> getEventsForDateRange(final long startDate,
                                      final long endDate, final String userIdLimit, final String itemIdLimit,
                                      final User fetchingUser, final boolean includePersonal,
                                      final boolean validateTamperstamp)
                            Severity
                            Category
                            Status
                            Source
                            Language