File UserServlet.java
has 261 lines of code (exceeds 250 allowed). Consider refactoring. 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 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 doPost
has a Cognitive Complexity of 11 (exceeds 5 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"))) {
- 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 validatePasswordFields
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private void validatePasswordFields(final HttpServletRequest request)
throws EPSUIException, SQLException {
String password1 = request.getParameter("password1");
String password2 = request.getParameter("password2");
if ((password1 == null || password1.isEmpty())
- 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 setRule
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private void setRule(UserIPZoneRestrictionDAO uipzrDAO, UserIPZoneRestriction restriction,
String zoneId, String userId, String rule)
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) {
- 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"