refactor: use minimatch for env var glob matching#3
Merged
Conversation
This commit improves the detection logic for Cursor and Qoder IDEs by adding pattern matching for environment variables VSCODE_GIT_ASKPASS_MAIN and BROWSER that contain '.cursor-server' or '.qoder-server' substrings. This fixes issues where the IDE detection was not working properly in SSH and DevContainer environments. The changes include: 1. Added new environment variable patterns in envConfigs for Cursor and Qoder detection 2. Enhanced getCoDevelopedBy function to support substring pattern matching 3. Added comprehensive tests to verify the new detection logic This ensures that users working in remote development environments (SSH, DevContainer) will have proper Co-developed-by trailers added to their commits when using Cursor or Qoder. Change-Id: Ieb98755b1c0aa178b49484b2cdc613c11f90df39 Co-developed-by: Qoder <noreply@qoder.com> Signed-off-by: Tom Yu <yyuuttaaoo@gmail.com> Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
1. Use glob patterns **/.cursor-server/** and **/.qoder-server/** in the
envConfigs array to match paths containing these substrings
2. Use the minimatch package with proper { dot: true } option in the
getCoDevelopedBy function to handle paths starting with dot(.)
3. Replace single asterisks with ** in the array to match values
containing the / symbol
4. All tests pass, verifying that the refactored functionality behaves
consistently with the previous implementation
This refactoring simplifies the code and improves maintainability while
preserving the same functionality.
Change-Id: I4cbea155af867690f1e4b9d51f386cf7aaa55337
Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.