Skip to content

SemanticDB not generated for test classes when running fix command #3640

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

Closed
ifmachado opened this issue Apr 15, 2025 · 0 comments · Fixed by #3641
Closed

SemanticDB not generated for test classes when running fix command #3640

ifmachado opened this issue Apr 15, 2025 · 0 comments · Fixed by #3641
Assignees
Labels
bug Something isn't working experimental Tickets tied to experimental features. scalafix Issues tied with scalafix integration subcommand:fix issues tied to the `fix` sub-command.

Comments

@ifmachado
Copy link

Version(s)
scala-cli: 1.7.1
scala: 2.13.16

Describe the bug
SemanticDB not generated for test classes when running fix command.

error: SemanticDB not found: src/test/scala/com/example/calculator/SimpleCalculatorSpec.scala

Image

To Reproduce
I created this sample project: https://github.com/ifmachado/sampleScalaCli

But the must haves are:

  1. Must have files in src/test.

  2. In .scalafix.conf:

rules = [
  DisableSyntax,
  LeakingImplicitClassVal,
  NoValInForComprehension,
  ExplicitResultTypes,
  OrganizeImports
]

PS: For the first 3 rules there aren't any issues when running the fix command.
It's only when adding rules that require a semanticDB (such as ExplicitResultTypes, OrganizeImports) that the issue arises.

  1. Run:
    scala-cli fix . --power

    Got:

    The `fix` sub-command is experimental
    Please bear in mind that non-ideal user experience should be expected.
    If you encounter any bugs or have feedback to share, make sure to reach out to the maintenance team at https://github.com/VirtusLab/scala-cli
    Running built-in rules...
    Writing project.scala
    Built-in rules completed.
    Running scalafix rules...
    Compiling project (Scala 2.13.16, JVM (21))
    Compiled project (Scala 2.13.16, JVM (21))
    error: SemanticDB not found: src/test/scala/com/example/calculator/SimpleCalculatorSpec.scala
    

Expected behaviour
Rules are applied to the test classes as well without any issues so the fix --check also passes.

@ifmachado ifmachado added the bug Something isn't working label Apr 15, 2025
@Gedochao Gedochao added experimental Tickets tied to experimental features. subcommand:fix issues tied to the `fix` sub-command. scalafix Issues tied with scalafix integration labels Apr 15, 2025
@Gedochao Gedochao self-assigned this Apr 15, 2025
@Gedochao Gedochao moved this from To do to In progress in Scala CLI Board Apr 15, 2025
@github-project-automation github-project-automation bot moved this from In progress to Done in Scala CLI Board Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working experimental Tickets tied to experimental features. scalafix Issues tied with scalafix integration subcommand:fix issues tied to the `fix` sub-command.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants