-
-
Notifications
You must be signed in to change notification settings - Fork 25
Leap Analyzer Issue #260
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
Leap Analyzer Issue #260
Changes from 4 commits
a842af8
3734858
5d8b7a2
6e9ccf1
2287c87
49717be
3da13cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.salarycalculator.ExemplarSolution.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.salarycalculator.NoReuseBonusForProductsSold.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.salarycalculator.NoReuseBonusMultiplier.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.salarycalculator.NoReuseSalaryMultiplier.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.salarycalculator.NotReusingMethodsAtAll.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.salarycalculator.NotUsingTernaryOperatorsAndNotReusingMethods.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.salarycalculator.NotUsingTernaryOperatorsAtAll.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.salarycalculator.NotUsingTernaryOperatorsOnBonusMultiplier.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.salarycalculator.NotUsingTernaryOperatorsOnFinalSalary.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.salarycalculator.NotUsingTernaryOperatorsOnSalaryMultiplier.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.loglevels.ExemplarSolution.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.loglevels.HardCodingLogLevelsUpperCase.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.loglevels.HardCodingLogLevelsLowerCase.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.loglevels.NoReuseLogLevel.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.loglevels.NoReuseMessage.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.loglevels.NoReuseOfBothMethods.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.loglevels.NotUsingExpectedMethodsOnLogLevel.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.loglevels.NotUsingExpectedMethodsOnMessage.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.loglevels.NotUsingExpectedMethodsOnLogLevelAndMessage.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.loglevels.UsingStringFormat.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.wizardsandwarriors.ExemplarSolution.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.wizardsandwarriors.ExemplarSolutionWithTodoComments.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.wizardsandwarriors.NotUsingOverrideAnnotations.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.wizardsandwarriors.UsingAditionalEqualsMethodOverrided.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.global.AnySolutionWithMainMethod.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.global.AnySolutionWithPrintStatements.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.twofer.HardCodedTestCases.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.twofer.Optimal.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.twofer.OptimalNoTernary.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.twofer.UsesMultipleReturns.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.twofer.UsesStringFormat.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.annalynsinfiltration.Optimal.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.annalynsinfiltration.ComparingBooleanWithLiteral.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.annalynsinfiltration.ReturningBooleanLiteral.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.annalynsinfiltration.UsingIfStatement.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.annalynsinfiltration.UsingRedundantParenthesis.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.lasagna.ExemplarSolution.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.lasagna.ExemplarSolutionWithTodoComments.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.lasagna.NoReuseOfBothMethods.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.lasagna.NoReuseOfExpectedMinutesInOven.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.lasagna.NoReuseOfPreparationTimeInMinutes.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.leap.HardCodedTestCases.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.leap.OptimalSolution.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.leap.OptimalTernary.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.leap.UsingGregorianCalendar.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.leap.UsingIfStatements.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.leap.UsingJavaTime.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.leap.UsingTernary.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.leap.UsingTooManyChecks.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.hamming.ConstructorTooLong.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.hamming.MethodTooLong.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.hamming.MustUseCharAtOrCodePointAt.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.hamming.NestedCalculation.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.hamming.NestedValidation.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.hamming.OptimalWithCalculationDelegatedFromConstructor.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.hamming.OptimalWithCalculationDelegatedFromGetHammingDistance.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.hamming.OptimalWithCalculationInGetHammingDistance.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.hamming.OptimalWithValidationMethod.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.hamming.UsesCharacterLiterals.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.hamming.UsesStreamReduce.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.needforspeed.ExemplarSolution.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.needforspeed.UsingForLoop.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.needforspeed.UsingIfStatement.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.needforspeed.UsingTernary.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.needforspeed.UsingWhileLoop.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.secrets.ExemplarSolution.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.secrets.NotUsingBitwiseAnd.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.secrets.NotUsingBitwiseNot.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.secrets.NotUsingBitwiseOr.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.secrets.NotUsingBitwiseXor.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.secrets.NotUsingUnsignedRightShift.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.secrets.UsingIfStatement.approved.txt | ||
| C:\Programming\Exercism\java-analyzer\src\test\resources\analyzer\AnalyzerIntegrationTest.secrets.NotUsingAnyOfTheExpectedOperators.approved.txt |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| @echo off | ||
|
|
||
| FOR /F "usebackq delims=" %%L IN ("..\.approval_tests_temp\.failed_comparison.log") DO ( | ||
| REM Store the entire line in an environment variable named LINE | ||
| SET "LINE=%%L" | ||
| REM Call a subroutine to parse and handle the line | ||
| CALL :ProcessLine | ||
| ) | ||
|
|
||
| GOTO :EOF | ||
|
|
||
| :ProcessLine | ||
| REM Enable delayed expansion so we can safely manipulate LINE | ||
| SETLOCAL ENABLEDELAYEDEXPANSION | ||
|
|
||
| REM Replace " -> " with a pipe character so we can split easily | ||
| SET "LINE=!LINE: -> =|!" | ||
|
|
||
| REM Now split the line on the pipe and capture each side | ||
| FOR /F "tokens=1,2 delims=|" %%A IN ("!LINE!") DO ( | ||
| ECHO Moving "%%~A" to "%%~B" | ||
| MOVE "%%~A" "%%~B" | ||
| ) | ||
|
|
||
| ENDLOCAL | ||
| GOTO :EOF |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| @echo off | ||
| setlocal enabledelayedexpansion | ||
|
|
||
| REM Define paths | ||
| set "SCRIPT_DIR=%~dp0" | ||
| set "LOG_FILE=%SCRIPT_DIR%.approved_files.log" | ||
| set "BASE_DIR=%SCRIPT_DIR%.." | ||
|
|
||
| REM Check if the log file exists | ||
| if not exist "%LOG_FILE%" ( | ||
| echo Error: Log file .approved_files.log not found in script directory. | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| REM Find all *.approved.* files recursively from the base directory | ||
| echo Scanning for approval files in base directory: %BASE_DIR%... | ||
| for /r "%BASE_DIR%" %%f in (*.approved.*) do ( | ||
| call :ResolvePath "%%f" resolved_path | ||
| set "ALL_APPROVAL_FILES=!ALL_APPROVAL_FILES!%%f;" | ||
| ) | ||
|
|
||
| REM Resolve paths in .approved_files.log | ||
| echo Resolving paths from .approved_files.log... | ||
| set "RESOLVED_USED_FILES=" | ||
| for /f "usebackq delims=" %%l in ("%LOG_FILE%") do ( | ||
| call :ResolvePath "%%l" resolved_path | ||
| set "RESOLVED_USED_FILES=!RESOLVED_USED_FILES!!resolved_path!;" | ||
| ) | ||
|
|
||
| REM Compare files and identify abandoned ones | ||
| echo Identifying abandoned approval files... | ||
| set "ABANDONED_FILES=" | ||
| for %%f in (!ALL_APPROVAL_FILES:;= !) do ( | ||
| call :ResolvePath "%%f" resolved_path | ||
| if "!RESOLVED_USED_FILES:;=!" neq "!RESOLVED_USED_FILES:;=%%resolved_path%%;!" ( | ||
| set "ABANDONED_FILES=!ABANDONED_FILES!!resolved_path!;" | ||
| ) | ||
| ) | ||
|
|
||
| REM Display abandoned files | ||
| if "!ABANDONED_FILES!"=="" ( | ||
| echo No abandoned approval files found. | ||
| exit /b 0 | ||
| ) | ||
|
|
||
| echo The following approval files are abandoned: | ||
| for %%f in (!ABANDONED_FILES:;= !) do ( | ||
| echo %%f | ||
| ) | ||
|
|
||
| REM Prompt for deletion | ||
| set /p "RESPONSE=Would you like to delete these files? (y/n): " | ||
| if /i "!RESPONSE!"=="y" ( | ||
| for %%f in (!ABANDONED_FILES:;= !) do ( | ||
| del /q "%%f" && echo Deleted: %%f | ||
| ) | ||
| echo All abandoned files deleted. | ||
| ) else ( | ||
| echo No files were deleted. | ||
| ) | ||
|
|
||
| exit /b 0 | ||
|
|
||
| REM Function to resolve paths | ||
| :ResolvePath | ||
| for %%i in (%1) do set "%2=%%~fi" | ||
| exit /b |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| package analyzer.exercises.leap; | ||
|
|
||
| import analyzer.Comment; | ||
|
|
||
| /** | ||
| * @see <a href="https://github.com/exercism/website-copy/blob/main/analyzer-comments/java/leap/avoid_if_statements.md">Markdown Template</a> | ||
| */ | ||
| class AvoidIfStatements extends Comment { | ||
| @Override | ||
| public String getKey() { | ||
| return "java.leap.avoid_if_statements"; | ||
| } | ||
|
|
||
| @Override | ||
| public Type getType() { | ||
| return Type.ACTIONABLE; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,13 +70,15 @@ public void visit(IntegerLiteralExpr node, OutputCollector output) { | |
|
|
||
| @Override | ||
| public void visit(IfStmt node, OutputCollector output) { | ||
| output.addComment(new AvoidConditionalLogic()); | ||
| output.addComment(new AvoidIfStatements()); | ||
| super.visit(node, output); | ||
| } | ||
|
|
||
| @Override | ||
| public void visit(ConditionalExpr node, OutputCollector output) { | ||
| output.addComment(new AvoidConditionalLogic()); | ||
| if (node.getThenExpr().isBooleanLiteralExpr() || node.getElseExpr().isBooleanLiteralExpr()) { | ||
| output.addComment(new AvoidRedundantTernary()); | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be checking if both sides are boolean literals? If only one side is a boolean, I'd assume the other side is some boolean expression (e.g.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, this is checking whether either the Let me know if I’m thinking in the right direction here.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I was trying to figure out whether line 79 should be (notice the I noticed the test for this case uses the expression: (year % 400 == 0) ? true : (year % 100 == 0) ? false : (year % 4 == 0) ? true : falseBut the proposed comment is:
Are we trying to say don't use a ternary expression to just return Another possibility is that we tell the students that it can be solved with just one ternary expression (instead of saying don't use boolean literals). This could be done by checking if there is more than one ternary expression (in a similar way to how we already check if there are more than 3 checks).
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense. We can change this message: to something like: But then the title would need to be changed too, right? If it does, let me know what I should rename it to! I would suggest the title to be something like "avoid multiple ternary". Additionally, we’d need to update the logic to check that the solution uses only one ternary. The current implementation should still work, but this approach of checking the number of ternary operators makes more sense for the message and improves the overall understandability of the system. The name of the scenario would also be changed to I’ll check this out over the weekend, if you give the go-ahead for this approach!
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, let me know if I should make these changes in this PR itself or create a follow-up PR for the rest, as @SleeplessByte mentioned!
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that makes sense. Sometimes we do use ternary operators to return boolean literals directly — for example: So instead of telling students to avoid using ternaries to return boolean literals in general, it’s better to guide them with something more exercise-specific, like saying “this can be solved using just one ternary.” That’s more accurate and helpful in context. Let me know if I’m on the right track and if this is what you meant!
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, to all this! I think the message could be tweaked but we can worry about that in the website-copy PR.
Yes, that's right. I think you can do something like
Yes, I agree we should update the name to match.
The change to "avoid multiple ternary" should be in this PR because this is the PR introduces the boolean literal check that would need to be changed.
Yes, to both!
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, I'll make the amendments over the weekend! |
||
| super.visit(node, output); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "comments": [] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| class Leap { | ||
| boolean isLeapYear(int year) { | ||
| return (year % 100 == 0) ? (year % 400 == 0) : (year % 4 == 0); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks great. However, it just occurred to me we might also get an if (year % 100 == 0) {
return year % 400 == 0;
} else {
return year % 4 == 0;
}I think the analyzer will currently raise a comment about using the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On one hand, I understand that it’s just a different way to express the same logic we already added using a ternary operator. But at the same time, it feels like a bit of overkill—especially when the same logic can be written in a single line using a ternary or logical operators. I do have one suggestion—I'm not sure if this is even possible, but just putting it out there: does Exercism support different types of analyzer comments? Like maybe a way to leave a non-critical or informational-only comment for cases like this, where the solution is perfectly valid but there might be a more concise alternative? I’m not sure what the official terminology is (just guessing here), but something like this could be a nice middle ground.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the optional solutions be in a dig deeper article vs the analyzer?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, let's leave it as it is currently.
To answer this one - Yes, there are different types of comments (essential, actionable, informative or celeboratory). The if statement comment is currently "actionable".
There is already an approach for this.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sounds good! But if we do want to address it before the "Dig Deeper" section, one idea is to add an informative comment for optimal We can check if an Let me know what you think and how you'd like me to proceed with this!
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kahgoh @SleeplessByte
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jagdish-15, I think there is nothing else to change because we're already raising this comment for the situation:
Admittedly, the comment is "actionable" instead of "informative", but I think that's fine.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant that we should raise a comment only when the if (year % 100 == 0) {
return year % 400 == 0;
} else {
return year % 4 == 0;
}uses the same logic as the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm still thinking to leave it as it is. As far as I know, it has adding a similar for quite some time now and I'm not aware of it being a "problem". Essentially, I'm not entirely convinced that it is something that should be changed (even though I mentioned it earlier).
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure! |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,4 +5,4 @@ boolean isLeapYear(int year) { | |
| if (year % 4 == 0) return true; | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.