Showing 6 of 6 total issues
Method run
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void run() {
FileState state = FileState.FILE_STATE_READ_NAME_LEN;
try {
InputStream is = client.getInputStream();
- 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 run
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void run() {
FileState state = FileState.FILE_STATE_READ_NAME_LEN;
try {
InputStream is = client.getInputStream();
Method handleSWP
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void handleSWP(StreamBlock block) throws IOException, InterruptedException {
ExecutorService executorService = Executors.newFixedThreadPool(connections.size());
ArrayList<OutputStream> oss = new ArrayList<>();
ArrayList<Socket> stableSockets = new ArrayList<>();
for (Socket socket : connections) {
Method checkForClose
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private void checkForClose() throws IOException, InterruptedException {
log.info("closing client:");
if (mode == StreamMode.SERIAL) {
log.info("closing in serial mode");
for (Socket s : connections) {
- 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 handleSWP
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private void handleSWP(StreamBlock block) throws IOException, InterruptedException {
ExecutorService executorService = Executors.newFixedThreadPool(connections.size());
ArrayList<OutputStream> oss = new ArrayList<>();
ArrayList<Socket> stableSockets = new ArrayList<>();
for (Socket socket : connections) {
- 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 read
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static byte[] read(InputStream inputStream, int size) {
byte[] bytes = new byte[size];
int readLength = 0;
int remainingLength = size;
int lastRead = 0;
- 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"