Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix UnusedConstructorParams #225

Merged
merged 2 commits into from
Oct 30, 2024
Merged
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,6 @@
/*
rule = UnusedConstructorParams
*/
package fix

class A6(val x: Int)(using x2: String)
2 changes: 2 additions & 0 deletions input/src/main/scala/fix/UnusedConstructorParamsTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ class A2(x: Int) // assert: UnusedConstructorParams
class A3(`type`: Int) extends A1(`type`)

class A4(var x: Int)

class A5(val x: Int)(implicit x2: String)
10 changes: 0 additions & 10 deletions output/src/main/scala/fix/UnusedConstructorParamsTest.scala

This file was deleted.

1 change: 1 addition & 0 deletions rules/src/main/scala/fix/UnusedConstructorParams.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class UnusedConstructorParams extends SyntacticRule("UnusedConstructorParams") {
case x: Defn.Class if !x.mods.exists(_.is[Mod.Case]) =>
val params = x.ctor.paramClauses.flatten
.filterNot(_.mods.exists(_.is[Mod.Implicit]))
.filterNot(_.mods.exists(_.is[Mod.Using]))
.filterNot(_.mods.exists(_.is[Mod.VarParam]))
.filterNot(_.mods.exists(_.is[Mod.ValParam]))
val allTokens = {
Expand Down