Skip to content

Commit

Permalink
SA1005 Single line comment should begin with a space (dotnet#7259)
Browse files Browse the repository at this point in the history
  • Loading branch information
elachlan authored Jan 12, 2022
1 parent 32e260b commit fb700f9
Show file tree
Hide file tree
Showing 133 changed files with 468 additions and 468 deletions.
2 changes: 1 addition & 1 deletion eng/Common.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ dotnet_diagnostic.SA1003.severity = none
dotnet_diagnostic.SA1004.severity = warning

# Single line comment should begin with a space
dotnet_diagnostic.SA1005.severity = suggestion
dotnet_diagnostic.SA1005.severity = warning

# Region should not be preceded by a space
dotnet_diagnostic.SA1006.severity = warning
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void ProjectCommentFormatting()
[Fact]
public void ProjectWhitespaceFormatting()
{
// Note that there are two spaces after the <ItemGroup> tag on the second line
// Note that there are two spaces after the <ItemGroup> tag on the second line
string content = ObjectModelHelpers.CleanupFileContents(@"
<Project DefaultTargets=`Build` ToolsVersion=`msbuilddefaulttoolsversion` xmlns=`msbuildnamespace`>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void ReadNoChildren(string project)
</Project>
")]
// https://github.com/dotnet/msbuild/issues/900
//[InlineData(@"
// [InlineData(@"
// <Project xmlns='http://schemas.microsoft.com/developer/msbuild/2003' >
// <Target Name='t'>
// <ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ public void UpdateMetadataValueAsAttributeOnItemDefinition()
VerifyAssertLineByLine(expected, actual);
}

// NOTE: When https://github.com/dotnet/msbuild/issues/362 is fixed, then the expected value in XML may be:
// NOTE: When https://github.com/dotnet/msbuild/issues/362 is fixed, then the expected value in XML may be:
// &lt;&amp;>"
// instead of:
// &lt;&amp;&gt;&quot;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ public void SolutionCorrupt()
/// Open lots of projects concurrently to try to trigger problems
/// </summary>
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] //This test is platform specific for Windows
[PlatformSpecific(TestPlatforms.Windows)] // This test is platform specific for Windows
public void ConcurrentProjectOpenAndCloseThroughProject()
{
int iterations = 500;
Expand Down
10 changes: 5 additions & 5 deletions src/Build.OM.UnitTests/Definition/ProjectItem_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -781,12 +781,12 @@ private static void TestIncludeExclude(string projectContents, string[] inputFil
// exclude matches include; file is next to project file
[InlineData(ItemWithIncludeAndExclude,
@"a", // include item
@"", //path relative from projectFile. Empty string if current directory
@"", // path relative from projectFile. Empty string if current directory
@"a", //exclude item
"", //path relative from projectFile. Empty string if current directory
@"a", // exclude item
"", // path relative from projectFile. Empty string if current directory
new[] //files relative to this test's root directory. The project is one level deeper than the root.
new[] // files relative to this test's root directory. The project is one level deeper than the root.
{
@"project\a",
},
Expand Down Expand Up @@ -2095,7 +2095,7 @@ public void SetDirectMetadataShouldUpdateAlreadyExistingDirectMetadata()
}
}

// TODO: Should remove tests go in project item tests, project item instance tests, or both?
// TODO: Should remove tests go in project item tests, project item instance tests, or both?
[Fact]
public void Remove()
{
Expand Down
22 changes: 11 additions & 11 deletions src/Build.OM.UnitTests/Definition/Project_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2054,7 +2054,7 @@ public void BuildDisabled()

result.ShouldBeFalse();

mockLogger.Errors[0].Code.ShouldBe("MSB4112"); // "Security message about disabled targets need to have code MSB4112, because code in the VS Core project system depends on this. See DesignTimeBuildFeedback.cpp."
mockLogger.Errors[0].Code.ShouldBe("MSB4112"); // "Security message about disabled targets need to have code MSB4112, because code in the VS Core project system depends on this. See DesignTimeBuildFeedback.cpp."
}

/// <summary>
Expand Down Expand Up @@ -2116,9 +2116,9 @@ public void BuildEvaluationUsesCustomLoggers()

result.ShouldBeTrue();

mockLogger.WarningCount.ShouldBe(0); // "Log should not contain MSB4011 because the build logger will not receive evaluation messages."
mockLogger.WarningCount.ShouldBe(0); // "Log should not contain MSB4011 because the build logger will not receive evaluation messages."

collectionLogger.Warnings[0].Code.ShouldBe("MSB4011"); // "Log should contain MSB4011 because the project collection logger should have been used for evaluation."
collectionLogger.Warnings[0].Code.ShouldBe("MSB4011"); // "Log should contain MSB4011 because the project collection logger should have been used for evaluation."
}

/// <summary>
Expand Down Expand Up @@ -3679,25 +3679,25 @@ public void GetAllGlobsShouldFindAllExcludesAndRemoves()
}

[Theory]
// [InlineData(
// [InlineData(
// @"
//<A Include=`a;b*;c*;d*;e*;f*` Exclude=`c*;d*`/>
//<A Remove=`e*;f*`/>
//",
// <A Include=`a;b*;c*;d*;e*;f*` Exclude=`c*;d*`/>
// <A Remove=`e*;f*`/>
// ",
// new[] {"ba"},
// new[] {"a", "ca", "da", "ea", "fa"}
// )]
// [InlineData(
// @"
//<A Include=`a;b*;c*;d*;e*;f*` Exclude=`c*;d*`/>
//",
// <A Include=`a;b*;c*;d*;e*;f*` Exclude=`c*;d*`/>
// ",
// new[] {"ba", "ea", "fa"},
// new[] {"a", "ca", "da"}
// )]
// [InlineData(
// @"
//<A Include=`a;b*;c*;d*;e*;f*`/>
//",
// <A Include=`a;b*;c*;d*;e*;f*`/>
// ",
// new[] {"ba", "ca", "da", "ea", "fa"},
// new[] {"a"}
// )]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ private void CopyFromInternal(ProjectRootElement sourceProject)
// children are not copied.
Assert.Empty(newCopyFrom.View.Items);
// but attributes are (even non standard)
//Assert.Equal("2", ProjectElementLink.GetAttributeValue(existingItemGroup, "FunnyAttribute", true));
//Assert.Equal("2", ProjectElementLink.GetAttributeValue(newCopyFrom.View, "FunnyAttribute", true));
// Assert.Equal("2", ProjectElementLink.GetAttributeValue(existingItemGroup, "FunnyAttribute", true));
// Assert.Equal("2", ProjectElementLink.GetAttributeValue(newCopyFrom.View, "FunnyAttribute", true));
newCopyFrom.VerifyNotSame(ourGroup1);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public override ProjectElement ImportImpl(ProjectCollectionLinker remote)
public string DirectoryPath => this.ProjectXml.DirectoryPath;
public string FullPath { get => this.ProjectXml.FullPath; set => this.ProjectXml.FullPath = value; }
public ElementLocation ProjectFileLocation => this.ProjectXml.ProjectFileLocation;
public Encoding Encoding => this.ProjectXml.Encoding; //!! more complicated in reality when passing cross process.
public Encoding Encoding => this.ProjectXml.Encoding; // !! more complicated in reality when passing cross process.
public string RawXml => this.ProjectXml.RawXml;
public bool PreserveFormatting => this.ProjectXml.PreserveFormatting;
public MockProjectChooseElementLinkRemoter CreateChooseElement()
Expand Down
4 changes: 2 additions & 2 deletions src/Build.UnitTests/BackEnd/NodePackets_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,8 @@ private void CompareLogMessagePackets(LogMessagePacket left, LogMessagePacket ri
Assert.Equal(leftTargetFinished.Succeeded, rightTargetFinished.Succeeded);
Assert.Equal(leftTargetFinished.TargetFile, rightTargetFinished.TargetFile);
Assert.Equal(leftTargetFinished.TargetName, rightTargetFinished.TargetName);
//TODO: target output translation is a special case and is done in TranslateTargetFinishedEvent
//Assert.Equal(leftTargetFinished.TargetOutputs, rightTargetFinished.TargetOutputs);
// TODO: target output translation is a special case and is done in TranslateTargetFinishedEvent
// Assert.Equal(leftTargetFinished.TargetOutputs, rightTargetFinished.TargetOutputs);
break;

case LoggingEventType.TargetStartedEvent:
Expand Down
6 changes: 3 additions & 3 deletions src/Build.UnitTests/BackEnd/SdkResultOutOfProc_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public SdkResultOutOfProc_Tests(ITestOutputHelper output)
// Need to set this env variable to enable Process.GetCurrentProcess().Id in the project file.
_env.SetEnvironmentVariable("MSBUILDENABLEALLPROPERTYFUNCTIONS", "1");

// Set this if you need to debug the out of process build
//_env.SetEnvironmentVariable("MSBUILDDEBUGONSTART", "1");
// Set this if you need to debug the out of process build
// _env.SetEnvironmentVariable("MSBUILDDEBUGONSTART", "1");
}

public void Dispose()
Expand Down Expand Up @@ -127,7 +127,7 @@ public void RunOutOfProcBuild()
ValidateResolverResults(result);
}

