False positive — CodeQL failing due to lack of Python files when they only exist on the `main` branch
- 主要言語
- CodeQL
- スター
- 10.1k
- フォーク
- 2.1k
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 141
説明
**Description of the false positive**
Hi, I encountered a weird issue with CodeQL. My pull request is based on a slightly older version of the codebase, which did not have any Python files. However, there is now a single Python file in `main`. CodeQL runs, but fails due to lack of Python files, which blocks a perfectly valid PR.
Unfortunately, the code is private, so I am not able to share the repository, but the `main` branch contains a Python script in `scripts/`, while the PR version of the codebase doesn't.
The exact error is
```
/opt/hostedtoolcache/CodeQL/2.23.8/x64/codeql/codeql database finalize --finalize-dataset --threads=2 --ram=6920 /home/runner/work/_temp/codeql_databases/python
CodeQL detected code written in C/C++, Swift, GitHub Actions and Java/Kotlin, but not any written in Python. Confirm that there is some source code for Python in the project. For more information, review our troubleshooting guide at https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build .
Error: Encountered a fatal error while running "/opt/hostedtoolcache/CodeQL/2.23.8/x64/codeql/codeql database finalize --finalize-dataset --threads=2 --ram=6920 /home/runner/work/_temp/codeql_databases/python". Exit code was 32 and last log line was: CodeQL detected code written in C/C++, Swift, GitHub Actions and Java/Kotlin, but not any written in Python. Confirm that there is some source code for Python in the project. For more information, review our troubleshooting guide at https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build . See the logs for more details.
```
I don't believe that CodeQL should be configured to run on file types that do not exist on a given branch. This can be fixed in a pretty simple way — rebasing the branch on top of HEAD, but still, I don't believe this should be a cause for failure in the first place.
コントリビューションガイド
調査の方向性
Reproduce the failure with a pull request whose older base lacks Python while main contains a script in scripts/. Start with the CodeQL database finalization error and the linked no-source-code troubleshooting guide; done means a valid pull request does not fail solely because Python exists only on main.
索引モデルが issue の本文から書いたものです。
評価
- 領域
- security
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100