Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
rules = [OrganizeImports]
*/

package test.organizeImports

import z.Z // commentZ

import a.A

object InlineCommentMoves {
val keep = (null: AnyRef)
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The imports z.Z and a.A are declared but not used in the object body (only val keep = (null: AnyRef) is defined). Without explicitly setting removeUnused = false in the configuration, these imports may be removed during the test execution if unused import removal is enabled by default. Consider either:

  1. Adding OrganizeImports.removeUnused = false to the configuration block, or
  2. Using the imported classes in the object body (e.g., val keep: A = ???)
Suggested change
val keep = (null: AnyRef)
val keep: A = ??? // use imported class A to prevent unused import removal

Copilot uses AI. Check for mistakes.
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
rules = [OrganizeImports]
*/

package test.organizeImports

import b.B // bnote

import a.A // anote

object InlineCommentMultiple {
val keep = 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we can remove that if removeUnused is not tested

Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The imports a.A, b.B, and c.C are declared but not used in the object body (only val keep = 1 is defined). Without explicitly setting removeUnused = false in the configuration, these imports may be removed during the test execution if unused import removal is enabled by default. Consider either:

  1. Adding OrganizeImports.removeUnused = false to the configuration block, or
  2. Using the imported classes in the object body (e.g., val keep: A = ???)
Suggested change
val keep = 1
val keep = 1
val keepA: a.A = ??? // use a.A to keep import
val keepB: b.B = ??? // use b.B to keep import

Copilot uses AI. Check for mistakes.
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
rules = [OrganizeImports]
OrganizeImports.removeUnused = true
*/

package test.organizeImports

import my.pkg.K // noteK

import other.P

object InlineCommentRemoved {
val keep: P = null.asInstanceOf[P]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
rules = [OrganizeImports]
*/

package test.organizeImports

// This comment is ambiguous and not linked to a specific import
import y.Y
import x.X

object StandaloneComment {
val keep = new X
val alsoKeep = new Y
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package test.organizeImports

import a.A
import z.Z // commentZ

object InlineCommentMoves {
val keep = (null: AnyRef)
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package test.organizeImports

import a.A // anote
import b.B // bnote
import c.C

object InlineCommentMultiple {
val keep = 1
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package test.organizeImports

import other.P

object InlineCommentRemoved {
val keep: P = null.asInstanceOf[P]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package test.organizeImports

// This comment is ambiguous and not linked to a specific import
import x.X
import y.Y

object StandaloneComment {
val keep = new X
val alsoKeep = new Y
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package a {
class A
}

package b {
class B
}

package c {
class C
}

package z {
class Z
}

package my.pkg {
class K
}

package other {
class P
}

package x {
class X
}

package y {
class Y
}

Loading