src/main/java/com/enterprisepasswordsafe/ui/web/servlets/UpdateAccess.java
File UpdateAccess.java
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
* Copyright (c) 2017 Carbon Security Ltd. <opensource@carbonsecurity.co.uk>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
Method needsUpdate
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
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
Open
private boolean needsUpdate(AccessControl adminAc, AccessControl currentAccessControl,
GroupAccessControlDAO accessControlDAO,
Group entity, Password thePassword, String access,
AccessControlBuilder<GroupAccessControl> accessControlBuilder)
Method updateAccessControl
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
private boolean updateAccessControl(AccessControl adminAc, AccessControl currentAccessControl,
PasswordPermission permission,
AccessControlBuilder<? extends AccessControl> accessControlBuilder) {
boolean changed = false;
if( permission.allowsRead && currentAccessControl.getReadKey() == null ) {
- Read upRead up
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"