-
-
Notifications
You must be signed in to change notification settings - Fork 374
Description
hen using Danger JS with Bitbucket Cloud and posting inline comments (with file and line parameters), Bitbucket displays a visible metadata preview at the top of each comment that includes:
- Comment count
- DangerID
- File path
- Line number
This metadata preview is visible to all users and significantly degrades the UI/UX of PR comments.
Current Behavior
When calling fail(message, file, line) or warn(message, file, line), the resulting inline comment in Bitbucket shows:
<!-- 1 failure: 🔍 Flutter Anal... 0 atenção: DangerID: danger-id-danger-bot-c872a813-0f7f-4bd5-ba3b-a; File: lib/features/branch/domain/entities/pessoa.dart; Line: 4; -->
The problem: The <!-- ... --> metadata is rendered as visible text in Bitbucket's inline comment preview, making comments look unprofessional and cluttered.
Expected Behavior
The metadata should be:
- Hidden in the UI (like GitHub does with HTML comments), OR
- Removed entirely from inline comments, OR
- Configurable via Danger configuration
Environment
- Danger JS version: 12.3.3
- Platform: Bitbucket Cloud
- danger-js platform:
@danger/bitbucket_cloud(viadanger-plugin-bitbucket-cloud) - Node version: 22.0.0
Workaround
Currently, the only workaround is to avoid inline comments entirely by calling:
fail(message)withoutfileandlineparameters
This posts general PR comments instead of inline comments, which:
- ✅ Don't show visible metadata
- ❌ Group ALL messages into a single comment (poor UX for multiple issues)
- ❌ Don't point to specific lines in the code
Impact
This issue affects all Bitbucket users who want to use inline comments with Danger JS:
- Professional image: Visible metadata makes automated comments look broken/unprofessional
- UX degradation: Users see technical metadata instead of clean, actionable feedback
- Limited functionality: Forces choice between:
- Clean comments (general, all grouped together)
- Useful comments (inline, per-line) with ugly metadata
Reproduction
- Set up Danger JS with Bitbucket Cloud
- Create a dangerfile with inline comments:
import { danger, fail } from 'danger';
const files = danger.git.modified_files;
files.forEach(file => {
if (file.endsWith('.dart')) {
fail('Missing documentation', file, 1);
}
});3. Run Danger on a PR
4. Check Bitbucket PR comments
5. Observe: Visible metadata preview in inline comments
Comparison with GitHub
On GitHub, the same code produces clean inline comments without visible metadata. The HTML comments are properly hidden.
Possible Solutions
- Remove metadata from Bitbucket inline comments entirely (simplest)
- Use Bitbucket API fields instead of HTML comments for tracking
- Make metadata optional via configuration flag
- Minify/encode metadata to make it less intrusive
Related Issues
This seems to be specific to Bitbucket's rendering of HTML comments in inline comment previews. GitHub handles this correctly by hiding HTML comments.
Question
Is this a known limitation of Bitbucket's API/UI? Are there any plans to address this? The current behavior makes inline comments nearly unusable for Bitbucket users who care about clean, professional PR feedback.
Would appreciate any guidance or workarounds! Thank you for the amazing tool! 🙏