Skip to content
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

Made Crafting GUIs tall #2804

Closed

Conversation

thepaperpilot
Copy link
Contributor

Partially resolves #2267

}
else
{
try

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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


if( btn == this.terminalStyleBox )
{
AEConfig.instance().getConfigManager().putSetting( iBtn.getSetting(), next );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAJOR Method appeng.client.gui.implementations.GuiCraftConfirm.actionPerformed(GuiButton) appears to call the same method on the same object redundantly rule


if( btn == this.terminalStyleBox )
{
AEConfig.instance().getConfigManager().putSetting( iBtn.getSetting(), next );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAJOR Method appeng.client.gui.implementations.GuiCraftingCPU.actionPerformed(GuiButton) appears to call the same method on the same object redundantly rule

}
else
{
try

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@thepaperpilot
Copy link
Contributor Author

Yikes, 27 issues? Most of those are how they already were elsewhere in the project.

Copy link
Member

@yueh yueh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feedback applies also to GuiCraftingCPU as both are identical.

final int unusedSpace = this.height - this.ySize;
this.guiTop = (int) Math.floor( unusedSpace / ( unusedSpace < 0 ? 3.8f : 2.0f ) );
int offset = this.guiTop + 8;
this.setScrollBar();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why call setScrollBar() twice? (L157)

@@ -60,7 +64,20 @@

private final ContainerCraftConfirm ccc;

private final int rows = 5;
private int rows = 5;
private int maxRows = Integer.MAX_VALUE;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having a rows and maxRows seems to be a bit redundant in their use. Moving it to a getter might also be an idea.

if( this.rows < 5 )
{
this.rows = 5;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole sanitation should probably already happening in getRows() or getMaxRows().

@@ -447,6 +504,11 @@ public void postUpdate( final List<IAEItemStack> list, final byte ref )
this.setScrollBar();
}

int getMaxRows()
{
return AEConfig.instance().getConfigManager().getSetting( Settings.TERMINAL_STYLE ) == TerminalStyle.SMALL ? 5 : Integer.MAX_VALUE;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should handle also the sanitation part. But for performance maybe keep this.rows and rename this to something like calculateRows() and call it during init?

this.bindTexture( "guis/craftingreport.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
final int x_width = 238;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR Rename this local variable name to match the regular expression '^[a-z][a-zA-Z0-9]*$'. rule

@@ -342,7 +418,15 @@ public void drawFG( final int offsetX, final int offsetY, final int mouseX, fina
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{
this.bindTexture( "guis/craftingcpu.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
final int x_width = 238;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MINOR Rename this local variable name to match the regular expression '^[a-z][a-zA-Z0-9]*$'. rule

@orod-org
Copy link

SonarQube analysis reported 14 issues

  • CRITICAL 3 critical
  • MAJOR 9 major
  • MINOR 2 minor

Watch the comments in this conversation to review them.

8 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 GuiCraftConfirm.java#L601: The Cyclomatic Complexity of this method "actionPerformed" is 12 which is greater than 10 authorized. rule
  2. MAJOR GuiCraftConfirm.java#L238: Method appeng.client.gui.implementations.GuiCraftConfirm.updateCPUButtonText() appears to call the same method on the same object redundantly rule
  3. MAJOR GuiCraftConfirm.java#L341: Method appeng.client.gui.implementations.GuiCraftConfirm.drawFG(int, int, int, int) appears to call the same method on the same object redundantly rule
  4. MAJOR GuiCraftConfirm.java#L366: Method appeng.client.gui.implementations.GuiCraftConfirm.drawFG(int, int, int, int) appears to call the same method on the same object redundantly rule
  5. MAJOR GuiCraftConfirm.java#L391: Method appeng.client.gui.implementations.GuiCraftConfirm.drawFG(int, int, int, int) appears to call the same method on the same object redundantly rule
  6. MAJOR GuiCraftingCPU.java#L346: Method appeng.client.gui.implementations.GuiCraftingCPU.drawFG(int, int, int, int) appears to call the same method on the same object redundantly rule
  7. MAJOR GuiCraftingCPU.java#L361: Method appeng.client.gui.implementations.GuiCraftingCPU.drawFG(int, int, int, int) appears to call the same method on the same object redundantly rule
  8. MAJOR GuiCraftingCPU.java#L376: Method appeng.client.gui.implementations.GuiCraftingCPU.drawFG(int, int, int, int) appears to call the same method on the same object redundantly rule

@yueh yueh closed this Jan 29, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants