Skip to content

Commit

Permalink
Detect duplicates among closed issues too
Browse files Browse the repository at this point in the history
  • Loading branch information
FWDekker committed Oct 13, 2024
1 parent 68e251c commit a1cf531
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Changelog
## 9.9.9-unreleased
### Fixed
* Fixed bug reported to also check closed issues when checking for duplicates.


## 3.3.2 -- 2024-09-28
### Added
* Added even more debug info for future reports relating to issue [#R1](https://github.com/FWDekkerBot/intellij-randomness-issues/issues/1).
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
group=com.fwdekker
# Version number should also be updated in `com.fwdekker.randomness.PersistentSettings.Companion.CURRENT_VERSION`.
version=3.3.2
version=3.3.3-dev

# Compatibility
# * `pluginSinceBuild`:
Expand Down
9 changes: 5 additions & 4 deletions src/main/kotlin/com/fwdekker/randomness/ErrorReporter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ private class GitHubReporter {
fun report(issueData: IssueData): SubmittedReportInfo =
try {
synchronized(this) {
val duplicate = issueService.pageIssues(repo).flatSequence().firstOrNull { issueData.isDuplicateOf(it) }
val duplicate = issueService.pageIssues(repo, mapOf("state" to "all"))
.flatSequence()
.firstOrNull { issueData.isDuplicateOf(it) }

val context: Issue
if (duplicate == null) {
Expand Down Expand Up @@ -365,7 +367,6 @@ private class IssueData(
- Randomness version: ${pluginDescriptor.version ?: "_Unknown_"}
- IDE version: ${ApplicationInfo.getInstance().apiVersion}
- Operating system: ${SystemInfo.OS_NAME}
- Java version: ${SystemInfo.JAVA_VERSION}
""".trimIndent()
)
.joinToString(separator = "\n\n") { section(it.first, it.second) }
Expand All @@ -385,8 +386,8 @@ private class IssueData(
/**
* Returns `true` if and only if this [IssueData] is (likely) a duplicate of the existing [Issue].
*/
fun isDuplicateOf(issue: Issue): Boolean =
issue.title.takeWhile { it != ']' } == title.takeWhile { it != ']' }
fun isDuplicateOf(other: Issue): Boolean =
this.title.takeWhile { it != ']' } == other.title.takeWhile { it != ']' }


/**
Expand Down

0 comments on commit a1cf531

Please sign in to comment.