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

Test lines of code review #134

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions aws-codeguru-reviewer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 1.0

# Sample YAML file
# This configuration file is an optional file for Amazon CodeGuru Reviewer.
# You must name your file aws-codeguru-reviewer.yml for CodeGuru Reviewer to recognize it.
# Add the file to the root directory of your repository.
# For more information, see the Amazon CodeGuru Reviewer User Guide:
# https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/welcome.html.

# Exclude files and directories
# Use glob pattern syntax to specify the files and directories that you want to exclude
# from analysis under excludeFiles. For more information, see glob (programming):
# https://en.wikipedia.org/wiki/Glob_(programming).
# The following example excludes from analysis all content in the some-package directory, all content
# in the tst directory, and all JSON files in a sub-directory under a directory prefixed with some-.
# Replace with your own list of files and directories that you want CodeGuru Reviewer to exclude.
# We recommend that you use a schema validator to confirm that the YAML syntax is valid.

excludeFiles:
- 'src/some-package/**'
- 'tst/**'
- 'src/some-*/**/*.json'
14 changes: 8 additions & 6 deletions src/main/java/com/houarizegai/calculator/App.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.houarizegai.calculator;

import com.houarizegai.calculator.ui.CalculatorUI;

public class App {
static void stringEqualityCheckNoncompliant(String string1, String string2) {
// Noncompliant: the == operator doesn't compare the contents of the strings.
if(string1 == string2) {
System.out.println("The strings are equal.");
}
}

public static void main(String[] args) {
new CalculatorUI();
stringEqualityCheckNoncompliant("dfhdh","dfhdh");
}
}
}
17 changes: 7 additions & 10 deletions src/main/java/com/houarizegai/calculator/ui/CalculatorUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import static com.houarizegai.calculator.util.ColorUtil.hex2Color;

public class CalculatorUI {
public class abcd {

private static final String FONT_NAME = "Comic Sans MS";
private static final String DOUBLE_OR_NUMBER_REGEX = "([-]?\\d+[.]\\d*)|(\\d+)|(-\\d+)";
Expand Down Expand Up @@ -59,7 +59,7 @@ public class CalculatorUI {

private final Map<String, Theme> themesMap;

public CalculatorUI() {
public fun1() {
themesMap = ThemeLoader.loadThemes();

window = new JFrame(APPLICATION_TITLE);
Expand Down Expand Up @@ -100,7 +100,7 @@ public double calculate(double firstNumber, double secondNumber, char operator)
}
}

private void initThemeSelector() {
private void fun2() {
comboTheme = createComboBox(themesMap.keySet().toArray(new String[0]), 230, 30, "Theme");
comboTheme.addItemListener(event -> {
if (event.getStateChange() != ItemEvent.SELECTED)
Expand Down Expand Up @@ -175,7 +175,7 @@ private void initButtons(int[] columns, int[] rows) {
if (!Pattern.matches(DOUBLE_OR_NUMBER_REGEX, inputScreen.getText()) || !go)
return;

typedValue = calculate(typedValue, Double.parseDouble(inputScreen.getText()), selectedOperator);
typedValue = calculate(typedValue, Double.
if (Pattern.matches("[-]?[\\d]+[.][0]*", String.valueOf(typedValue))) {
inputScreen.setText(String.valueOf((int) typedValue));
} else {
Expand Down Expand Up @@ -267,9 +267,7 @@ private void initButtons(int[] columns, int[] rows) {
go = false;
addToDisplay = false;
} else {
selectedOperator = '*';
}
});


btn4 = createButton("4", columns[0], rows[3]);
btn4.addActionListener(event -> {
Expand Down Expand Up @@ -346,8 +344,7 @@ private void initButtons(int[] columns, int[] rows) {
inputScreen.setText(inputScreen.getText() + "1");
}
} else {
inputScreen.setText("1");
addToDisplay = true;

}
go = true;
});
Expand All @@ -367,7 +364,7 @@ private void initButtons(int[] columns, int[] rows) {
go = true;
});

btn3 = createButton("3", columns[2], rows[4]);
btn3 =
btn3.addActionListener(event -> {
if (addToDisplay) {
if (Pattern.matches("[0]*", inputScreen.getText())) {
Expand Down