hardcode-finder
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "hardcode-finder" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-9c0ba2356297bbaf5de79f99d3724712ef5e3f469a2e74f9039dd0dff950c23a. Verify the upstream source and version against https://skillhub.cn/skills/user_35039dbf/hardcode-finder before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Detect hard-coded values in code (strings, numbers, URLs, configuration values, UI layouts), support 20+ programming languages and multiple UI frameworks, and provide remediation suggestions for identified hard-coded items.
Introduction source: third_party · user_35039dbf · 1.0.3 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Audience
- Translation pending; see source documentation.
- Inputs and outputs
- python3 -m hardcode_finder --format json /path/to/project > report.json ```
- Software, accounts and paid services
- Translation pending; see source documentation.
- Limits and differences
- Not specified in the source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: hardcode-finder
slug: hardcode-finder
displayName: 硬编码检测工具
description: 检测代码中的硬编码值(字符串、数字、URL、配置值、UI布局),支持 20+ 种编程语言和多种 UI 框架,给出修改建议。
version: 1.1.0hardcode-finder 硬编码检测工具
检测项目中的硬编码值(字符串、数字、URL、配置值、UI 布局),并给出修改建议。支持 Android (Java/Kotlin)、iOS (Swift/ObjC)、Web (JS/TS/Vue)、后端 (Python/Go/Rust) 等 20+ 种编程语言。
适用场景
- 代码审查时快速发现硬编码问题
- CI/CD 流水线中自动检测硬编码
- 项目重构前评估硬编码现状
- 团队统一代码规范
使用方法
# 扫描当前目录
python3 -m hardcode_finder
# 扫描指定项目
python3 -m hardcode_finder /path/to/project
# 只检测高严重级别问题
python3 -m hardcode_finder --min-severity high /path/to/project
# 只检测特定类型
python3 -m hardcode_finder --type string url /path/to/project
# 只检测 UI 布局硬编码
python3 -m hardcode_finder --type layout /path/to/project
# 指定文件类型
python3 -m hardcode_finder --ext py,js,swift /path/to/project
# 输出 JSON 格式
python3 -m hardcode_finder --format json /path/to/project > report.json
命令行选项
| 选项 | 简写 | 说明 |
|---|---|---|
--ext |
-e |
指定文件扩展名(逗号分隔) |
--type |
-t |
指定检测类型(string/number/url/config/layout) |
--format |
-f |
输出格式(text/json/csv) |
--ignore |
-i |
忽略的目录(逗号分隔) |
--ignore-logs |
忽略日志语句中的硬编码 | |
--min-severity |
最低严重级别(high/medium/low) | |
--no-color |
禁用彩色输出 | |
--no-suggestions |
不显示修改建议 |
检测类型
| 类型 | 说明 | 严重级别 |
|---|---|---|
string |
字符串常量(中文为 HIGH) | Medium / High |
number |
魔法数字 | Low / Medium |
url |
URL 和 API 端点 | High |
config |
配置值(超时、分页等) | Medium |
layout |
UI 布局硬编码(margin/padding/圆角/高度等) | Medium |
布局检测支持
覆盖的属性:margin, padding, border-radius, width, height, font-size, gap, border-width, box-shadow, top/right/bottom/left 定位等。
支持的框架语法:
- CSS/Sass/Less:
margin: 16px;,padding: 1.5rem; - SwiftUI:
.padding(16),.cornerRadius(12),.frame(width: 200) - Flutter:
EdgeInsets.all(16),BorderRadius.circular(12) - React Native:
marginTop: 16,borderRadius: 8 - Android XML:
android:layout_margin="16dp"
支持的语言
Web: JavaScript (.js/.jsx), TypeScript (.ts/.tsx), Vue (.vue), HTML/CSS
Android: Java (.java), Kotlin (.kt/.kts)
iOS: Swift (.swift), Objective-C (.m/.mm/.h)
后端: Python (.py), Go (.go), Rust (.rs), Ruby (.rb), PHP (.php), C/C++ (.c/.cpp), C# (.cs)
输出解读
- HIGH:需要立即处理(中文字符串、URL、密钥)
- MEDIUM:建议处理(配置值、英文字符串、布局硬编码)
- LOW:可选处理(魔法数字)
依赖
- Python 3.9+
- 无额外依赖,开箱即用
特点
- 零依赖:纯 Python 实现,无需安装额外包
- 智能过滤:自动跳过注释、import 语句和常量定义(大写变量名)
- 多格式输出:支持文本、JSON、CSV 输出格式
- CI/CD 友好:发现高严重级别问题时返回码为 1
- UI 布局检测:支持 CSS/SwiftUI/Flutter/React Native/Android XML 多框架布局硬编码检测
Current listing version
1.0.3
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 覆盖 20+ 种编程语言和多种 UI 框架,适用场景广泛
- 解决代码审查、CI/CD、项目重构中的实际痛点,实用价值高
Highlights
- description 清晰完整,涵盖功能、语言支持和典型使用场景
- 触发词精准,边界清晰,不易误触或漏触
Areas to improve
-
description 写错位置 Reported severity: Minor
顶层 frontmatter 与 skill_body 内部均包含 description,内容重复
Recommendation: 建议仅在顶层 frontmatter 保留 description,skill_body 内部可省略或用更详细说明替代
Highlights
- 文档结构完整,包含使用方法、参数说明、检测类型、输出解读等关键章节
- frontmatter 完整,单文件长度适中,排版规范
Highlights
- 零依赖纯 Python 实现,开箱即用,可靠性高
- 支持多种输出格式和过滤选项,CI/CD 友好
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Accounts, secrets or authorization
Use a dedicated least-privilege account. Keep secrets out of public content and command logs; verify the receiving service and tenant.
Mentioned in main document · lines 91
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Translation pending; see source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.