Uploaded image for project: 'SonarLint For IntelliJ'
  1. SonarLint For IntelliJ
  2. SLI-630

The wrong base dir is used when attaching a project or importing a module

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      We observe different results when a file is analyzed either in a dedicated project or in an attached project.

      Example with 2 separate TS projects, app1 and app2.

      Scenario 1: open app2 as a project and analyze a subfile:

      > baseDir: C:\sonarlint-test\app2
      > Found 1 tsconfig.json file(s): [C:\sonarlint-test\app2\tsconfig.json]
      C:/sonarlint-test/app2/src/app/test.component.ts matched C:\sonarlint-test\app2\tsconfig.json

      Scenario 2: open app1 as a project, attach app2 and analyze the same subfile:

      > baseDir: C:\sonarlint-test\app1
      > Found 1 tsconfig.json file(s): [C:\sonarlint-test\app-1\tsconfig.json]
      C:/sonarlint-test/app-2/src/app/test.component.ts matched NO_CONFIG

       

      For the base dir we use the folder of the first opened project. We wrongly detect the tsconfig.json file of the first opened project (app1) instead of the attached one (app2), and the file that we try to analyze is excluded by the TS analyzer.

       

      The concept of base dir does not make sense in this context. In IntelliJ, source files of a module are contained in "source roots", and modules can have several ones, so in theory we could have several base dirs. It might be better to not rely on the base dir to locate the tsconfig file.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            damien.urruty Damien Urruty
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated: