Code Monkey home page Code Monkey logo

coffeemaker-2019's People

Contributors

agchelvan avatar andrewhii97 avatar behchawming avatar chaisiuqi avatar cheehooi97 avatar chihwa97 avatar fungjunyin123 avatar gughaan avatar huiming2t avatar izzatisyamimi avatar jcng96 avatar limtj97 avatar lyh977 avatar mingliee avatar pandacyber97 avatar shaik-azhar avatar smashita avatar sugganyakumaraysun avatar thenkimyen avatar tongyonghang avatar wansyazlina avatar wongxinying avatar yeewen0808 avatar zulhaqim1998 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coffeemaker-2019's Issues

Incorrect Indentation

Most of the check styles problem is probably incorrect indentation. Indentation is a space should be used(4 spaces) as the unit of indentation. The exact construction of the indentation (spaces vs. tabs) is unspecified. Tabs must be set exactly every 8 spaces (not 4). Indentation is used to avoid using more than 80 characters in a line. This is because the terminals and the tools cannot handle well lines that consist of more than 80 characters. In addition, the indentation does not matter for code “runability”. In other words, if you don’t indent it perfectly, your code will still run. However, it is good for code readability, so you can understand what you’ve written.

Example of incorrect code:
public CoffeeMaker() {
recipeBook = new RecipeBook();
inventory = new Inventory();
}
'ctor def modifier' has incorrect indentation level 8, expected level should be 2'
following the example given the curly bracket {} is at different indentation.

Correction
public CoffeeMaker()
{
recipeBook = new RecipeBook();
inventory = new Inventory();
}

'if' must use curly brackets

In class Recipe.java the if-clause is missing {}

@Override public boolean equals(Object obj) { if (this == obj){ return true;} if (obj == null){ return false;} if (getClass() != obj.getClass()){ return false;} final Recipe other = (Recipe) obj; if (name == null) { if (other.name != null){ return false;} } else if (!name.equals(other.name)){ return false;} return true; }

Inventory.Java Line 220 Logic Error

220 Inventory.coffee += r.getAmtCoffee();

In Inventory.Java , method useIngredients is used to substract the amount of ingredients needed to make a coffee from the amount of ingredients available inside the Inventory. However in the line 220 the compiler will store the amount of available coffee in the inventory (Inventory.coffee) by adding the amount of coffee needed to make the coffee (r.getAmtCoffee();) with Inventory.coffee. This is logically wrong because when we make the coffee, the amount of coffee available should be decreased.

To solve this simply change the line += sign to -= sign
And the code will look like this:
220 Inventory.coffee -= r.getAmtCoffee();

if without curly brackets

if (userInput == 1) addRecipe();
if (userInput == 2) deleteRecipe();
if (userInput == 3) editRecipe();
if (userInput == 4) addInventory();
if (userInput == 5) checkInventory();
if (userInput == 6) makeCoffee();
if (userInput == 0) System.exit(0);

At-clause should have a non-empty description. Line 92 and Line 93 in Inventory.java [NonEmptyAtclauseDescription]

Typically when we write at-clause which is @ , we generally write a description after that for this case:

Incorrect

>   /**
>      * Add the number of coffee units in the inventory 
>      * to the current amount of coffee units.
>      * @param coffee
>      * @throws InventoryException
>      */
> 

Instead it should be written as:

    /**
     * Add the number of coffee units in the inventory 
     * to the current amount of coffee units.
     * @param coffee represents something
     * @throws InventoryException when this exceptional condition happens
     */

  • to generally explaining why that exception would occur or
  • to state the description of the parameter

Combination of whitespace and empty block

WhitespaceAround: 'for' is not followed by whitespace. Empty blocks may only be represented as {} when not part of a multi-block statement (4.1.3)

