Showing 64 of 111 total issues
Method queryRandom
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("random")
public List<QueryResponse> queryRandom(@Context HttpServletRequest request,
@QueryParam(value = "inclTags") String inclTags, @QueryParam(value = "partner") String partner,
Method run
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public void run() {
File toWatch = new File(sourceLocation);
log.info("PropertyFileWatcher started");
try {
final Path path = FileSystems.getDefault().getPath(toWatch.getParent());
Method values
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
public PicturesRecord values(Integer value1, Integer value2, Integer value3, String value4, String value5, Timestamp value6, Integer value7, Integer value8) {
Method getRegExFromJsonArray
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private String getRegExFromJsonArray(JsonArray array) {
if (array.isEmpty()) {
return "";
}
StringBuilder buff = new StringBuilder();
- 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"
Further reading
Method values
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public OfficesRecord values(Integer value1, String value2, Double value3, Double value4, Integer value5, Integer value6, String value7) {
Method query
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public List<QueryResponse> query(Set<String> tags, Set<String> partners, Integer maxTime, Integer selectedMinRating, int fkCommunity,
Integer fkCurrentUser, int selectedOffice) {
Method queryRandom
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public List<QueryResponse> queryRandom(@Context HttpServletRequest request,
@QueryParam(value = "inclTags") String inclTags, @QueryParam(value = "partner") String partner,
@QueryParam(value = "maxTime") Integer maxTime, @QueryParam(value = "minRating") Integer minRating,
@QueryParam(value = "selectedOffice") Integer selectedOffice) {
Method savePermission
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("{id}/savePermission")
public ResultParam savePermission(@Context HttpServletRequest request, @PathParam("id") Integer id, PermissionInput input) {
SecurityProvider.INSTANCE.checkAdmin(request);
- 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"
Further reading
Method query
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private Result<Record> query(int voteLimit, Integer startPos, Integer maxRows, Integer notFromLocation, Condition cond,
Integer userId) {
Method query
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public List<QueryResponse> query(@Context HttpServletRequest request,
@QueryParam(value = "inclTags") String inclTags, @QueryParam(value = "partner") String partner,
@QueryParam(value = "maxTime") Integer maxTime, @QueryParam(value = "minRating") Integer minRating,
@QueryParam(value = "selectedOffice") Integer selectedOffice) {
Method query
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public <R extends Record> List<R> query(Table<R> table, Condition condition, SortField<?> orderedBy, Integer startPos, Integer limit,
Class<R> clazz) {
Method copyAllAttributes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static void copyAllAttributes(ObjectName on, JsonObject targetObject) {
try {
MBeanInfo mbi = mbs.getMBeanInfo(on);
for (MBeanAttributeInfo mbai : mbi.getAttributes()) {
Object attValue = mbs.getAttribute(on, mbai.getName());
- 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"
Further reading
Method values
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public UsersPicturesVotesRecord values(Integer value1, Integer value2, Integer value3, Integer value4, Timestamp value5) {
Method writeChunkToFile
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private void writeChunkToFile(HttpServletRequest req, long flowChunkNumber, long flowChunkSize, long flowTotalSize, File originalFile)
Method updateGeoData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private void updateGeoData(LocationRecord locationRec) {
if (!keepManuallyUpdatedGeoData) {
try {
String address = locationRec.getAddress() + "," + (locationRec.getZip() != null ? locationRec.getZip() : "")
+ " " + locationRec.getCity() + "," + locationRec.getCountry();
- 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"
Further reading
Method doFilter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public void doFilter(FilterChain chain) throws IOException, ServletException {
if (redirectToSecureNeeded()) {
redirectToSecure();
} else {
if (isCallToRuntimeRestInterface()) {
- 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"
Further reading
Method getLongTermSessionCookie
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public Cookie getLongTermSessionCookie(HttpServletRequest httpReq) {
if (httpReq != null && httpReq.getCookies() != null) {
for (Cookie coo : httpReq.getCookies()) {
if ("LTS".equals(coo.getName())) {
return coo;
- 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"
Further reading
Method query
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public List<QueryResponse> query(Set<String> tags, Set<String> partners, Integer maxTime, Integer selectedMinRating, int fkCommunity,
Integer fkCurrentUser, int selectedOffice) {
Result<LocationRecord> locations = queryLocations(tags, maxTime, fkCommunity, selectedOffice);
Result<Record> reviews = queryReviews(partners, getLocationId(locations), fkCurrentUser);
- 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"
Further reading
Method isValid
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public boolean isValid() {
if (isLongTimeTokenPresent()) {
tryToLoadUserByToken();
if (userFound()) {
if (isLongTimeTokenYoungerThan3Month()) {
- 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"
Further reading
Avoid too many return
statements within this function. Open
return ('' + obj).toLowerCase().indexOf(text) > -1;