Skip to content

Commit

Permalink
Cannot connect SonarLint to SonarQube in 6.7.0.52071 (#3251)
Browse files Browse the repository at this point in the history
  • Loading branch information
ugras-ergun-sonarsource authored and rita-gorokhod committed Sep 23, 2022
1 parent 7e515de commit 0d4206b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ public void GetAnalysisLanguageFromExtension_ReturnsAnalysisLangFromExtension(st

[DataRow("File.json")]
[DataRow("Folder")]
[DataRow("<SharedProject>")] //Shared projects in .Net Framework are represented by <>
[TestMethod]
public void GetAnalysisLanguageFromExtension_UnknownExtensionPassed_ReturnsNull(string fileName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ private static bool IsTypeScriptDocument(IEnumerable<IContentType> contentTypes)

public AnalysisLanguage? GetAnalysisLanguageFromExtension(string fileName)
{
if(IsFileNameInvalid(fileName))
{
return null;
}

var extension = GetNormalizedExtention(fileName);

// ContentType for "js" is typescript we do manual check to be consistent with Detect method
Expand Down Expand Up @@ -154,6 +159,7 @@ private string GetNormalizedExtention(string fileName)
return extension.ToLowerInvariant();
}


}
private bool IsFileNameInvalid(string fileName)
=> Path.GetInvalidFileNameChars().Any(x => fileName.Contains(x));
}
}

0 comments on commit 0d4206b

Please sign in to comment.