PyCQA / PyCQA/bandit

XML (JUnit) output is not recognized by Bamboo JUnit parser

Open
#712 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
8.3k
Forks
835
Avg merge
5d 3h
Merged PRs (30d)
1

Description

Describe the bug
Bandit's XML/Junit output is not recognized by the Bamboo Junit parser when there is no violation.
The reason is that the Junit parser is expecting at least one TC, which kinda makes sense.

Exact error

Failing task since test cases were expected but none were found.

To Reproduce
Steps to reproduce the behavior:

Create a report without any finding
For example

bandit . --format xml
[main]	INFO	profile include tests: None
[main]	INFO	profile exclude tests: None
[main]	INFO	cli include tests: None
[main]	INFO	cli exclude tests: None
[main]	INFO	running on Python 3.6.13
[manager]	WARNING	Skipping directory (.), use -r flag to scan contents
<?xml version='1.0' encoding='utf-8'?>
<testsuite name="bandit" tests="0" />%

Pass this result to the JUnit parser in Atlassian Bamboo.

Expected behavior
No errors from the parser side.

Bandit version

bandit 1.7.0
  python version = 3.6.13 (default, May 17 2021, 16:38:03) [GCC Apple LLVM 12.0.5 (clang-1205.0.22.9)]

Additional context
I completely understand that this may not be accepted, however, I wanted to raise this as more people may struggle with this scenario. Would be nice if we have an option to create one dummy test case that will satisfy CI.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing bandit . --format xml with no findings and inspect the generated JUnit XML, especially the empty testsuite output. Compare that result with Bamboo's JUnit parser expectation; done means a no-violation report is accepted without parser errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ci-cd
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.