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
Excludes for createTempFile forbidden method #14465
Comments
I have some confusion on this issue. I have highlighted the same here. #14414 (comment). Once, I have some clarity, we can start working. |
@rnveach Response to #14414 (comment) :
@relentless-pursuit , you are actually right. I don't think there is any alternative as such. From #14220 (comment) :
The major issue that I see with Since the files are already a part of |
No worries. Feel free to contribute to enrich the PR. As i had limited understanding in the beginning, and assumed we mandatorily need to create files, but I don't think that is the case. However, some test cases need actual files. And, i have used |
Seems you have found a workaround ;) As mentioned at #14414 (comment) , |
Please look at API for cleanup. https://junit.org/junit5/docs/5.4.1/api/org/junit/jupiter/api/io/TempDir.html
You can also see the same code if you browse the
It is better we use things already built for us, instead of trying to do our own workaround.
It seems to me, all you need to do is create files in the temp directory you created from the annotation. As long as you specify the files go in such temp directory then things should work out. As mentioned above, the TempDir annotation will attempt to clean up any files in the directory recursively. You can always verify this on your local. As the other issue mentioned, just change |
If there is someway to bypass Edit: In my implementation, Based on this information, we may want to rethink banning |
I have removed createTempFile. And, the test cases are wokring fine, except in some where i had to have a file. In my PR, i am just creating a path or, path to the file, and not the file itself, and eliminating the need of any tempFile. For most test cases, it worked fine. Meanwhile, i will analyse your review comments and understand better. Please let me know if the changes in the PR look good to you. |
I did. So far, it seems to be cleaning up. |
Well, it can be a solution. But, then it becomes a manual cleanup. And, it comes with it's own trade-off. As highlighted already, |
We missed removal of exclusions at https://github.com/Lmh-java/checkstyle/blob/16259a82bc779d4adbf329721cfa0eef33d79cd4/pom.xml#L1868 Edit: nevermind, contributor needed to rebase |
This is in continuation to #14220.
We need to refactor below classes by removing createTempFile, createTempDir (if any) occurences as mentioned in the linked issue.
Once, you have refactored the code, you can remove the name of the corresponding class from excludes section in pom.xml
The text was updated successfully, but these errors were encountered: