-
Notifications
You must be signed in to change notification settings - Fork 26
🐛 Validate custom rules file types in profile file dialog #1477
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
Open
ibolton336
wants to merge
1
commit into
konveyor:main
Choose a base branch
from
ibolton336:fix/580-ruleset-file-validation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| kind: bugfix | ||
| description: > | ||
| Validate file types when selecting custom rules for a profile. The file | ||
| dialog now filters to YAML rule files, and any non-YAML files that slip | ||
| through (e.g. on platforms where dialog filters are not enforced) are | ||
| skipped with a warning instead of being silently added to the profile. | ||
| Folders are still accepted as rule directories. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: konveyor/editor-extensions
Length of output: 4702
🌐 Web query:
Microsoft VSCode API workspace.fs.stat Error FileSystemError stat does not find file throws documentation💡 Result:
In the Visual Studio Code extension API, the
vscode.workspace.fs.statmethod is designed to throw avscode.FileSystemErrorwhen the target file or folder cannot be found [1][2]. When implementing or consuming this API, you should handle this scenario using atry-catchblock [1][2]. Specifically, when a file is missing, the API throws an error that satisfiese instanceof vscode.FileSystemErrorand whose name or code corresponds toFileNotFound[1][2][3]. Key technical details: - Error Handling: To verify if a file does not exist, wrap thestatcall in atry-catchand check for theFileNotFounderror [1][2]. - Implementation Requirements: If you are implementing a customFileSystemProvider, you are expected to throwvscode.FileSystemError.FileNotFound()when a requested path does not exist [4]. This allows VS Code to correctly propagate the state and identify the missing file [4]. - Identification: You can identify the specific error type by checking the error object's name or code property, which will be set toFileNotFound[3][5]. Note that some customFileSystemProviderimplementations (such as specific Git provider versions) may behave inconsistently if not properly configured to throw these errors; however, the standard expectation for thevscode.workspace.fs.statAPI is that it must signal a missing entry by throwing the appropriateFileSystemError[6][4].Citations:
🌐 Web query:
VSCode FileSystemError.name FileNotFound stat throws error code name💡 Result:
In the Visual Studio Code extension API, when implementing a FileSystemProvider—such as the stat method—you should throw a vscode.FileSystemError.FileNotFound error to indicate that a requested file or directory does not exist [1][2]. For your implementation, use the built-in factory method: throw vscode.FileSystemError.FileNotFound(uri); Key technical details regarding FileSystemError codes: 1. Identifying Errors: The FileSystemError class includes a code property that identifies the type of error [3][4]. This code corresponds to the class name of the factory method (e.g., 'FileNotFound') [3][5]. 2. Internal Mappings: Internally, VS Code maps these errors to specific provider error codes (like EntryNotFound) [6]. When you throw using the provided factory methods, the VS Code file service correctly handles and identifies these errors [1][7]. 3. Best Practice: Always use the static factory methods provided by the vscode.FileSystemError class (e.g., FileExists, FileNotADirectory, NoPermissions) rather than manually constructing an error object [1][5][8]. This ensures the error is correctly recognized by the host side of the VS Code API [1].
Citations:
Handle
workspace.fs.statfailures per selection.window.showOpenDialogcan return stale or unsupported URIs, andworkspace.fs.stat(uri)can throw before later selections are evaluated. Wrap eachstatcall intry/catch, track stat failures separately from non-YAML files, and continue evaluating the remaining selections.🤖 Prompt for AI Agents