Skip to content

Add support for adjusting the localisation namespace #170

Add support for adjusting the localisation namespace

Add support for adjusting the localisation namespace #170

GitHub Actions / Test Results (Windows) failed Mar 14, 2024 in 1s

Test Results (Windows) ❌

Tests failed

❌ TestResults-Windows.trx

47 tests were completed in 7s with 46 passed, 1 failed and 0 skipped.

Test suite Passed Failed Skipped Time
LocalisationAnalyser.Tests.Analysers.ResolvedAttributeRedundantNullabilityAnalyserTests 1✔️ 3s
LocalisationAnalyser.Tests.Analysers.StringCanBeLocalisedAnalyserTests 10✔️ 3s
LocalisationAnalyser.Tests.Analysers.TextDoesNotMatchXmlDocAnalyserTests 1✔️ 3s
LocalisationAnalyser.Tests.Analysers.XmlDocDoesNotMatchTextAnalyserTests 1✔️ 3s
LocalisationAnalyser.Tests.CodeFixes.LocaliseClassStringCodeFixProviderTests 15✔️ 1❌ 4s
LocalisationAnalyser.Tests.CodeFixes.LocaliseCommonStringCodeFixProviderTests 1✔️ 5s
LocalisationAnalyser.Tests.CodeFixes.MakeTextMatchXmlDocCodeFixProviderTests 1✔️ 5s
LocalisationAnalyser.Tests.CodeFixes.MakeXmlDocMatchTextCodeFixProviderTests 1✔️ 3s
LocalisationAnalyser.Tests.Localisation.LocalisationFileTests 15✔️ 762ms

✔️ LocalisationAnalyser.Tests.Analysers.ResolvedAttributeRedundantNullabilityAnalyserTests

✔️ RunTest(name: "ResolvedAttributeRedundancy")

✔️ LocalisationAnalyser.Tests.Analysers.StringCanBeLocalisedAnalyserTests

✔️ RunTest(name: "Attribute")
✔️ RunTest(name: "BasicString")
✔️ RunTest(name: "DescriptionAttribute")
✔️ RunTest(name: "EmptyString")
✔️ RunTest(name: "InterpolatedString")
✔️ RunTest(name: "NumericString")
✔️ RunTest(name: "SettingSourceAttribute")
✔️ RunTest(name: "StringConcatenation")
✔️ RunTest(name: "VerbatimInterpolatedString")
✔️ RunTest(name: "VerbatimString")

✔️ LocalisationAnalyser.Tests.Analysers.TextDoesNotMatchXmlDocAnalyserTests

✔️ RunTest(name: "TextDoesNotMatchXmlDoc")

✔️ LocalisationAnalyser.Tests.Analysers.XmlDocDoesNotMatchTextAnalyserTests

✔️ RunTest(name: "XmlDocDoesNotMatchText")

❌ LocalisationAnalyser.Tests.CodeFixes.LocaliseClassStringCodeFixProviderTests

✔️ Check(name: "BasicString")
✔️ Check(name: "CustomLocalisationNamespace")
✔️ Check(name: "CustomPrefixNamespace")
✔️ Check(name: "CustomResourceNamespace")
✔️ Check(name: "DescriptionAttribute")
✔️ Check(name: "InterpolatedString")
✔️ Check(name: "InterpolatedStringWithQuotes")
❌ Check(name: "LicenseHeader")
	Context: Iterative code fix application
	content of 'C:\Localisation\ProgramStrings.cs' did not match. Diff shown with expected as baseline:
	 // This is a custom license header
	 // This is line 2
	 
	 using osu.Framework.Localisation;
	 
	 namespace TestProject.Localisation
	 {
	     public static class ProgramStrings
	     {
	         private const string prefix = @"TestProject.Localisation.Program";
	 
	         /// <summary>
	         /// "abc"
	         /// </summary>
	         public static LocalisableString Abc => new TranslatableString(getKey(@"abc"), @"abc");
	 
	         private static string getKey(string key) => $@"{prefix}:{key}";
	     }
	 }
	
	Expected: True
	Actual:   False
✔️ Check(name: "LongString")
✔️ Check(name: "NestedClass")
✔️ Check(name: "SequentialCapitals")
✔️ Check(name: "SettingSourceAttribute")
✔️ Check(name: "StringWithApostrophe")
✔️ Check(name: "VerbatimString")
✔️ CheckWithBrokenAnalyzerConfigFiles(name: "CustomFileNamespace")
✔️ CheckWithBrokenAnalyzerConfigFiles(name: "CustomPrefixNamespace")

✔️ LocalisationAnalyser.Tests.CodeFixes.LocaliseCommonStringCodeFixProviderTests

✔️ Check(name: "CommonBasicString")

✔️ LocalisationAnalyser.Tests.CodeFixes.MakeTextMatchXmlDocCodeFixProviderTests

✔️ Check(name: "MakeTextMatchXmlDoc")

✔️ LocalisationAnalyser.Tests.CodeFixes.MakeXmlDocMatchTextCodeFixProviderTests

✔️ Check(name: "MakeXmlDocMatchText")

✔️ LocalisationAnalyser.Tests.Localisation.LocalisationFileTests

