Skip to content

Commit

Permalink
Fix #3304: Add check to ensure KDoc presence for non-private members (#…
Browse files Browse the repository at this point in the history
…3499)

* Fix #3290: Add support for generic regex pattern matching

* Apply review suggestions for proto location

* Delete main directory

* Implment script logic and tests

* CI setup part 1

* syntax fix in yaml file

* import nits in dummy file

* Use regex patterns from script in script test

* Make PR suggestions into effect

* Make PR suggestions into effect

* Make PR suggestions into effect

* Improve naming of script_assets variables

* Make PR suggestions into effect

* Make PR suggestions

* Make PR suggestions

* Revamp testing approach

* Fix #3291: Add check for XML syntax correctness

* nit fixes

* Introduce XML syntax check in static checks workflow

* Fix #3292: Add check for test files presence for prod files

* Make nit suggestions

* Make nit suggestions

* Make nit suggestions

* Fix #3300: Add check for accessibility labels for activities

* Add CI check for label presence for activities

* Add ScriptConstants file to exemptions test list

* Test if: always()

* Revert "Test if: always()"

This reverts commit b72e419

* Add if: always()

* Add if: always()

* Add if: always()

* Apply review suggestions on PR

* Make review suggestions from regex pattern checks

* Implement review suggestions based on #3340

* Refactor PR as per feedback recieved

* Implement feedback suggestions

* Implement review suggestions

* Implement review suggestions

* Implement review suggestions

* Implement review suggestions

* nits

* Nit fixes

* Nit fixes

* Nit fixes

* Implement feedback suggestions as per #3340

* nit fix

* nit fix

* nit fix

* nit fix

* Review suggestions part 1

* Implement review suggestions part 2

* nit fixes

* update static_checks

* add test to repository file

* nit fix

* nit fix

* nit fix

* Do review suggestions

* Implement review suggestions

* Implement review suggestions

* nit fix

* Implement review suggestions

* Add Ben as a codeowner for the ScriptExemptions file

* bazel files nit fix

* Introduce a library for the regex assets

* Make directory structure same as that of #3374

* Make directory structure similar to #3374

* add new files to test file script exemptions and nit fixes

* diable ktlint max-line-length

* disable ktlint-max-line

* disable ktlint max-length

* remove testonly attribute from tests

* add new files to script exemptions

* nit fix

* nit fix

* nit fix

* Apply review suggestions

* ktlint fix

* nit fix

* Apply nit fixes

* Apply nit fixes

* Remove script constants

* nit fix

* add todo

* add todo

* nit fixes

* add test

* add testOnly

* nit fixes

* nit fix

* nit fixes

* nit fixes

* nit fixes

* nit fixes

* fix textproto file

* add exemptions to textproto

* sort failures lexicographically

* add new files to exemption list

* nit fixes

* nit fixes

* add kdocs

* nit fix

* nit fix

* Trigger CI failure exclusively

* Revert CI check failure

* Fix #3340: Create a script to ensure KDoc presence

* Add initial tests

* Add more tests and add documentation

* nit fix

* nit fix

* nit fix

* nit fix

* Add more files to kdoc exemptions

* nit fixes

* nit fixes

* nit fixes

* Add redundant exemptions check

* rectify static_checks

* Remove duplicate proto libraries

* nit fixes

* nit fixes and add redundant exemptions check to script

* nit fixes

* add activity to exemption

* nit fixes

* nit fixes

* nit fixes

* nit fixes

* nit fixes

* update branch

* nit fixes
  • Loading branch information
Sparsh1212 authored Jul 30, 2021
1 parent b466ad4 commit 5c57dd8
Show file tree
Hide file tree
Showing 11 changed files with 2,308 additions and 216 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,8 @@ jobs:
if: always()
run: |
bazel run //scripts:accessibility_label_check -- $(pwd) scripts/assets/accessibility_label_exemptions.pb app/src/main/AndroidManifest.xml
- name: KDoc Validation Check
if: always()
run: |
bazel run //scripts:kdoc_validity_check -- $(pwd) scripts/assets/kdoc_validity_exemptions.pb
16 changes: 16 additions & 0 deletions scripts/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_binary", "kt_jvm_libra
load(
"//scripts:script_assets.bzl",
"generate_accessibility_label_assets_list_from_text_protos",
"generate_kdoc_validity_assets_list_from_text_protos",
"generate_maven_assets_list_from_text_protos",
"generate_regex_assets_list_from_text_protos",
"generate_test_file_assets_list_from_text_protos",
Expand Down Expand Up @@ -131,3 +132,18 @@ kt_jvm_binary(
"//scripts/src/java/org/oppia/android/scripts/label:accessibility_label_check_lib",
],
)

KDOC_VALIDITY_EXEMPTION_ASSETS = generate_kdoc_validity_assets_list_from_text_protos(
name = "kdoc_validity_exemption_assets",
kdoc_validity_exemptions_name = ["kdoc_validity_exemptions"],
)

kt_jvm_binary(
name = "kdoc_validity_check",
testonly = True,
data = KDOC_VALIDITY_EXEMPTION_ASSETS,
main_class = "org.oppia.android.scripts.docs.KdocValidityCheckKt",
runtime_deps = [
"//scripts/src/java/org/oppia/android/scripts/docs:kdoc_validity_check_lib",
],
)
626 changes: 626 additions & 0 deletions scripts/assets/kdoc_validity_exemptions.textproto

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions scripts/script_assets.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,27 @@ def generate_accessibility_label_assets_list_from_text_protos(
proto_dep_bazel_target_prefix = "//scripts/src/java/org/oppia/android/scripts/proto",
proto_package = "proto",
)

def generate_kdoc_validity_assets_list_from_text_protos(
name,
kdoc_validity_exemptions_name):
"""
Converts a single list of text proto assets to binary.
Args:
name: str. The name of this generation instance. This will be a prefix for derived targets.
kdoc_validity_exemptions_name: list of str. The list of kdoc validity exemptions file name.
Returns:
list of str. The list of new proto binary asset files that were generated.
"""
return generate_proto_binary_assets(
name = name,
names = kdoc_validity_exemptions_name,
proto_dep_name = "script_exemptions",
proto_type_name = "KdocValidityExemptions",
name_prefix = name,
asset_dir = "assets",
proto_dep_bazel_target_prefix = "//scripts/src/java/org/oppia/android/scripts/proto",
proto_package = "proto",
)
17 changes: 17 additions & 0 deletions scripts/src/java/org/oppia/android/scripts/docs/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
Libraries corresponding to documentation-related scripts.
"""

load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library")

kt_jvm_library(
name = "kdoc_validity_check_lib",
testonly = True,
srcs = ["KdocValidityCheck.kt"],
visibility = ["//scripts:oppia_script_binary_visibility"],
deps = [
"//scripts/src/java/org/oppia/android/scripts/common:repository_file",
"//scripts/src/java/org/oppia/android/scripts/proto:script_exemptions_java_proto_lite",
"//third_party:org_jetbrains_kotlin_kotlin-compiler-embeddable",
],
)
Loading

0 comments on commit 5c57dd8

Please sign in to comment.