Skip to content
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

[#442] Add file name sanitization #448

Open
wants to merge 3 commits into
base: development
Choose a base branch
from

Conversation

vsantele
Copy link
Collaborator

Description of changes made

Sanitize filename before saving a generated test.

Why is merge request needed

The filename is created with the class name of the generated test. Even if i's not a good convention, a class name can contain forbidden characters on Windows like " if the name is written like this:

class `MyBadNameWithA""`

Other notes

Closes #442

As far as I see, the only place we construct the full path for a generated test is inside the method saveGeneratedTest and then the program uses the return value of this function as a path for a test. So, it is safe to do the sanitization here. Please correct me if I'm wrong.

What is missing?

Please mention if anything is missing for this merge request, e.g you have decided to move something to the next merge request

  • I have checked that I am merging into correct branch

Introduced a `sanitizeFileName` method to clean file names of forbidden characters, ensuring compatibility across platforms. Updated `saveGeneratedTest` to utilize this sanitization for improved file handling and consistency.
Copy link

🚨 PR Title Needs Formatting

Please specify the modified module and, preferrably, include a GitHub or YouTrack issue that this PR closes in the title. By module, we mean any logical part of the project — it doesn’t have to be a Gradle module or anything like that.
Use the following format: [<Module(s)>] and(or) [<ISSUE-ID>] brief title. Examples:

  • [LLM] Add support for Google AI as an LLM
  • [Build] Update IntelliJ Platform version
  • [#290] Fix bug with LLM response parsing`
  • [PromptBuilder] [JBRes-2860] Refactor the PromptBuilder component

@vsantele vsantele changed the title Add file name sanitization [#442] Add file name sanitization Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test file contains sometime forbidden character
1 participant