Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Ignore comments within String constants

Open
#81 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java, kotlin
Domain
testing

Research direction

Start with CommentTracker.kt lines 51-54 and SourceFile.kt lines 83-87, then reproduce the Java text-block example where // selfieonce appears inside a string constant. Trace how comments are recognized and verify that comment-like text within string constants is not treated as a comment or forbidden snapshot value.

Written by the indexing model from the issue text.

Description

bug

This code is too simple.

https://github.com/diffplug/selfie/blob/6c3d0ee489152ff87aff5251b05e75314491ad3c/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/guts/CommentTracker.kt#L51-L54

https://github.com/diffplug/selfie/blob/6c3d0ee489152ff87aff5251b05e75314491ad3c/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/guts/SourceFile.kt#L83-L87

For example:

class Test {
  @Test public void example() {
    expectSelfie("underTest").toBe("""
This is a string constant
// selfieonce
The comment above is not really a comment.
We effectively have a "forbidden value" that can't be inside inline snapshots.
     """)
  }
}
Dominant language
Kotlin
Stars
101
Forks
18
Avg merge
6d 11h
Merged PRs (30d)
5

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.

More from diffplug/selfie

All issues in diffplug/selfie

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.