This repository was archived by the owner on Nov 14, 2025. It is now read-only.
Commit 2383f4d
refactor: improve code quality by addressing SonarQube code smells (#336)
* refactor: improve code quality by addressing SonarQube code smells
This commit addresses 7 code smell issues identified by SonarQube:
- src/domains/base.ts:48: Use String#replaceAll() instead of replace()
- src/domains/system.ts:46: Use for...of instead of forEach() for better performance
- src/utils/pattern-matcher.ts:35-37: Use String#replaceAll() and String.raw for cleaner code
Changes:
- Replaced regex-based replace() calls with replaceAll() for better readability
- Converted forEach() to for...of loop for improved performance
- Used String.raw template literal to avoid unnecessary escaping
All tests passing (1012/1012). Technical debt reduced by 30 minutes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* chore: add changeset for code quality improvements
* fix: use string literals instead of regex for simple character replacements
SonarCloud flagged that replaceAll() with simple character patterns
should use string literals instead of regex for better performance
and readability.
Changes:
- src/utils/pattern-matcher.ts:36: Changed /\*/g to '*'
- src/utils/pattern-matcher.ts:37: Changed /\?/g to '?'
This resolves 2 new code smells introduced in the previous commit
and should improve the SonarCloud quality gate status.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* refactor: use conventional string escaping instead of String.raw
Addressed Copilot review feedback. While both String.raw and conventional
escaping produce identical results, using '\$&' is more conventional and
clearer for replacement patterns in replaceAll().
This improves code maintainability without changing functionality.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: Claude <[email protected]>1 parent 161452d commit 2383f4d
File tree
4 files changed
+19
-6
lines changed- .changeset
- src
- domains
- utils
4 files changed
+19
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
0 commit comments