SonarQube Eclipse
  1. SonarQube Eclipse
  2. SONARIDE-209

Divide source code for tests and main source code

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.0
    • Component/s: Local Mode, Unit Tests
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Currently source code for tests analysed as a main source code (see JavaProjectConfigurator).

        Issue Links

          Activity

          Hide
          Jean-Noel Rouvignac added a comment -

          I am coming here from SONAR-1076 .

          Freddy wrote there that Sonar Eclipse Plugin running analysis on the tests is a limitation of the IDE, but I do not think it is a limitation. To me tests are as important as application code and they should show the same level of good design, code reuse, loose coupling, etc. because maintaining the tests is also a burden of the developer.

          So I am not sure on what this issue is about?

          Show
          Jean-Noel Rouvignac added a comment - I am coming here from SONAR-1076 . Freddy wrote there that Sonar Eclipse Plugin running analysis on the tests is a limitation of the IDE, but I do not think it is a limitation. To me tests are as important as application code and they should show the same level of good design, code reuse, loose coupling, etc. because maintaining the tests is also a burden of the developer. So I am not sure on what this issue is about?
          Hide
          Eduardo Simioni added a comment -

          I fully agree that test code should be as lean and as reusable as possible, but let's be honest here. Test code is far from having a structure that resembles the system code. It is a lot more monolithic.
          Sonar itself doesn't analyze test code for a good reason. Why should the Eclipse Plugin do?
          If you have a good coverage normally 99% of the violations will be in the test code, and the Problems View of Eclipse gets messed because you cannot distinguish between application code and test code.
          This issue should be fixed, or at least there should be an option to analyze test code or not.

          Show
          Eduardo Simioni added a comment - I fully agree that test code should be as lean and as reusable as possible, but let's be honest here. Test code is far from having a structure that resembles the system code. It is a lot more monolithic. Sonar itself doesn't analyze test code for a good reason. Why should the Eclipse Plugin do? If you have a good coverage normally 99% of the violations will be in the test code, and the Problems View of Eclipse gets messed because you cannot distinguish between application code and test code. This issue should be fixed, or at least there should be an option to analyze test code or not.
          Hide
          Julien HENRY added a comment -

          As a first implementation I simply look in the path of the source folder if it contains the string "test" to decide if it is a main or a test folder.

          Later we could provide a pluggable extension point to let users configure the way to decide how to know the nature of a source folder. Or simply let user configure a regexp in the Sonar Eclipse preferences.

          Show
          Julien HENRY added a comment - As a first implementation I simply look in the path of the source folder if it contains the string "test" to decide if it is a main or a test folder. Later we could provide a pluggable extension point to let users configure the way to decide how to know the nature of a source folder. Or simply let user configure a regexp in the Sonar Eclipse preferences.
          Hide
          Freddy Mallet added a comment -

          Manually tested !

          Show
          Freddy Mallet added a comment - Manually tested !
          Hide
          Julien HENRY added a comment -

          IT added.

          Show
          Julien HENRY added a comment - IT added.

            People

            • Assignee:
              Julien HENRY
              Reporter:
              Evgeny Mandrikov
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: