spark-test commented on code in PR #60780:
URL: https://github.com/apache/spark/pull/60780#discussion_r4655682713


##########
dev/sparktestsupport/tests/test_utils.py:
##########
@@ -53,6 +53,21 @@ def test_lint_js_module_selection(self):
             
determine_modules_for_files(["python/docs/source/_static/copybutton.js"]),
         )
 
+    def test_lint_r_module_selection(self):
+        self.assertIn(
+            modules.ShellScriptTestGoal("dev/lint-r"),
+            determine_shell_script_test_goals([modules.root], 
modules.TestStage.PRE_BUILD),
+        )
+        cases = {
+            "R/pkg/R/DataFrame.R": {modules.sparkr, modules.lint_r},
+            "R/pkg/.lintr": {modules.sparkr, modules.lint_r},
+            "dev/lint-r.R": {modules.lint_r},

Review Comment:
   **Nit (P3):** This test has no case for `dev/lint-r` itself, the script the 
lint job runs as the `lint-r` goal. From `is_ignored_file` and 
`Module.contains_file`, an exact `/dev/lint-r` ignore entry like the ones for 
`/dev/lint-java`, `/dev/lint-python` and `/dev/lint-scala`, or a regex narrowed 
to `dev/lint-r\.R$`, would send `dev/lint-r` to no module or to `root`. Every 
case in this test would still pass, because `dev/lint-r.R` keeps mapping to 
`lint-r`. A PR that edits only `dev/lint-r` would then skip the R linter in the 
lint job, or run every CI job, with no failing test. 
`test_lint_js_module_selection` already checks `dev/lint-js` this way:
   
   ```suggestion
               "dev/lint-r.R": {modules.lint_r},
               "dev/lint-r": {modules.lint_r},
   ```
   
   **Verification:**
   - **Regression:** Module-selection coverage asserts that a change to the R 
linter's entry script, dev/lint-r, selects exactly the lint-r module. The 
assertion fails when dev/lint-r is added back to the ignored file patterns in 
dev/sparktestsupport/modules.py, and also when the lint-r path pattern is 
narrowed so that it no longer matches dev/lint-r. The existing dev/lint-r.R 
case still passes under both edits, so it cannot replace this check.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to