SA1115 complains when it shouldn't

Nov 29, 2010 at 4:19 AM

It seems that with the current revision of SA1115, it will complain unless a) your code is all on one line or b) you have exactly one parameter per line. My current point of contention with it (below) is a little more complex, but still shouldn't be failing the rule as I understand it. Granted, it fails the multiple spaces rule, which is disabled for this project, but the parameters are indeed on one line after another. Even in simpler examples where the parameter is just a plain named variable (as opposed to the larger structure below), it still fails when two parameters are on the first line, and others are below.

 

// Fails:
XmlFunctions.XmlNodeIterator(xpni.Current, Bot.LogNodeWarning,
	new XPathActionDictionary()
	{
		{ "general",          this.AQGeneral },
		{ "namespacealiases", this.AQNamespaceAliases },
		{ "namespaces",       this.AQNamespaces }
	});

// Fails:
XmlFunctions.XmlNodeIterator(
	xpni.Current, Bot.LogNodeWarning,
	new XPathActionDictionary()
	{
		{ "general",          this.AQGeneral },
		{ "namespacealiases", this.AQNamespaceAliases },
		{ "namespaces",       this.AQNamespaces }
	});

// Passes:
XmlFunctions.XmlNodeIterator(
	xpni.Current,
	Bot.LogNodeWarning,
	new XPathActionDictionary()
	{
		{ "general",          this.AQGeneral },
		{ "namespacealiases", this.AQNamespaceAliases },
		{ "namespaces",       this.AQNamespaces }
	});

 

Personally, I think the last one is rather ugly and less-intuitive compared to having all but the structure on one line.