// Test scenario where using an SdkResolver in a project that hasn't been evaluated
// Test scenario where using an SdkResolver in a project that hasn't been evaluated
// in the main node (which is where the SdkResolver runs). This validates that
// the SdkResult is correctly transferred between nodes.
[Fact]
Expand Down
2 changes: 1 addition & 1 deletion src/Build.UnitTests/BackEnd/TaskHost_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ internal string CustomMessage
/// </summary>
internal class MyCustomBuildEventArgsNotSerializable : CustomBuildEventArgs
{
// If binary serialization is not available, then we use a simple serializer which relies on a default constructor. So to test
// If binary serialization is not available, then we use a simple serializer which relies on a default constructor. So to test
// what happens for an event that's not serializable, don't include a default constructor.
/// <summary>
/// Default constructor
Expand Down
32 changes: 16 additions & 16 deletions src/Build.UnitTests/ConsoleLogger_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ public void SingleLineFormatNoop()

string ss = cl.IndentString(s, 0);

//should be a no-op
// should be a no-op
ss.ShouldBe($"foo{Environment.NewLine}");
}

Expand All @@ -1221,7 +1221,7 @@ public void MultilineFormatWindowsLineEndings()

string ss = cl.IndentString(s, 4);

//should convert lines to system format
// should convert lines to system format
ss.ShouldBe($" foo{Environment.NewLine} bar{Environment.NewLine} baz{Environment.NewLine} {Environment.NewLine}");
}

