alsutton/enterprisepasswordsafe

View on GitHub

Showing 206 of 206 total issues

Avoid too many return statements within this method.
Open

            return "node with the id " + variableId;

    Avoid too many return statements within this method.
    Open

                    return password;

      Avoid too many return statements within this method.
      Open

              return "Expires in " + expiryDistance + " days";
      Severity: Major
      Found in src/main/java/com/enterprisepasswordsafe/database/PasswordBase.java - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return ACCESIBILITY_ALLOWED;

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

                  @Override
                  public boolean equals(Object otherObject) {
                      if( !(otherObject instanceof ApproverSummary) ) {
                          return false;
                      }
          src/main/java/com/enterprisepasswordsafe/database/Group.java on lines 283..291
          src/main/java/com/enterprisepasswordsafe/database/dbpool/DatabasePool.java on lines 78..86

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

          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

          Avoid too many return statements within this method.
          Open

                      return "Expires Tomorrow";
          Severity: Major
          Found in src/main/java/com/enterprisepasswordsafe/database/PasswordBase.java - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return userRule;

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

                  @Override
                  public boolean equals(final Object otherObject) {
                      if (!(otherObject instanceof Group)) {
                          return false;
                      }
              Severity: Minor
              Found in src/main/java/com/enterprisepasswordsafe/database/Group.java and 2 other locations - About 30 mins to fix
              src/main/java/com/enterprisepasswordsafe/database/AccessRole.java on lines 224..232
              src/main/java/com/enterprisepasswordsafe/database/dbpool/DatabasePool.java on lines 78..86

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

              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

              Avoid too many return statements within this method.
              Open

                              return value;
              Severity: Major
              Found in src/main/java/com/enterprisepasswordsafe/database/ConfigurationDAO.java - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return ACCESIBILITY_DENIED;

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

                      @Override
                      public boolean equals(final Object otherObject) {
                          if (!(otherObject instanceof DatabasePool)) {
                              return false;
                          }
                  src/main/java/com/enterprisepasswordsafe/database/AccessRole.java on lines 224..232
                  src/main/java/com/enterprisepasswordsafe/database/Group.java on lines 283..291

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

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

                      private void addPasswordText(HttpServletRequest request,Password password) {
                          String passwordText = password.getPassword();
                          String password1 = request.getParameter("password_1");
                          if(password1 == null || password1.isEmpty()) {
                              request.setAttribute("password_1", passwordText);

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

                      private void importPermission(final Password thePassword, final String permission)
                              throws SQLException, GeneralSecurityException, UnsupportedEncodingException {
                          char permissionType = permission.charAt(1);
                          if (permissionType != 'M' && permissionType != 'V') {
                              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 getClosestValidNodeToRequested has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private HierarchyNode getClosestValidNodeToRequested(HttpServletRequest request, User user, String nodeId)
                              throws SQLException, GeneralSecurityException {
                          HierarchyNodeDAO hnDAO = HierarchyNodeDAO.getInstance();
                          HierarchyNode node = hnDAO.getById(nodeId);
                          if(node == null || node.getType() == HierarchyNode.USER_CONTAINER_NODE) {
                  Severity: Minor
                  Found in src/main/java/com/enterprisepasswordsafe/ui/web/servlets/Explorer.java - About 25 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 doGet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      @Override
                      public void doGet(final HttpServletRequest request, final HttpServletResponse response)
                              throws ServletException, IOException {
                          String userId = request.getParameter("userId");
                          if (userId == 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 addExpiryDetails has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private void addExpiryDetails(HttpServletRequest request, ServletUtils servletUtils, Password password)
                              throws SQLException {
                          long expiryDate;
                          PasswordRestriction restriction = PasswordRestrictionDAO.getInstance().getById(password.getRestrictionId());
                          long expiry = password.getExpiry();

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

                      List<Password> getMultiple(User accessingUser, final String sql, final String... parameters)
                              throws SQLException, GeneralSecurityException, IOException {
                          List<Password> results = super.getMultiple(sql, parameters);
                          if (results.isEmpty()) {
                              return results;

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

                      public boolean ensureReasonSuppliedIfRequired(HttpServletRequest request, PasswordBase thisPassword)
                              throws SQLException, RedirectException {
                          String reasonRequired = configurationDAO.get(ConfigurationOption.PASSWORD_REASON_FOR_VIEWING_REQUIRED);
                          if( reasonRequired.charAt(0) != 'y') {
                              clearReasonSessionAttributes(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 doGet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      @Override
                      protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
                              throws IOException, ServletException {
                          String passwordId = ServletUtils.getInstance().getParameterValue(request, "id");
                          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 doGet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      @Override
                      protected void doGet(final HttpServletRequest request, final HttpServletResponse response)
                          throws ServletException, IOException {
                  
                          PasswordRestriction restriction = 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

                  Severity
                  Category
                  Status
                  Source
                  Language