Skip to content

Prevent potential encoding issue#309

Merged
woocheol-lge merged 1 commit intomainfrom
e_test
Apr 21, 2026
Merged

Prevent potential encoding issue#309
woocheol-lge merged 1 commit intomainfrom
e_test

Conversation

@woocheol-lge
Copy link
Copy Markdown
Contributor

@woocheol-lge woocheol-lge commented Apr 20, 2026

Description

Prevent potential encoding issue

@woocheol-lge woocheol-lge self-assigned this Apr 20, 2026
@woocheol-lge woocheol-lge added the bug fix [PR] Fix the bug label Apr 20, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 20, 2026

Warning

Rate limit exceeded

@woocheol-lge has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 36 minutes and 5 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 36 minutes and 5 seconds.

⌛ 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8e6aa775-2ab2-4e44-a34a-74364702e798

📥 Commits

Reviewing files that changed from the base of the PR and between 533ec70 and 1d94a5c.

📒 Files selected for processing (3)
  • cli.py
  • src/fosslight_dependency/cli.py
  • src/fosslight_dependency/package_manager/Npm.py
📝 Walkthrough

Walkthrough

This PR relocates environment variable initialization for PYTHONUTF8 and PYTHONIOENCODING from the entry-point wrapper to the main CLI module's startup function, and adds Windows-aware npm executable resolution in the Npm package manager.

Changes

Cohort / File(s) Summary
Environment Variable Configuration
cli.py, src/fosslight_dependency/cli.py
Removed hardcoded environment variable assignments from wrapper script; moved them to main() function with conditional defaults that respect existing values. Sets PYTHONUTF8='1' and PYTHONIOENCODING='utf-8' only if not already defined.
Windows Npm Resolution
src/fosslight_dependency/package_manager/Npm.py
Updated install_license_checker() to resolve npm executable platform-aware: uses shutil.which("npm.cmd") on Windows, shutil.which("npm") on other platforms.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

chore

Suggested reviewers

  • dd-jy
  • bjk7119
🚥 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Prevent potential encoding issue' is directly related to the main changes in the PR, which involve setting PYTHONUTF8 and PYTHONIOENCODING environment variables to address encoding issues.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch e_test

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
Copy Markdown

@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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/fosslight_dependency/cli.py`:
- Around line 33-34: Replace the use of os.environ.setdefault for PYTHONUTF8 and
PYTHONIOENCODING with direct assignment so the CLI always enforces UTF‑8: change
os.environ.setdefault('PYTHONUTF8', '1') to os.environ['PYTHONUTF8'] = '1' and
os.environ.setdefault('PYTHONIOENCODING', 'utf-8') to
os.environ['PYTHONIOENCODING'] = 'utf-8' so subprocesses (e.g., code that relies
on these variables like Pypi.py) cannot be overridden by preexisting environment
values.

In `@src/fosslight_dependency/package_manager/Npm.py`:
- Around line 73-75: The npm command resolution can return None on Windows
causing subprocess.run([None,...]) to raise; update the resolution around
npm_cmd in Npm.py so that on Windows you try shutil.which("npm.cmd") then
fallback to shutil.which("npm") (and on non-Windows just shutil.which("npm")),
check npm_cmd for None before calling subprocess.run in the install block that
invokes [npm_cmd, "install", "-g", "license-checker", "--prefix", NODE_DIR], and
if npm_cmd is still None return False (or handle failure) instead of calling
subprocess.run with None.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5ac1595f-7c6b-47c7-aca1-7a15f3e6f5d9

📥 Commits

Reviewing files that changed from the base of the PR and between 1cd7553 and 533ec70.

📒 Files selected for processing (3)
  • cli.py
  • src/fosslight_dependency/cli.py
  • src/fosslight_dependency/package_manager/Npm.py
💤 Files with no reviewable changes (1)
  • cli.py

Comment thread src/fosslight_dependency/cli.py Outdated
Comment thread src/fosslight_dependency/package_manager/Npm.py
Signed-off-by: woocheol <jayden6659@gmail.com>
@woocheol-lge woocheol-lge merged commit 1168ea1 into main Apr 21, 2026
14 checks passed
@woocheol-lge woocheol-lge deleted the e_test branch April 21, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix [PR] Fix the bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants