Index: src/main/java/hudson/plugins/violations/types/fxcop/FxCopParser.java =================================================================== --- src/main/java/hudson/plugins/violations/types/fxcop/FxCopParser.java (revision 28082) +++ src/main/java/hudson/plugins/violations/types/fxcop/FxCopParser.java (working copy) @@ -128,7 +128,7 @@ private void parseAccessors(Element accessorsElement, String parentName) { if (accessorsElement != null) { - for (Element member : XmlElementUtil.getNamedChildElements(accessorsElement, "Accessors")) { + for (Element member : XmlElementUtil.getNamedChildElements(accessorsElement, "Accessor")) { parseMember(member, parentName); } } Index: src/test/java/hudson/plugins/violations/types/fxcop/FxCopParserTest.java =================================================================== --- src/test/java/hudson/plugins/violations/types/fxcop/FxCopParserTest.java (revision 0) +++ src/test/java/hudson/plugins/violations/types/fxcop/FxCopParserTest.java (revision 0) @@ -0,0 +1,41 @@ +package hudson.plugins.violations.types.fxcop; + +import static org.junit.Assert.*; +import hudson.plugins.violations.model.FullBuildModel; +import hudson.plugins.violations.model.Violation; +import hudson.plugins.violations.types.fxcop.FxCopParser; + +import java.io.File; +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.Iterator; + +import org.junit.Test; + +public class FxCopParserTest { + + private FullBuildModel getFullBuildModel(String filename) throws IOException { + URL url = getClass().getResource(filename); + File xmlFile; + try { + xmlFile = new File(url.toURI()); + } catch(URISyntaxException e) { + xmlFile = new File(url.getPath()); + } + + FxCopParser parser = new FxCopParser(); + FullBuildModel model = new FullBuildModel(); + parser.parse(model, xmlFile.getParentFile(), xmlFile.getName(), null); + model.cleanup(); + return model; + } + + @Test + public void testParseFullBuildModelFileStringStringArray() throws Exception { + FullBuildModel model = getFullBuildModel("fxcop.xml"); + + assertEquals("Number of violations is incorrect", 2, model.getCountNumber("fxcop")); + assertEquals("Number of files is incorrect", 2, model.getFileModelMap().size()); + } +} Index: src/test/resources/hudson/plugins/violations/types/fxcop/fxcop.xml =================================================================== --- src/test/resources/hudson/plugins/violations/types/fxcop/fxcop.xml (revision 0) +++ src/test/resources/hudson/plugins/violations/types/fxcop/fxcop.xml (revision 0) @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + Because the behavior of 'decimal.ToString(string)' could vary based on the current user's locale settings, replace this call in 'FilmFacadeBase.Price.get()' with a call to 'decimal.ToString(string, IFormatProvider)'. If the result of 'decimal.ToString(string, IFormatProvider)' will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. + + + + + + + + + + + + + + + + + + + + + + + + + In member 'MyControl.InitialParameters(bool)', the discrete term 'javascript' in parameter name 'javascript' should be expressed as a compound word, 'javaScript'. + + + + + + + + + + + + + + + Avoid uncalled private code + There is uncalled code that is not externally visible and is not a known runtime entry point. If this violation fires in error, please send a problem report to the Visual Studio Code Analysis team. + {0} appears to have no upstream public or protected callers. + + http://msdn2.microsoft.com/library/ms182264(VS.90).aspx + [none] + Warning + + + + Compound words should be cased correctly + Avoid creating compound words from terms which exist in the dictionary as discrete terms. Do not create a compound word such as 'StopWatch' or 'PopUp'. These terms are recognized in the dictionary and should be cased as 'Stopwatch' and 'Popup'. + In member {0}, the discrete term '{1}' in parameter name {2} should be expressed as a compound word, '{3}'. + + http://msdn2.microsoft.com/library/bb264474(VS.90).aspx + [none] + Error + + + + Do not initialize unnecessarily + Do not make initializations that have already been done by the runtime. + {0} initializes field {1} of type {2} to {3}. Remove this initialization because it will be done automatically by the runtime. + + http://msdn2.microsoft.com/library/ms182274(VS.90).aspx + [none] + Warning + + + + Instantiate argument exceptions correctly + String arguments passed to constructors of ArgumentException and its derived types should be correct. Types derived from ArgumentException have inconsistent constructor overloads with respect to the message and paramName parameters as compared to ArgumentException. + Method {0} passes '{1}' as the {2} argument to a {3} constructor. Replace this argument with one of the method's parameter names. Note that the provided parameter name should have the exact casing as declared on the method. + + http://msdn2.microsoft.com/library/ms182347(VS.90).aspx + [none] + CriticalError + + + + Specify CultureInfo + If an overload exists that takes a CultureInfo argument, it should always be called in favor of an overload that does not. The CultureInfo type contains culture-specific information required for performing numeric and string operations, such as casing, formatting, and string comparisons. In scenarios where conversion and parsing behavior should never change between cultures, specify CultureInfo.InvariantCulture, otherwise, specify CultureInfo.CurrentCulture. + Because the behavior of {0} could vary based on the current user's locale settings, replace this call in {1} with a call to {2}. If the result of {2} will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'CultureInfo' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. + + http://msdn2.microsoft.com/library/ms182189(VS.90).aspx + [none] + Error + + + + Specify IFormatProvider + If an overload exists that takes an IFormatProvider argument, it should always be called in favor of an overload that does not. Some methods in the runtime convert a value to or from a string representation and take a string parameter that contains one or more characters, called format specifiers, which indicate how the value is to be converted. If the meaning of the format specifier varies by culture, a formatting object supplies the actual characters used in the string representation. In scenarios where sorting and comparison behavior should never change between cultures, specify CultureInfo.InvariantCulture, otherwise, specify CultureInfo.CurrentCulture. + Because the behavior of {0} could vary based on the current user's locale settings, replace this call in {1} with a call to {2}. If the result of {2} will be displayed to the user, specify 'CultureInfo.CurrentCulture' as the 'IFormatProvider' parameter. Otherwise, if the result will be stored and accessed by software, such as when it is persisted to disk or to a database, specify 'CultureInfo.InvariantCulture'. + + http://msdn2.microsoft.com/library/ms182190(VS.90).aspx + [none] + Error + + + + Use preferred terms + Use preferred terms over deprecated alternates. + Replace the term '{0}' in type name {1} with the preferred alternate '{2}'. + + http://msdn2.microsoft.com/library/ms182258(VS.90).aspx + [none] + Error + + + + + Category + Certainty + Collapse All + Check Id + Error + error(s) + Expand All + Help + Line + message(s) + [Location not stored in Pdb] + Project + Resolution + Rule + Rule File + Rule Description + Source + Status + Target + Warning + warning(s) + Code Analysis Report + +