Skip to content

.pr_agent_accepted_suggestions

root edited this page Dec 24, 2024 · 1 revision
                     PR 1 (2024-12-24)                    
[Possible issue] Use temporary test directories instead of hardcoded paths for better test portability

✅ Use temporary test directories instead of hardcoded paths for better test portability

Replace hardcoded file path with a temporary directory using @TempDir annotation to make tests more portable and avoid potential file system conflicts.

cover-agent-plugin/src/test/groovy/ai/qodo/cover/plugin/CoverAgentPluginSpec.groovy [10-11]

-@Shared
-File testProjectDir = new File("/Users/davidparry/Desktop/build_tmp")
+@TempDir
+File testProjectDir
  • Apply this suggestion Suggestion importance[1-10]: 9

Why: Using hardcoded file paths makes tests environment-dependent and can cause failures on different machines. Using @TempDir is a best practice that ensures test isolation and portability.



Clone this wiki locally