{"meta":{"title":"在生成的代码中找到的警报","intro":"使用 code scanning 分析代码时，你可能希望仅生成要分析的代码。","product":"安全性和代码质量","breadcrumbs":[{"href":"/zh/code-security","title":"安全性和代码质量"},{"href":"/zh/code-security/reference","title":"Reference"},{"href":"/zh/code-security/reference/code-scanning","title":"代码扫描"},{"href":"/zh/code-security/reference/code-scanning/troubleshoot-analysis-errors","title":"排查与解决分析错误"},{"href":"/zh/code-security/reference/code-scanning/troubleshoot-analysis-errors/alerts-in-generated-code","title":"生成的代码中的警报"}],"documentType":"article"},"body":"# 在生成的代码中找到的警报\n\n使用 code scanning 分析代码时，你可能希望仅生成要分析的代码。\n\n在使用 `build-mode: autobuild` 或 `build-mode: manual` 时，对于 Java、Kotlin、Go、C、C++ 和 C# 等已编译语言，CodeQL 将分析在工作流运行期间构建的所有代码。 要限制要分析的代码量，请通过在 `run` 块中指定自己的生成步骤，仅生成要分析的代码。 可以将指定自己的生成步骤与对 `paths` 和 `paths-ignore` 事件使用 `pull_request` 或 `push` 筛选器相结合，以确保工作流仅在特定代码更改时运行。 有关详细信息，请参阅“[GitHub Actions 的工作流语法](/zh/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore)”。\n\n对于 JavaScript、Python 和 TypeScript 等语言，CodeQL 在不编译源代码的情况下进行分析，或者对于使用编译的语言 `build-mode: none`，可以指定其他配置选项来限制要分析的代码量。 有关详细信息，请参阅“[代码扫描的工作流配置选项](/zh/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning#specifying-directories-to-scan)”。"}