Semantics of test file regular expressions in new Eclipse versions

  • Eclipse: 4.11.0 (2019-03)
  • SonarLint for Eclipse 4.1.0.201901311043

Given

  • a Java project with only src/main/java
  • Some files in src/main/java that should be treated as test sources (being rather testutils such as abstract test superclasses)
  • A regex for test file patterns is configured for these files in the preferences as described in the FAQ

When

Then unexpectedly

  • Regex is not respected but only the result of the IFileTypeProvider
  • Files are classified as NOT TEST.

But should be

  • Files are classified as TEST

Suggested change in rules for classification

  1. if in test-Folder =>treat as TEST
  2. if in MAIN-folder or UNKNOWN-folder => treat as MAIN unless regex matches

Sorry for the late reply. After much discussion in my team, we have decided to consider your suggestion:
https://jira.sonarsource.com/browse/SLE-335

Thanks for informing me about the progress.