From c019d92b128e94acc4772daef70e189a0181f011 Mon Sep 17 00:00:00 2001 From: chiarazarrella Date: Fri, 11 Apr 2025 11:39:44 +0200 Subject: [PATCH 1/4] add comment for analyzer wizards-and-warriors-2 --- .../java/wizards-and-warriors-2/use_method_overloading.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 analyzer-comments/java/wizards-and-warriors-2/use_method_overloading.md diff --git a/analyzer-comments/java/wizards-and-warriors-2/use_method_overloading.md b/analyzer-comments/java/wizards-and-warriors-2/use_method_overloading.md new file mode 100644 index 000000000..d6e0de444 --- /dev/null +++ b/analyzer-comments/java/wizards-and-warriors-2/use_method_overloading.md @@ -0,0 +1,5 @@ +# use method overloading + +Consider reusing the existing `describe` methods instead of manually constructing the description. + +This promotes better code reuse and aligns with the intended use of method overloading. \ No newline at end of file From 8c4a4a40234618401c427c60905a0768b7dfa76c Mon Sep 17 00:00:00 2001 From: chiarazarrella Date: Mon, 5 May 2025 15:24:40 +0200 Subject: [PATCH 2/4] new comments for wizards-and-warriors-2 --- .../reuse_code_hardcoded_three_parameters.md | 3 +++ .../reuse_code_hardcoded_two_parameters.md | 4 ++++ .../java/wizards-and-warriors-2/use_method_overloading.md | 5 ----- 3 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 analyzer-comments/java/wizards-and-warriors-2/reuse_code_hardcoded_three_parameters.md create mode 100644 analyzer-comments/java/wizards-and-warriors-2/reuse_code_hardcoded_two_parameters.md delete mode 100644 analyzer-comments/java/wizards-and-warriors-2/use_method_overloading.md diff --git a/analyzer-comments/java/wizards-and-warriors-2/reuse_code_hardcoded_three_parameters.md b/analyzer-comments/java/wizards-and-warriors-2/reuse_code_hardcoded_three_parameters.md new file mode 100644 index 000000000..c062ef889 --- /dev/null +++ b/analyzer-comments/java/wizards-and-warriors-2/reuse_code_hardcoded_three_parameters.md @@ -0,0 +1,3 @@ +# Reuse code + +The `describe(Character, Destination, TravelMethod)` method should reuse the logic implemented in `describe(Character)`, `describe(Destination)` and `describe(TravelMethod)`. Reusing existing methods can help make code easier to maintain. diff --git a/analyzer-comments/java/wizards-and-warriors-2/reuse_code_hardcoded_two_parameters.md b/analyzer-comments/java/wizards-and-warriors-2/reuse_code_hardcoded_two_parameters.md new file mode 100644 index 000000000..48f54a2fe --- /dev/null +++ b/analyzer-comments/java/wizards-and-warriors-2/reuse_code_hardcoded_two_parameters.md @@ -0,0 +1,4 @@ +# Reuse code + +The `describe(Character, Destination)` method should reuse the logic implemented in `describe(Character, Destination, TravelMethod)` or in the individual methods `describe(Character)`, `describe(Destination)`, `describe(TravelMethod)`. +Reusing existing methods can help make code easier to maintain. \ No newline at end of file diff --git a/analyzer-comments/java/wizards-and-warriors-2/use_method_overloading.md b/analyzer-comments/java/wizards-and-warriors-2/use_method_overloading.md deleted file mode 100644 index d6e0de444..000000000 --- a/analyzer-comments/java/wizards-and-warriors-2/use_method_overloading.md +++ /dev/null @@ -1,5 +0,0 @@ -# use method overloading - -Consider reusing the existing `describe` methods instead of manually constructing the description. - -This promotes better code reuse and aligns with the intended use of method overloading. \ No newline at end of file From cf5dd03fec668c58990cf0aaea577ec4cf1331b3 Mon Sep 17 00:00:00 2001 From: chiarazarrella Date: Fri, 16 May 2025 20:34:45 +0200 Subject: [PATCH 3/4] more meaningful name comments --- ...e_parameters.md => reuse_code_from_describe_three_params.md} | 2 +- ...two_parameters.md => reuse_code_from_describe_two_params.md} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename analyzer-comments/java/wizards-and-warriors-2/{reuse_code_hardcoded_three_parameters.md => reuse_code_from_describe_three_params.md} (85%) rename analyzer-comments/java/wizards-and-warriors-2/{reuse_code_hardcoded_two_parameters.md => reuse_code_from_describe_two_params.md} (88%) diff --git a/analyzer-comments/java/wizards-and-warriors-2/reuse_code_hardcoded_three_parameters.md b/analyzer-comments/java/wizards-and-warriors-2/reuse_code_from_describe_three_params.md similarity index 85% rename from analyzer-comments/java/wizards-and-warriors-2/reuse_code_hardcoded_three_parameters.md rename to analyzer-comments/java/wizards-and-warriors-2/reuse_code_from_describe_three_params.md index c062ef889..186cb27bd 100644 --- a/analyzer-comments/java/wizards-and-warriors-2/reuse_code_hardcoded_three_parameters.md +++ b/analyzer-comments/java/wizards-and-warriors-2/reuse_code_from_describe_three_params.md @@ -1,3 +1,3 @@ -# Reuse code +# Reuse code from Describe three params The `describe(Character, Destination, TravelMethod)` method should reuse the logic implemented in `describe(Character)`, `describe(Destination)` and `describe(TravelMethod)`. Reusing existing methods can help make code easier to maintain. diff --git a/analyzer-comments/java/wizards-and-warriors-2/reuse_code_hardcoded_two_parameters.md b/analyzer-comments/java/wizards-and-warriors-2/reuse_code_from_describe_two_params.md similarity index 88% rename from analyzer-comments/java/wizards-and-warriors-2/reuse_code_hardcoded_two_parameters.md rename to analyzer-comments/java/wizards-and-warriors-2/reuse_code_from_describe_two_params.md index 48f54a2fe..2f45df58e 100644 --- a/analyzer-comments/java/wizards-and-warriors-2/reuse_code_hardcoded_two_parameters.md +++ b/analyzer-comments/java/wizards-and-warriors-2/reuse_code_from_describe_two_params.md @@ -1,4 +1,4 @@ -# Reuse code +# Reuse code from Describe two params The `describe(Character, Destination)` method should reuse the logic implemented in `describe(Character, Destination, TravelMethod)` or in the individual methods `describe(Character)`, `describe(Destination)`, `describe(TravelMethod)`. Reusing existing methods can help make code easier to maintain. \ No newline at end of file From 7a209edce8d18c7bc6ec9c217c26c2d8352eea24 Mon Sep 17 00:00:00 2001 From: chiarazarrella Date: Sat, 7 Jun 2025 12:45:41 +0200 Subject: [PATCH 4/4] comments for cars-assemble analyzer --- .../java/cars-assemble/avoid_using_return_in_else_statement.md | 3 +++ .../java/cars-assemble/prefer_storing_constant_in_field.md | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 analyzer-comments/java/cars-assemble/avoid_using_return_in_else_statement.md create mode 100644 analyzer-comments/java/cars-assemble/prefer_storing_constant_in_field.md diff --git a/analyzer-comments/java/cars-assemble/avoid_using_return_in_else_statement.md b/analyzer-comments/java/cars-assemble/avoid_using_return_in_else_statement.md new file mode 100644 index 000000000..f2562ecc7 --- /dev/null +++ b/analyzer-comments/java/cars-assemble/avoid_using_return_in_else_statement.md @@ -0,0 +1,3 @@ +# avoid using return in else statement +When an `if` block ends with a return statement, the subsequent `else` is redundant. +Removing the `else` can make the code cleaner and easier to read. diff --git a/analyzer-comments/java/cars-assemble/prefer_storing_constant_in_field.md b/analyzer-comments/java/cars-assemble/prefer_storing_constant_in_field.md new file mode 100644 index 000000000..732b36b8f --- /dev/null +++ b/analyzer-comments/java/cars-assemble/prefer_storing_constant_in_field.md @@ -0,0 +1,3 @@ +# prefer storing constant in field +The value 221 is a magic number: a hard-coded constant without explanation. +To improve readability and maintainability, replace repeated or unexplained values with a named constant. \ No newline at end of file