Showing 7 of 14 total issues
Method valueOf
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static int valueOf(String keyString) throws UnknownEmulatorKeyException {
int key;
switch (keyString) {
case "0":
Method setupTextField
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void setupTextField(EmulatorKey emulatorKey, KeyCode key) {
if (emulatorKey == null || key == null) return;
switch (emulatorKey.getKeyName()) {
case "0":
Method opCode8XYN
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void opCode8XYN(OPCode opCode) throws UnknownOPCodeException {
switch (opCode.getByte(3)) {
case 0x0:
assign(opCode.getByte(1), opCode.getByte(2));
break;
Method arithmeticOperation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private UnsignedByte arithmeticOperation(int Vx, int Vy, BinaryOperation arithmeticOperation, int onOverFlow, int noOverFlow) {
Method setupCharacter
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private UnsignedByte[] setupCharacter(int one, int two, int three, int four, int five) {
Method drawLineOfSprite
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private void drawLineOfSprite(int xCoordinate, int yCoordinate, UnsignedByte data, int mask, UnsignedShort yLine) {
Method changed
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
private void changed(Change change) {
if (change.isAdded()) {
if (change.getControlText().contains(".")) {
if (change.getText().matches("[^0-9]")) change.setText("");
} else if (change.getText().matches("[^0-9.]")) change.setText("");
- 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"