diff --git a/app/src/main/java/org/oppia/android/app/player/audio/LanguageInterface.kt b/app/src/main/java/org/oppia/android/app/player/audio/LanguageInterface.kt index ad3265ebdca..769b990f4d9 100644 --- a/app/src/main/java/org/oppia/android/app/player/audio/LanguageInterface.kt +++ b/app/src/main/java/org/oppia/android/app/player/audio/LanguageInterface.kt @@ -11,7 +11,7 @@ interface LanguageInterface { /** * Returns whether the user is actively seeking a new audio position, that is, dragging the * knob to a new position in the audio track. - * */ + */ fun getUserIsSeeking(): Boolean /** Returns the position of the knob on the audio track. */ diff --git a/app/src/main/java/org/oppia/android/app/shim/IntentFactoryShim.kt b/app/src/main/java/org/oppia/android/app/shim/IntentFactoryShim.kt index 0a8994ce081..208942cb9bb 100644 --- a/app/src/main/java/org/oppia/android/app/shim/IntentFactoryShim.kt +++ b/app/src/main/java/org/oppia/android/app/shim/IntentFactoryShim.kt @@ -16,7 +16,7 @@ interface IntentFactoryShim { /** * Creates a [TopicActivity] intent for [PromotedStoryViewModel] and passes necessary string * data. - * */ + */ fun createTopicPlayStoryActivityIntent( context: Context, internalProfileId: Int, @@ -27,7 +27,7 @@ interface IntentFactoryShim { /** * Creates a [TopicActivity] intent which opens info-tab. - * */ + */ fun createTopicActivityIntent( context: Context, internalProfileId: Int, diff --git a/app/src/main/java/org/oppia/android/app/story/StoryFragmentScroller.kt b/app/src/main/java/org/oppia/android/app/story/StoryFragmentScroller.kt index cb3ee1cf989..50c900d1f68 100644 --- a/app/src/main/java/org/oppia/android/app/story/StoryFragmentScroller.kt +++ b/app/src/main/java/org/oppia/android/app/story/StoryFragmentScroller.kt @@ -4,6 +4,6 @@ interface StoryFragmentScroller { /** * Scrolls smoothly (with animation) to the specified vertical pixel position in * [StoryFragment]. - * */ + */ fun smoothScrollToPosition(position: Int) } diff --git a/domain/src/main/java/org/oppia/android/domain/hintsandsolution/HintHandler.kt b/domain/src/main/java/org/oppia/android/domain/hintsandsolution/HintHandler.kt index e836f381541..35ca867e6a3 100644 --- a/domain/src/main/java/org/oppia/android/domain/hintsandsolution/HintHandler.kt +++ b/domain/src/main/java/org/oppia/android/domain/hintsandsolution/HintHandler.kt @@ -35,7 +35,7 @@ interface HintHandler { * @param trackedWrongAnswerCount the count of wrong answers saved in the checkpoint * @param helpIndex the cached state of hints/solution from the checkpoint * @param state the restored pending state - * */ + */ suspend fun resumeHintsForSavedState( trackedWrongAnswerCount: Int, helpIndex: HelpIndex, diff --git a/domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions/ExceptionsController.kt b/domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions/ExceptionsController.kt index 16e8640a1c9..f0912590b25 100644 --- a/domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions/ExceptionsController.kt +++ b/domain/src/main/java/org/oppia/android/domain/oppialogger/exceptions/ExceptionsController.kt @@ -113,7 +113,7 @@ class ExceptionsController @Inject constructor( * At first, it checks if the size of the store isn't exceeding [exceptionLogStorageCacheSize]. * If the limit is exceeded then the least recent exception is removed from the [exceptionLogStore]. * After this, the [exceptionLog] is added to the store. - * */ + */ private fun cacheExceptionLog(exceptionLog: ExceptionLog) { exceptionLogStore.storeDataAsync(true) { oppiaExceptionLogs -> val storeSize = oppiaExceptionLogs.exceptionLogList.size diff --git a/scripts/assets/file_content_validation_checks.textproto b/scripts/assets/file_content_validation_checks.textproto index fe0d7d9aba9..788ffc0e86c 100644 --- a/scripts/assets/file_content_validation_checks.textproto +++ b/scripts/assets/file_content_validation_checks.textproto @@ -503,8 +503,8 @@ file_content_checks { } file_content_checks { file_path_regex: ".+?\\.kt$" - prohibited_content_regex: "\\*\\*/" - failure_message: "Badly formatted KDoc or block comment. KDocs and block comments should only end with \"*/\"." + prohibited_content_regex: "\\*(\\s*\\*|\\*)/" + failure_message: "Badly formatted KDoc or block comment. KDocs and block comments should only end with \"*/\". Multiple asterisks or whitespace between asterisks are not allowed." exempted_file_name: "scripts/src/javatests/org/oppia/android/scripts/regex/RegexPatternValidationCheckTest.kt" } file_content_checks { diff --git a/scripts/src/javatests/org/oppia/android/scripts/regex/RegexPatternValidationCheckTest.kt b/scripts/src/javatests/org/oppia/android/scripts/regex/RegexPatternValidationCheckTest.kt index 5f47d4b81e1..60b415c68db 100644 --- a/scripts/src/javatests/org/oppia/android/scripts/regex/RegexPatternValidationCheckTest.kt +++ b/scripts/src/javatests/org/oppia/android/scripts/regex/RegexPatternValidationCheckTest.kt @@ -206,7 +206,8 @@ class RegexPatternValidationCheckTest { "Badly formatted KDoc. Single-line KDocs should always end with exactly one space before the" + " final \"*/\"." private val badKdocOrBlockCommentShouldEndWithCorrectEnding = - "Badly formatted KDoc or block comment. KDocs and block comments should only end with \"*/\"." + "Badly formatted KDoc or block comment. KDocs and block comments should only" + + " end with \"*/\". Multiple asterisks or whitespace between asterisks are not allowed." private val badKdocParamsAndPropertiesShouldHaveNameFollowing = "Badly formatted KDoc param or property at-clause: the name of the parameter or property" + " should immediately follow the at-clause without any additional linking with brackets." @@ -2607,6 +2608,37 @@ class RegexPatternValidationCheckTest { ) } + @Test + fun testFileContent_kdocWithInvalidEndingSequences_failsValidation() { + val prohibitedContent = + """ + /** + * Incorrect KDoc comment. + * */ + /** + * Incorrect KDoc comment. + **/ + /** + * Correct KDoc comment. + */ + """.trimIndent() + tempFolder.newFolder("testfiles", "app", "src", "main", "java", "org", "oppia", "android") + val stringFilePath = "app/src/main/java/org/oppia/android/TestPresenter.kt" + tempFolder.newFile("testfiles/$stringFilePath").writeText(prohibitedContent) + + val exception = assertThrows() { runScript() } + + assertThat(exception).hasMessageThat().contains(REGEX_CHECK_FAILED_OUTPUT_INDICATOR) + assertThat(outContent.toString().trim()) + .isEqualTo( + """ + $stringFilePath:3: $badKdocOrBlockCommentShouldEndWithCorrectEnding + $stringFilePath:6: $badKdocOrBlockCommentShouldEndWithCorrectEnding + $wikiReferenceNote + """.trimIndent() + ) + } + @Test fun testFileContent_singleLineKdocWithExtraSpacesBeforeEnd_fileContentIsNotCorrect() { val prohibitedContent =