Expand All @@ -1233,7 +1233,7 @@ public void MultilineFormatUnixLineEndings()

string ss = cl.IndentString(s, 0);

//should convert lines to system format
// should convert lines to system format
ss.ShouldBe($"foo{Environment.NewLine}bar{Environment.NewLine}baz{Environment.NewLine}{Environment.NewLine}");
}

Expand All @@ -1247,7 +1247,7 @@ public void MultilineFormatMixedLineEndings()

string ss = cl.IndentString(s, 0);

//should convert lines to system format
// should convert lines to system format
ss.ShouldBe($"foo{Environment.NewLine}{Environment.NewLine}bar{Environment.NewLine}baz{Environment.NewLine}{Environment.NewLine}{Environment.NewLine}jazz{Environment.NewLine}razz{Environment.NewLine}{Environment.NewLine}matazz{Environment.NewLine}end{Environment.NewLine}");
}

Expand All @@ -1262,7 +1262,7 @@ public void NestedProjectMinimal()

es.Consume(new BuildStartedEventArgs("bs", null));

//Clear time dependent build started message
// Clear time dependent build started message
sc.Clear();

es.Consume(new ProjectStartedEventArgs("ps1", null, "fname1", "", null, null));
Expand Down Expand Up @@ -1303,7 +1303,7 @@ public void NestedProjectNormal()
es.Consume(new BuildStartedEventArgs("bs", null));


//Clear time dependent build started message
// Clear time dependent build started message
sc.Clear();