for(int i = 0; i < recipes.length; i++) {

overrides java.lang.Object.toString

In the class inventory.java of the coffee maker project, through checkstyle activation, i found an error at public String toString() { ..... (line 235)
It said that its overrides java.lang.Object.toString

The java.lang.Object.toString() method returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

Detected CheckStyle issues in CoffeeMaker

Below is the issues detected in CoffeeMaker using CheckStyle. There are total 100 issues out of 1320 codes.
Description | Resource | Location | Type

  1. ')' is preceded with whitespace. | RecipeBook.java | line 31 | Checkstyle Problem
  2. '}' at column 10 should be on the same line as the next part of a multi-block statement (one that directly contains multiple blocks: if/else-if/else, do/while or try/catch/finally). | Main.java | line 169 | Checkstyle Problem
  3. '}' at column 6 should be on the same line as the next part of a multi-block statement (one that directly contains multiple blocks: if/else-if/else, do/while or try/catch/finally). | Main.java | line 259 | Checkstyle Problem
  4. 'catch rcurly' has incorrect indentation level 12, expected level should be 4. | Main.java | line 263 | Checkstyle Problem
  5. 'catch rcurly' has incorrect indentation level 16, expected level should be 4. | Main.java | line 95 | Checkstyle Problem
  6. 'catch rcurly' has incorrect indentation level 16, expected level should be 4. | Main.java | line 175 | Checkstyle Problem
  7. 'catch rcurly' has incorrect indentation level 16, expected level should be 4. | CoffeeMakerTest.java | line 67 | Checkstyle Problem
  8. 'catch rcurly' has incorrect indentation level 16, expected level should be 4. | CoffeeMakerTest.java | line 76 | Checkstyle Problem
  9. 'catch rcurly' has incorrect indentation level 8, expected level should be 4. | Recipe.java | line 43 | Checkstyle Problem
  10. 'catch rcurly' has incorrect indentation level 8, expected level should be 4. | Recipe.java | line 65 | Checkstyle Problem
  11. 'catch rcurly' has incorrect indentation level 8, expected level should be 4. | Recipe.java | line 87 | Checkstyle Problem
  12. 'catch rcurly' has incorrect indentation level 8, expected level should be 4. | Recipe.java | line 109 | Checkstyle Problem
  13. 'catch rcurly' has incorrect indentation level 8, expected level should be 4. | Recipe.java | line 145 | Checkstyle Problem
  14. 'catch rcurly' has incorrect indentation level 8, expected level should be 4. | Main.java | line 51 | Checkstyle Problem
  15. 'catch rcurly' has incorrect indentation level 8, expected level should be 4. | Main.java | line 201 | Checkstyle Problem
  16. 'catch rcurly' has incorrect indentation level 8, expected level should be 4. | Main.java | line 234 | Checkstyle Problem
  17. 'catch rcurly' has incorrect indentation level 8, expected level should be 4. | Main.java | line 286 | Checkstyle Problem
  18. 'catch rcurly' has incorrect indentation level 8, expected level should be 4. | Inventory.java | line 61 | Checkstyle Problem
  19. 'catch rcurly' has incorrect indentation level 8, expected level should be 4. | Inventory.java | line 101 | Checkstyle Problem
  20. 'catch rcurly' has incorrect indentation level 8, expected level should be 4. | Inventory.java | line 141 | Checkstyle Problem
  21. 'catch rcurly' has incorrect indentation level 8, expected level should be 4. | Inventory.java | line 181 | Checkstyle Problem
  22. 'catch' child has incorrect indentation level 16, expected level should be 6. | Recipe.java | line 42 | Checkstyle Problem
  23. 'catch' child has incorrect indentation level 16, expected level should be 6. | Recipe.java | line 64 | Checkstyle Problem
  24. 'catch' child has incorrect indentation level 16, expected level should be 6. | Recipe.java | line 86 | Checkstyle Problem
  25. 'catch' child has incorrect indentation level 16, expected level should be 6. | Recipe.java | line 108 | Checkstyle Problem
  26. 'catch' child has incorrect indentation level 16, expected level should be 6. | Recipe.java | line 144 | Checkstyle Problem
  27. 'catch' child has incorrect indentation level 16, expected level should be 6. | Main.java | line 49 | Checkstyle Problem
  28. 'catch' child has incorrect indentation level 16, expected level should be 6. | Main.java | line 50 | Checkstyle Problem
  29. 'catch' child has incorrect indentation level 16, expected level should be 6. | Main.java | line 200 | Checkstyle Problem
  30. 'catch' child has incorrect indentation level 16, expected level should be 6. | Main.java | line 232 | Checkstyle Problem
  31. 'catch' child has incorrect indentation level 16, expected level should be 6. | Main.java | line 233 | Checkstyle Problem
  32. 'catch' child has incorrect indentation level 16, expected level should be 6. | Main.java | line 261 | Checkstyle Problem
  33. 'catch' child has incorrect indentation level 16, expected level should be 6. | Main.java | line 262 | Checkstyle Problem
  34. 'catch' child has incorrect indentation level 16, expected level should be 6. | Main.java | line 284 | Checkstyle Problem
  35. 'catch' child has incorrect indentation level 16, expected level should be 6. | Main.java | line 285 | Checkstyle Problem
  36. 'catch' child has incorrect indentation level 16, expected level should be 6. | Inventory.java | line 60 | Checkstyle Problem
  37. 'catch' child has incorrect indentation level 16, expected level should be 6. | Inventory.java | line 100 | Checkstyle Problem
  38. 'catch' child has incorrect indentation level 16, expected level should be 6. | Inventory.java | line 140 | Checkstyle Problem
  39. 'catch' child has incorrect indentation level 16, expected level should be 6. | Inventory.java | line 180 | Checkstyle Problem
  40. 'catch' child has incorrect indentation level 24, expected level should be 6. | Main.java | line 94 | Checkstyle Problem
  41. 'catch' child has incorrect indentation level 24, expected level should be 6. | Main.java | line 174 | Checkstyle Problem
  42. 'catch' child has incorrect indentation level 24, expected level should be 6. | CoffeeMakerTest.java | line 66 | Checkstyle Problem
  43. 'catch' has incorrect indentation level 12, expected level should be 4. | Main.java | line 260 | Checkstyle Problem
  44. 'ctor def modifier' has incorrect indentation level 4, expected level should be 2. | Recipe.java | line 19 | Checkstyle Problem
  45. 'ctor def modifier' has incorrect indentation level 4, expected level should be 2. | Inventory.java | line 21 | Checkstyle Problem
  46. 'ctor def modifier' has incorrect indentation level 8, expected level should be 2. | RecipeException.java | line 7 | Checkstyle Problem
  47. 'ctor def modifier' has incorrect indentation level 8, expected level should be 2. | RecipeBook.java | line 13 | Checkstyle Problem
  48. 'ctor def modifier' has incorrect indentation level 8, expected level should be 2. | InventoryException.java | line 7 | Checkstyle Problem
  49. 'ctor def modifier' has incorrect indentation level 8, expected level should be 2. | CoffeeMaker.java | line 18 | Checkstyle Problem
  50. 'ctor def rcurly' has incorrect indentation level 4, expected level should be 2. | Recipe.java | line 26 | Checkstyle Problem
  51. 'ctor def rcurly' has incorrect indentation level 4, expected level should be 2. | Inventory.java | line 26 | Checkstyle Problem
  52. 'ctor def rcurly' has incorrect indentation level 8, expected level should be 2. | RecipeException.java | line 9 | Checkstyle Problem
  53. 'ctor def rcurly' has incorrect indentation level 8, expected level should be 2. | RecipeBook.java | line 15 | Checkstyle Problem
  54. 'ctor def rcurly' has incorrect indentation level 8, expected level should be 2. | InventoryException.java | line 9 | Checkstyle Problem
  55. 'ctor def rcurly' has incorrect indentation level 8, expected level should be 2. | CoffeeMaker.java | line 21 | Checkstyle Problem
  56. 'ctor def' child has incorrect indentation level 12, expected level should be 4. | CoffeeMaker.java | line 19 | Checkstyle Problem
  57. 'ctor def' child has incorrect indentation level 16, expected level should be 4. | RecipeException.java | line 8 | Checkstyle Problem
  58. 'ctor def' child has incorrect indentation level 16, expected level should be 4. | RecipeBook.java | line 14 | Checkstyle Problem
  59. 'ctor def' child has incorrect indentation level 16, expected level should be 4. | InventoryException.java | line 8 | Checkstyle Problem
  60. 'ctor def' child has incorrect indentation level 16, expected level should be 4. | CoffeeMaker.java | line 20 | Checkstyle Problem
  61. 'ctor def' child has incorrect indentation level 8, expected level should be 4. | Recipe.java | line 20 | Checkstyle Problem
  62. 'ctor def' child has incorrect indentation level 8, expected level should be 4. | Recipe.java | line 21 | Checkstyle Problem
  63. 'ctor def' child has incorrect indentation level 8, expected level should be 4. | Recipe.java | line 22 | Checkstyle Problem
  64. 'ctor def' child has incorrect indentation level 8, expected level should be 4. | Recipe.java | line 23 | Checkstyle Problem
  65. 'ctor def' child has incorrect indentation level 8, expected level should be 4. | Recipe.java | line 24 | Checkstyle Problem
  66. 'ctor def' child has incorrect indentation level 8, expected level should be 4. | Recipe.java | line 25 | Checkstyle Problem
  67. 'ctor def' child has incorrect indentation level 8, expected level should be 4. | Inventory.java | line 22 | Checkstyle Problem
  68. 'ctor def' child has incorrect indentation level 8, expected level should be 4. | Inventory.java | line 23 | Checkstyle Problem
  69. 'ctor def' child has incorrect indentation level 8, expected level should be 4. | Inventory.java | line 24 | Checkstyle Problem
  70. 'ctor def' child has incorrect indentation level 8, expected level should be 4. | Inventory.java | line 25 | Checkstyle Problem
  71. 'else rcurly' has incorrect indentation level 16, expected level should be 4. | RecipeBook.java | line 64 | Checkstyle Problem
  72. 'else rcurly' has incorrect indentation level 16, expected level should be 4. | RecipeBook.java | line 82 | Checkstyle Problem
  73. 'else rcurly' has incorrect indentation level 16, expected level should be 4. | Recipe.java | line 48 | Checkstyle Problem
  74. 'else rcurly' has incorrect indentation level 16, expected level should be 4. | Recipe.java | line 70 | Checkstyle Problem
  75. 'else rcurly' has incorrect indentation level 16, expected level should be 4. | Recipe.java | line 92 | Checkstyle Problem
  76. 'else rcurly' has incorrect indentation level 16, expected level should be 4. | Recipe.java | line 114 | Checkstyle Problem
  77. 'else rcurly' has incorrect indentation level 16, expected level should be 4. | Recipe.java | line 150 | Checkstyle Problem
  78. 'else rcurly' has incorrect indentation level 16, expected level should be 4. | Inventory.java | line 66 | Checkstyle Problem
  79. 'else rcurly' has incorrect indentation level 16, expected level should be 4. | Inventory.java | line 106 | Checkstyle Problem
  80. 'else rcurly' has incorrect indentation level 16, expected level should be 4. | Inventory.java | line 146 | Checkstyle Problem
  81. 'else rcurly' has incorrect indentation level 16, expected level should be 4. | Inventory.java | line 186 | Checkstyle Problem
  82. 'else rcurly' has incorrect indentation level 16, expected level should be 6. | Main.java | line 47 | Checkstyle Problem
  83. 'else rcurly' has incorrect indentation level 16, expected level should be 6. | Main.java | line 282 | Checkstyle Problem
  84. 'else rcurly' has incorrect indentation level 16, expected level should be 6. | CoffeeMaker.java | line 96 | Checkstyle Problem
  85. 'else rcurly' has incorrect indentation level 20, expected level should be 6. | Main.java | line 92 | Checkstyle Problem
  86. 'else rcurly' has incorrect indentation level 20, expected level should be 6. | Main.java | line 172 | Checkstyle Problem
  87. 'else rcurly' has incorrect indentation level 8, expected level should be 4. | Main.java | line 122 | Checkstyle Problem
  88. 'else rcurly' has incorrect indentation level 8, expected level should be 4. | Main.java | line 242 | Checkstyle Problem
  89. 'else rcurly' has incorrect indentation level 8, expected level should be 4. | Inventory.java | line 227 | Checkstyle Problem
  90. 'else rcurly' has incorrect indentation level 8, expected level should be 4. | CoffeeMaker.java | line 99 | Checkstyle Problem
  91. 'else' child has incorrect indentation level 16, expected level should be 6. | Main.java | line 121 | Checkstyle Problem
  92. 'else' child has incorrect indentation level 16, expected level should be 6. | Main.java | line 241 | Checkstyle Problem
  93. 'else' child has incorrect indentation level 16, expected level should be 6. | Inventory.java | line 226 | Checkstyle Problem
  94. 'else' child has incorrect indentation level 16, expected level should be 6. | CoffeeMaker.java | line 98 | Checkstyle Problem
  95. 'else' child has incorrect indentation level 16, expected level should be 8. | Main.java | line 46 | Checkstyle Problem
  96. 'else' child has incorrect indentation level 24, expected level should be 6. | RecipeBook.java | line 63 | Checkstyle Problem
  97. 'else' child has incorrect indentation level 24, expected level should be 6. | RecipeBook.java | line 81 | Checkstyle Problem
  98. 'else' child has incorrect indentation level 24, expected level should be 6. | Recipe.java | line 47 | Checkstyle Problem
  99. 'else' child has incorrect indentation level 24, expected level should be 6. | Recipe.java | line 69 | Checkstyle Problem
  100. 'else' child has incorrect indentation level 24, expected level should be 6. | Recipe.java | line 91 | Checkstyle Problem

The parameter 'r' should be declared 'final'

The parameter 'r' should be declared 'final' in Class RecipeBook.java on line 31.
(31:43)[FinalParameters]

public synchronized boolean addRecipe(final Recipe r) { //Assume recipe doesn't exist in the array until //find out otherwise boolean exists = false; //Check that recipe doesn't already exist in array for (int i = 0; i < recipeArray.length; i++) { if (r.equals(recipeArray[i])) { exists = true; } }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.