Skip to content

Add more levels and change XP algorithm#2

Open
lulunac27a wants to merge 1 commit intoAmariahAK:mainfrom
lulunac27a:patch-1
Open

Add more levels and change XP algorithm#2
lulunac27a wants to merge 1 commit intoAmariahAK:mainfrom
lulunac27a:patch-1

Conversation

@lulunac27a
Copy link

@lulunac27a lulunac27a commented Feb 11, 2026

Added more levels and changed the XP algorithm for earning XP points in a commit.

Summary by Sourcery

Extend the gamification system with higher-level progression and adjust commit XP calculations to reward multi-file changes more strongly and allow higher per-commit XP.

New Features:

  • Add progression levels 16–100 with increasing XP thresholds and new high-rank titles for advanced contributors.

Enhancements:

  • Increase the weight of files-changed in commit XP calculation and adopt a steeper logarithmic scaling formula for XP growth.
  • Raise the per-commit XP cap to scale with user level, allowing significantly higher rewards for higher-level contributors.

Added more levels and changed the XP algorithm for earning XP points in a commit.
@sourcery-ai
Copy link

sourcery-ai bot commented Feb 11, 2026

Reviewer's Guide

Extends the gamification level table up to level 100 and makes XP per-commit more generous and more strongly influenced by multi-file changes via updated weighting, scaling, and caps in calculate_commit_xp.

File-Level Changes

Change Details Files
Extend the gamification level progression up to level 100 with higher thresholds and new titles.
  • Added levels 16–100 to the levels configuration list with increasing XP thresholds.
  • Introduced new title tiers (Legendary Programmer, Master Coder, Diamond Scripter) for higher levels.
  • Kept some higher levels sharing the same title across ranges with progressively higher thresholds.
commit_checker/gamification.py
Adjust XP calculation to reward multi-file commits more and increase potential XP per commit with modified scaling and caps.
  • Increased the default XP weight for files_changed from 2.0 to 5.0 in the xp_weights configuration and its usage in base_xp.
  • Changed the logarithmic scaling formula for base_xp to a steeper, multiplicative log-based curve using math.log(1 + base_xp) * (1 + math.log(1 + base_xp) / 5) * 10.
  • Replaced the previous max XP per commit cap (min(50, 15 + current_level * 3)) with a more generous linear cap of 100 + current_level * 10.
commit_checker/gamification.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The extended levels list is now a very large hard-coded structure with many repeated titles; consider generating thresholds and titles programmatically (e.g., via formulas and ranges) to reduce maintenance cost and potential for inconsistencies.
  • The XP calculation now hard-codes much larger weights, a more aggressive scaling formula, and a much higher level-dependent cap; it would be safer to move these magic numbers into configuration so they can be tuned without code changes and to avoid unexpected XP inflation.
  • The new max_xp formula 100 + (current_level * 10) grows without a fixed upper bound and removes the previous safety cap of 50; you may want to reintroduce an absolute ceiling to prevent very high-level users from gaining extremely large XP from a single commit.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The extended levels list is now a very large hard-coded structure with many repeated titles; consider generating thresholds and titles programmatically (e.g., via formulas and ranges) to reduce maintenance cost and potential for inconsistencies.
- The XP calculation now hard-codes much larger weights, a more aggressive scaling formula, and a much higher level-dependent cap; it would be safer to move these magic numbers into configuration so they can be tuned without code changes and to avoid unexpected XP inflation.
- The new max_xp formula `100 + (current_level * 10)` grows without a fixed upper bound and removes the previous safety cap of 50; you may want to reintroduce an absolute ceiling to prevent very high-level users from gaining extremely large XP from a single commit.

## Individual Comments

### Comment 1
<location> `commit_checker/gamification.py:626` </location>
<code_context>
         if base_xp > 0:
             import math
-            scaled_xp = math.log(1 + base_xp) * 8  # Logarithmic scaling
+            scaled_xp = math.log(1 + base_xp) * (1 + math.log(1 + base_xp) / 5) * 10  # Logarithmic scaling
         else:
             scaled_xp = get_base_commit_xp(config)
</code_context>

<issue_to_address>
**question (bug_risk):** The new scaling formula is closer to quadratic in log(base_xp), which may significantly increase XP at higher ranges.

This new term `(1 + log(1 + base_xp)/5) * 10` makes XP growth roughly proportional to `log(base_xp)^2` at large values, which may actually accelerate XP gain for very large commits rather than dampening it. Consider plotting old vs new XP over a realistic `base_xp` range to confirm it matches the intended progression and doesn’t introduce large jumps for big refactors.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

if base_xp > 0:
import math
scaled_xp = math.log(1 + base_xp) * 8 # Logarithmic scaling
scaled_xp = math.log(1 + base_xp) * (1 + math.log(1 + base_xp) / 5) * 10 # Logarithmic scaling
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question (bug_risk): The new scaling formula is closer to quadratic in log(base_xp), which may significantly increase XP at higher ranges.

This new term (1 + log(1 + base_xp)/5) * 10 makes XP growth roughly proportional to log(base_xp)^2 at large values, which may actually accelerate XP gain for very large commits rather than dampening it. Consider plotting old vs new XP over a realistic base_xp range to confirm it matches the intended progression and doesn’t introduce large jumps for big refactors.

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.

1 participant