es.Consume(new ProjectStartedEventArgs("ps1", null, "fname1", "", null, null));
Expand Down Expand Up @@ -1941,7 +1941,7 @@ public void ResetConsoleLoggerStateTestBasic()
{
// Create an event source
EventSourceSink es = new EventSourceSink();
//Create a simulated console
// Create a simulated console
SimulatedConsole sc = new SimulatedConsole();

// error and warning string for 1 error and 1 warning
Expand Down Expand Up @@ -2031,7 +2031,7 @@ public void ResetConsoleLoggerState_Initialize()
{
// Create an event source
EventSourceSink es = new EventSourceSink();
//Create a simulated console
// Create a simulated console
SimulatedConsole sc = new SimulatedConsole();

// error and warning string for 1 error and 1 warning
Expand Down Expand Up @@ -2121,7 +2121,7 @@ public void ResetConsoleLoggerState_PerformanceCounters()
for (int i = 1; i <= 2; i++)
{
EventSourceSink es = new EventSourceSink();
//Create a simulated console
// Create a simulated console
SimulatedConsole sc = new SimulatedConsole();
// Create a ConsoleLogger with Normal verbosity
ConsoleLogger L = new ConsoleLogger(LoggerVerbosity.Normal, sc.Write, sc.SetColor, sc.ResetColor);
Expand All @@ -2137,7 +2137,7 @@ public void ResetConsoleLoggerState_PerformanceCounters()

// BuildStarted Event
es.Consume(new BuildStartedEventArgs("bs", null));
//Project Started Event
// Project Started Event
ProjectStartedEventArgs project1Started = new ProjectStartedEventArgs(1, null, null, "p", "t", null, null, new BuildEventContext(BuildEventContext.InvalidNodeId, BuildEventContext.InvalidTargetId, BuildEventContext.InvalidProjectContextId, BuildEventContext.InvalidTaskId));
project1Started.BuildEventContext = new BuildEventContext(1, 1, 1, 1);
es.Consume(project1Started);
Expand Down Expand Up @@ -2166,7 +2166,7 @@ public void ResetConsoleLoggerState_PerformanceCounters()
es.Consume(targetFinished1);

ProjectStartedEventArgs project2Started = new ProjectStartedEventArgs(2, null, null, "p2", "t2", null, null, project1Started.BuildEventContext);
//Project Started Event
// Project Started Event
project2Started.BuildEventContext = new BuildEventContext(2, 2, 2, 2);
es.Consume(project2Started);
TargetStartedEventArgs targetStarted2 = new TargetStartedEventArgs(null, null, "t2", null, null);
Expand Down Expand Up @@ -2246,7 +2246,7 @@ public void ResetConsoleLoggerState_PerformanceCounters()
public void DeferredMessages()
{
EventSourceSink es = new EventSourceSink();
//Create a simulated console
// Create a simulated console
SimulatedConsole sc = new SimulatedConsole();
// Create a ConsoleLogger with Detailed verbosity
ConsoleLogger L = new ConsoleLogger(LoggerVerbosity.Detailed, sc.Write, sc.SetColor, sc.ResetColor);
Expand Down Expand Up @@ -2298,11 +2298,11 @@ public void VerifyMPLoggerSwitch()
for (int i = 0; i < 2; i++)
{
EventSourceSink es = new EventSourceSink();
//Create a simulated console
// Create a simulated console
SimulatedConsole sc = new SimulatedConsole();
// Create a ConsoleLogger with Normal verbosity
ConsoleLogger L = new ConsoleLogger(LoggerVerbosity.Normal, sc.Write, sc.SetColor, sc.ResetColor);
//Make sure the MPLogger switch will property work on both Initialize methods
// Make sure the MPLogger switch will property work on both Initialize methods
L.Parameters = "EnableMPLogging";
if (i == 0)
{
Expand Down Expand Up @@ -2337,7 +2337,7 @@ public void VerifyMPLoggerSwitch()
public void TestPrintTargetNamePerMessage()
{
EventSourceSink es = new EventSourceSink();
//Create a simulated console
// Create a simulated console
SimulatedConsole sc = new SimulatedConsole();
// Create a ConsoleLogger with Normal verbosity
ConsoleLogger L = new ConsoleLogger(LoggerVerbosity.Normal, sc.Write, sc.SetColor, sc.ResetColor);
Expand Down Expand Up @@ -2391,7 +2391,7 @@ public void TestNewLineAfterProjectFinished()


EventSourceSink es = new EventSourceSink();
//Create a simulated console
// Create a simulated console
SimulatedConsole sc = new SimulatedConsole();
ConsoleLogger L = new ConsoleLogger(LoggerVerbosity.Normal, sc.Write, sc.SetColor, sc.ResetColor);

Expand Down
Loading

0 comments on commit fb700f9

Please sign in to comment.