New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ME Fluid Interface #3564

Merged
merged 13 commits into from Jun 27, 2018

Conversation

Projects
None yet
3 participants
@fscan
Member

fscan commented Jun 24, 2018

Feature wise everything should be there. GUI looks ugly as hell ..

Needs a lot of testing.

}
@Override
public EnumSet<EnumFacing> getTargets()

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

MINOR The return type of this method should be an interface such as "Set" rather than the implementation "EnumSet". rule

}
@Override
public EnumSet<EnumFacing> getTargets()

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

MINOR The return type of this method should be an interface such as "Set" rather than the implementation "EnumSet". rule

}
@Override
public TickRateModulation onTick()

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

CRITICAL The Cyclomatic Complexity of this method "onTick" is 23 which is greater than 10 authorized. rule

final int scaledHeight = (int) ( this.height * ( (float) fluid.amount / this.tank.getCapacity() ) );
int iconHeightRemainder = scaledHeight % 16;
if( iconHeightRemainder > 0 )

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

CRITICAL Refactor this code to not nest more than 3 if/for/while/switch/try statements. rule

{
drawTexturedModalRect( this.x, this.y + this.height - iconHeightRemainder, sprite, 16, iconHeightRemainder );
}
for( int i = 0; i < scaledHeight / 16; i++ )

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

CRITICAL Refactor this code to not nest more than 3 if/for/while/switch/try statements. rule

public class GuiFluidInterface extends AEBaseGui
{
public final static int ID_BUTTON_TANK = 222;

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

MINOR Reorder the modifiers to comply with the Java Language Specification. rule

@@ -40,6 +40,7 @@
Terminal,
Interface,
FluidInterface,

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

CRITICAL Rename this constant name to match the regular expression '^[A-Z][A-Z0-9](_[A-Z0-9]+)$'. rule

if( fh != null )
{
FluidStack fs = fh.drain( Fluid.BUCKET_VOLUME, false );
if( fs != null && fs.amount > 0 )

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

CRITICAL Refactor this code to not nest more than 3 if/for/while/switch/try statements. rule

else
{
final IAEFluidStack acquired = Platform.poweredExtraction( src, dest, work, this.interfaceRequestSource );
if( acquired != null )

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

CRITICAL Refactor this code to not nest more than 3 if/for/while/switch/try statements. rule

this.items.setInternal( this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ) );
this.fluids.setInternal( this.gridProxy.getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ) ) );
}
catch( final GridAccessException gae )

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

MAJOR Either log or rethrow this exception. rule

this.notifyNeighbors();
}
public AECableType getCableConnectionType( final AEPartLocation dir )

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

MAJOR Remove this unused method parameter "dir". rule

return new DimensionalCoord( this.iHost.getTileEntity() );
}
public boolean hasCapability( Capability<?> capabilityClass, EnumFacing facing )

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

MAJOR Remove this unused method parameter "facing". rule

if( stored.amount < TANK_CAPACITY )
{
this.requireWork[slot] = req.copy();
this.requireWork[slot].setStackSize( TANK_CAPACITY - stored.amount );

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

MINOR Cast one of the operands of this subtraction operation to a "long". rule

}
final boolean couldDoWork = this.updateStorage();
return this.hasWorkToDo() ? ( couldDoWork ? TickRateModulation.URGENT : TickRateModulation.SLOWER ) : TickRateModulation.SLEEP;

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

MAJOR Extract this nested ternary operation into an independent statement. rule

}
@SuppressWarnings( "unchecked" )
public <T> T getCapability( Capability<T> capabilityClass, EnumFacing facing )

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

MAJOR Remove this unused method parameter "facing". rule

{
this.gridProxy.getTick().wakeDevice( this.gridProxy.getNode() );
}
catch( final GridAccessException e )

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

MAJOR Either log or rethrow this exception. rule

IAEFluidStack notStored = Platform.poweredInsert( src, dest, toStore, this.interfaceRequestSource );
toStore.setStackSize( toStore.getStackSize() - ( notStored == null ? 0 : notStored.getStackSize() ) );
if( toStore.getStackSize() > 0 )

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

CRITICAL Refactor this code to not nest more than 3 if/for/while/switch/try statements. rule

}
}
}
catch( final GridAccessException e )

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

MAJOR Either log or rethrow this exception. rule

this.requireWork[slot] = null;
}
private boolean usePlan( final int slot )

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

CRITICAL The Cyclomatic Complexity of this method "usePlan" is 13 which is greater than 10 authorized. rule

@fscan fscan force-pushed the feature-fluid-interface branch from 005c470 to dc3c3ab Jun 24, 2018

this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
}
}
catch( final GridAccessException e )

This comment has been minimized.

@orod-org

orod-org Jun 24, 2018

MAJOR Either log or rethrow this exception. rule

private class InterfaceRequestContext implements Comparable<Integer>
{
@Override
public int compareTo( Integer o )

This comment has been minimized.

@orod-org

orod-org Jun 25, 2018

MINOR Override "equals(Object obj)" to comply with the contract of the "compareTo(T o)" method. rule

this.gridProxy.getTick().sleepDevice( this.gridProxy.getNode() );
}
}
catch( final GridAccessException e )

This comment has been minimized.

@orod-org

orod-org Jun 25, 2018

MAJOR Either log or rethrow this exception. rule

@orod-org

This comment has been minimized.

orod-org commented Jun 25, 2018

SonarQube analysis reported 54 issues

  • CRITICAL 26 critical
  • MAJOR 17 major
  • MINOR 9 minor
  • INFO 2 info

Watch the comments in this conversation to review them.

Top 10 extra issues

Note: The following issues were found on lines that were not modified in the pull request. Because these issues can't be reported as line comments, they are summarized here:

  1. CRITICAL AEBaseGui.java#L270: Refactor this code to not nest more than 3 if/for/while/switch/try statements. rule
  2. CRITICAL ApiBlocks.java#L295: Define a constant instead of duplicating this literal "sky_stone_chest" 3 times. rule
  3. CRITICAL ApiBlocks.java#L354: Define a constant instead of duplicating this literal "quantum_ring" 3 times. rule
  4. CRITICAL ApiBlocks.java#L442: Define a constant instead of duplicating this literal "crafting_unit" 4 times. rule
  5. CRITICAL ApiBlocks.java#L454: Define a constant instead of duplicating this literal "crafting_storage" 4 times. rule
  6. CRITICAL AEFeature.java#L100: Use already-defined constant 'CATEGORY_PORTABLE_CELL' instead of duplicating its value here. rule
  7. CRITICAL AEFeature.java#L108: Use already-defined constant 'CATEGORY_NETWORK_TOOL' instead of duplicating its value here. rule
  8. CRITICAL AEFeature.java#L134: Use already-defined constant 'CATEGORY_FACADES' instead of duplicating its value here. rule
  9. CRITICAL GuiText.java#L48: Rename this constant name to match the regular expression '^[A-Z][A-Z0-9](_[A-Z0-9]+)$'. rule
  10. CRITICAL GuiText.java#L50: Rename this constant name to match the regular expression '^[A-Z][A-Z0-9](_[A-Z0-9]+)$'. rule

@yueh yueh merged commit c2d18ce into rv6-1.12 Jun 27, 2018

3 of 4 checks passed

sonarqube SonarQube reported 54 issues, with 26 critical
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
jenkins Success
Details

@yueh yueh added this to the rv6.alpha - 1.12 milestone Jul 1, 2018

@fscan fscan deleted the feature-fluid-interface branch Jul 4, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment