Skip to content

Fix: Shuffle Bias, jQuery Check, Global Scope Issues, Scroll Handling, and Outdated Configurations#773

Open
Ram-sah19 wants to merge 3 commits intoCircuitVerse:masterfrom
Ram-sah19:fix/code-quality-and-bugs
Open

Fix: Shuffle Bias, jQuery Check, Global Scope Issues, Scroll Handling, and Outdated Configurations#773
Ram-sah19 wants to merge 3 commits intoCircuitVerse:masterfrom
Ram-sah19:fix/code-quality-and-bugs

Conversation

@Ram-sah19
Copy link

@Ram-sah19 Ram-sah19 commented Mar 23, 2026

📄 PR Description
🔍 Summary

This PR fixes multiple code quality, correctness, and maintenance issues across the repository. It also incorporates review feedback to improve scroll handling robustness.

✅ Changes Made
Replaced biased shuffle with Fisher–Yates algorithm
Fixed incorrect jQuery null check using .length
Removed unnecessary console.log calls impacting performance
Removed invalid #!/bin/bash from JavaScript file
Updated deprecated Google Analytics (UA → GA4)
Replaced hardcoded year with dynamic handling (see note below)
Upgraded GitHub Action from actions/checkout@v2 → v4
Fixed global variable leakage using proper scoping
Improved scroll calculation fallback when #scrollcount is absent

@coderabbitai
Copy link

coderabbitai bot commented Mar 23, 2026

Warning

Rate limit exceeded

@Ram-sah19 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 16 minutes and 58 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2deb4c59-f951-4e6d-8da3-5283f012ac49

📥 Commits

Reviewing files that changed from the base of the PR and between 4a842d2 and fae206d.

📒 Files selected for processing (1)
  • assets/js/module.js

Walkthrough

This pull request makes small infrastructure and content adjustments across the repository: it updates a GitHub Actions checkout action from v2 to v4 and removes sudo from a Python step; removes a stray shebang from a GitHub script; makes the site footer year dynamic and comments out the active GA tracking ID; removes debug console logs and hardens scroll offset detection in a JS module; and tightens quiz initialization and replaces a sort-based shuffle with a Fisher–Yates implementation.

Suggested labels

potential-ai-slop

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title comprehensively covers all major changes: shuffle bias fix, jQuery check correction, global scope issues, scroll handling improvements, and configuration updates.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
assets/js/module.js (1)

2351-2353: Use document/page scroll fallback when #scrollcount is absent.

Line 2352 falls back to 0, which can miscalculate my on scrollable pages not using #scrollcount. Prefer a window/document scroll fallback.

♻️ Proposed fix
 var scrollEl = document.getElementById("scrollcount");
-var scrollTop = scrollEl ? scrollEl.scrollTop : 0;
+var scrollTop = scrollEl
+    ? scrollEl.scrollTop
+    : (window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0);
 my = e.pageY - offsetY + scrollTop;

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bb3cdf7d-9c60-4493-87e9-06bfc12d0110

📥 Commits

Reviewing files that changed from the base of the PR and between ac91c0a and 1700c3f.

📒 Files selected for processing (5)
  • .github/scripts/assign-or-comment.js
  • .github/workflows/deploy.yml
  • _config.yml
  • assets/js/module.js
  • assets/js/quiz.js
💤 Files with no reviewable changes (1)
  • .github/scripts/assign-or-comment.js

# Footer content
# appears at the bottom of every page's main content
footer_content: "Copyright © 2026 Contributors to CircuitVerse. Distributed under a [CC-by-sa] license."
footer_content: "Copyright © {% assign current_year = 'now' | date: '%Y' %}{{ current_year }} Contributors to CircuitVerse. Distributed under a [CC-by-sa] license."
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find where footer_content is used in templates/layouts
rg -n 'footer_content' --type html --type liquid -g '*.html' -g '*.md'

# Check the just-the-docs theme's footer implementation if vendored
fd -e html -e md | xargs grep -l 'footer_content' 2>/dev/null | head -5

Repository: CircuitVerse/Interactive-Book

Length of output: 103


🏁 Script executed:

#!/bin/bash
# Search for footer_content without problematic file type specifications
rg 'footer_content' -n

# Also look at the _config.yml file structure
head -100 _config.yml

Repository: CircuitVerse/Interactive-Book

Length of output: 4214


🏁 Script executed:

#!/bin/bash
# Find all template/layout files in common Jekyll locations
find . -type f \( -name "*.html" -o -name "*.liquid" -o -name "*.md" \) | grep -E '(_includes|_layouts|_sass)' | head -20

# List directory structure to understand theme setup
ls -la

Repository: CircuitVerse/Interactive-Book

Length of output: 2457


🏁 Script executed:

#!/bin/bash
# Search for footer_content in _layouts and _includes
rg 'footer_content' _layouts/ _includes/ 2>/dev/null

# Check what's in _layouts directory
ls -la _layouts/

# Check what's in _includes directory
ls -la _includes/

Repository: CircuitVerse/Interactive-Book

Length of output: 1882


🌐 Web query:

just-the-docs Jekyll theme footer_content Liquid processing

💡 Result:

In the Just the Docs Jekyll theme, the footer_content configuration option in _config.yml is deprecated and still supported for backward compatibility, but it does not process Liquid templating. It displays static HTML strings directly at the bottom of every page's main content. For robust markup and Liquid-based content (e.g., using Jekyll variables, loops, conditionals), create a custom _includes/footer_custom.html file in your site. This file is processed as a standard Jekyll include with full Liquid support and appears at the bottom of every page's main content, replacing or supplementing the deprecated footer_content. Example legacy footer_content (static HTML, no Liquid): footer_content: "Copyright © 2017-2020 Patrick Marsceill. Distributed by an <a href="https://github.com/just-the-docs/just-the-docs/tree/main/LICENSE.txt\">MIT license." Example _includes/footer_custom.html (with Liquid):

Copyright © {{ site.time | date: '%Y' }} {{ site.author | default: site.title | escape }}. Powered by Jekyll with Just the Docs.

{% if site.github.repository %} {{ site.github.repository }} {% endif %}
The theme's components/footer.html include renders this custom content if present. Official docs confirm this approach for dynamic footer content.

Citations:


🏁 Script executed:

#!/bin/bash
# Check if footer_custom.html exists
find . -name "*footer*" -type f

# Also check the content of content_footer.html since it exists
cat _includes/content_footer.html

Repository: CircuitVerse/Interactive-Book

Length of output: 195


Liquid tags in footer_content are not processed by just-the-docs.

The just-the-docs theme treats footer_content from _config.yml as static HTML only. The Liquid expression {% assign current_year = 'now' | date: '%Y' %}{{ current_year }} will render literally in the footer instead of displaying the current year.

To fix this, create _includes/footer_custom.html with the Liquid logic:

Copyright &copy; {{ 'now' | date: '%Y' }} Contributors to CircuitVerse. Distributed under a [CC-by-sa] license.

This is the officially supported approach by just-the-docs for dynamic footer content. Alternatively, remove the footer_content config and place the footer logic in the theme's footer template directly.

@Ram-sah19 Ram-sah19 changed the title Fix: Shuffle Bias, jQuery Check Bug, Global Scope Issues, Debug Logs, and Outdated Configurations Fix: Shuffle Bias, jQuery Check, Global Scope Issues, Scroll Handling, and Outdated Configurations Mar 23, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fe88c011-51d3-4b1a-acd6-77c9585cf8d1

📥 Commits

Reviewing files that changed from the base of the PR and between 1700c3f and 4a842d2.

📒 Files selected for processing (1)
  • assets/js/module.js

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