API004infoPro

hardcoded-api-url

Hardcoded API URLs make it hard to switch between environments

Applies to: Go, JavaScript, Python, Ruby, Rust, TypeScript

Why this matters

When you hardcode URLs like 'https://api.example.com', you can't easily switch between development, staging, and production. Use environment variables or config files instead.

Catch it before it ships

pip install stablestack # or: npx stablestackstablestack # scans your project, API004 includedstablestack explain API004

API004 is part of the Pro rule set. See pricing — the free tier ships 24 checks with no signup.

False positive in your codebase? Suppress a single line with # noqa: API004