✔️ CheckMethodMemberIsReadCorrectly
✔️ CheckPropertyMemberIsReadCorrectly
✔️ CheckVerbatimStringIsConvertedToLiteral
✔️ ClassGeneratedForNoFile
✔️ CustomXmlDoc
✔️ EmptyFileContainsNoMembers
✔️ EncodeEnglishStringIntoXmlDoc
✔️ FileIsNotChangedAfterReSaving
✔️ MethodIsGeneratedFromParameters
✔️ MultiLineEnglishTextGeneratesMultipleXmlDocLines
✔️ PropertyIsGeneratedFromNoParameters
✔️ ReservedKeywordIsPrefixed
✔️ XmlDocIsHtmlDecoded
✔️ XmlDocWithNewlines
✔️ XmlDocWithXmlEntities

Annotations

Check failure on line 68 in LocalisationAnalyser.Tests/Verifiers/CSharpCodeFixVerifier.cs

See this annotation in the file changed.

@github-actions github-actions / Test Results (Windows)

LocalisationAnalyser.Tests.CodeFixes.LocaliseClassStringCodeFixProviderTests ► Check(name: "LicenseHeader")

Failed test found in:
  TestResults-Windows.trx
Error:
  Context: Iterative code fix application
  content of 'C:\Localisation\ProgramStrings.cs' did not match. Diff shown with expected as baseline:
   // This is a custom license header
   // This is line 2
   
   using osu.Framework.Localisation;
   
   namespace TestProject.Localisation
   {
       public static class ProgramStrings
       {
           private const string prefix = @"TestProject.Localisation.Program";
   
           /// <summary>
           /// "abc"
           /// </summary>
           public static LocalisableString Abc => new TranslatableString(getKey(@"abc"), @"abc");
   
           private static string getKey(string key) => $@"{prefix}:{key}";
       }
   }
  
  Expected: True
  Actual:   False
Raw output
Context: Iterative code fix application
content of 'C:\Localisation\ProgramStrings.cs' did not match. Diff shown with expected as baseline:
 // This is a custom license header
 // This is line 2
 
 using osu.Framework.Localisation;
 
 namespace TestProject.Localisation
 {
     public static class ProgramStrings
     {
         private const string prefix = @"TestProject.Localisation.Program";
 
         /// <summary>
         /// "abc"
         /// </summary>
         public static LocalisableString Abc => new TranslatableString(getKey(@"abc"), @"abc");
 
         private static string getKey(string key) => $@"{prefix}:{key}";
     }
 }

Expected: True
Actual:   False
   at Microsoft.CodeAnalysis.Testing.Verifiers.XUnitVerifier.Fail(String message) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Testing.Verifiers.XUnit/XUnitVerifier.cs:line 87
   at Microsoft.CodeAnalysis.Testing.IVerifierExtensions.EqualOrDiff(IVerifier verifier, String expected, String actual, String message) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/Extensions/IVerifierExtensions.cs:line 56
   at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.VerifyFixAsync(String language, ImmutableArray`1 analyzers, ImmutableArray`1 codeFixProviders, SolutionState oldState, SolutionState newState, Int32 numberOfIterations, Func`10 getFixedProject, IVerifier verifier, CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 415
   at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.VerifyFixAsync(SolutionState testState, SolutionState fixedState, SolutionState batchFixedState, IVerifier verifier, CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 336
   at Microsoft.CodeAnalysis.Testing.CodeFixTest`1.RunImplAsync(CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs:line 248
   at Microsoft.CodeAnalysis.Testing.AnalyzerTest`1.RunAsync(CancellationToken cancellationToken) in /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/AnalyzerTest`1.cs:line 180
   at LocalisationAnalyser.Tests.Verifiers.CSharpCodeFixVerifier`2.VerifyCodeFixAsync(ValueTuple`2[] sources, DiagnosticResult[] expected, ValueTuple`2[] fixedSources, Boolean brokenAnalyserConfigFiles) in D:\a\osu-localisation-analyser\osu-localisation-analyser\LocalisationAnalyser.Tests\Verifiers\CSharpCodeFixVerifier.cs:line 68
   at LocalisationAnalyser.Tests.Verifiers.CSharpCodeFixVerifier`2.VerifyCodeFixAsync(ValueTuple`2[] sources, ValueTuple`2[] fixedSources, Boolean brokenAnalyserConfigFiles) in D:\a\osu-localisation-analyser\osu-localisation-analyser\LocalisationAnalyser.Tests\Verifiers\CSharpCodeFixVerifier.cs:line 20
   at LocalisationAnalyser.Tests.CodeFixes.AbstractCodeFixProviderTests.RunTest(String name, Boolean brokenAnalyserConfigFiles) in D:\a\osu-localisation-analyser\osu-localisation-analyser\LocalisationAnalyser.Tests\CodeFixes\AbstractCodeFixProviderTests.cs:line 46
   at LocalisationAnalyser.Tests.CodeFixes.LocaliseClassStringCodeFixProviderTests.Check(String name) in D:\a\osu-localisation-analyser\osu-localisation-analyser\LocalisationAnalyser.Tests\CodeFixes\LocaliseClassStringCodeFixProviderTests.cs:line 29
--- End of stack trace from previous location ---