-
-
Notifications
You must be signed in to change notification settings - Fork 357
fix(hasCode): use index variable #6650
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
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR corrects the hashCode utility by using the loop index when retrieving each character’s code to ensure proper hash calculations. Class diagram for updated hashCode functionclassDiagram
class hashCode {
+str: string
+hash: number
+char: number
+for loop: uses index i to access str.charCodeAt(i)
}
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey there - I've reviewed your changes - here's some feedback:
- Please update the PR title to reference
hashCode
instead ofhasCode
for clarity. - Add a concise summary in the PR description explaining this change to improve context for reviewers.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Please update the PR title to reference `hashCode` instead of `hasCode` for clarity.
- Add a concise summary in the PR description explaining this change to improve context for reviewers.
## Individual Comments
### Comment 1
<location> `src/BootstrapBlazor/wwwroot/modules/utility.js:673` </location>
<code_context>
const hashCode = str => {
let hash = 0;
for (let i = 0; i < str.length; i++) {
- const char = str.charCodeAt(1);
+ const char = str.charCodeAt(i);
hash = (hash << 5) - hash + char;
hash |= 0;
</code_context>
<issue_to_address>
The change from str.charCodeAt(1) to str.charCodeAt(i) fixes the hash function logic.
Using str.charCodeAt(i) ensures each character is included in the hash calculation, reducing collisions and improving hash quality.
</issue_to_address>
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6650 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 739 739
Lines 31674 31674
Branches 4459 4459
=========================================
Hits 31674 31674
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Link issues
fixes #6647
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Bug Fixes: