From 94f3d3445edce722399289d894d6a8025a38c3d5 Mon Sep 17 00:00:00 2001 From: Anthony DeMartini Date: Mon, 21 Apr 2014 14:14:04 -0400 Subject: [PATCH 1/6] Fixed XML encoding issue for defect descriptions Some defect descriptions in XML reports had invalid characters. --- gendarme/console/XmlResultWriter.cs | 105 +++++++++++++++++++++++++++- 1 file changed, 104 insertions(+), 1 deletion(-) diff --git a/gendarme/console/XmlResultWriter.cs b/gendarme/console/XmlResultWriter.cs index 3dcdff145..05465a0a8 100644 --- a/gendarme/console/XmlResultWriter.cs +++ b/gendarme/console/XmlResultWriter.cs @@ -42,6 +42,7 @@ using Gendarme.Framework; using Gendarme.Framework.Rocks; +using System.Collections.Generic; namespace Gendarme { @@ -181,7 +182,9 @@ void CreateElement (Defect defect) writer.WriteAttributeString ("Confidence", defect.Confidence.ToString ()); writer.WriteAttributeString ("Location", defect.Location.ToString ()); writer.WriteAttributeString ("Source", defect.Source); - writer.WriteString (defect.Text); + //Built-in .net encoding for XML strings doesn't appear to handle all cases, so + //we need an alternative approach. + writer.WriteRaw(XmlTextEncoder.Encode(defect.Text)); writer.WriteEndElement (); } @@ -203,5 +206,105 @@ protected override void Dispose (bool disposing) writer = null; } } + + /// + /// Borrowed from mkropat's .NET-Snippets: + /// https://github.com/mkropat/.NET-Snippets/blob/master/XmlTextEncoder.cs + /// Encodes data so that it can be safely embedded as text in XML documents. + /// + public class XmlTextEncoder : TextReader + { + public static string Encode(string s) + { + using (var stream = new StringReader(s)) + using (var encoder = new XmlTextEncoder(stream)) + { + return encoder.ReadToEnd(); + } + } + + /// The data to be encoded in UTF-16 format. + /// It is illegal to encode certain + /// characters in XML. If true, silently omit these characters from the + /// output; if false, throw an error when encountered. + public XmlTextEncoder(TextReader source, bool filterIllegalChars = true) + { + _source = source; + _filterIllegalChars = filterIllegalChars; + } + + readonly Queue _buf = new Queue(); + readonly bool _filterIllegalChars; + readonly TextReader _source; + + public override int Peek() + { + PopulateBuffer(); + if (_buf.Count == 0) return -1; + return _buf.Peek(); + } + + public override int Read() + { + PopulateBuffer(); + if (_buf.Count == 0) return -1; + return _buf.Dequeue(); + } + + void PopulateBuffer() + { + const int endSentinel = -1; + while (_buf.Count == 0 && _source.Peek() != endSentinel) + { + // Strings in .NET are assumed to be UTF-16 encoded [1]. + var c = (char)_source.Read(); + if (Entities.ContainsKey(c)) + { + // Encode all entities defined in the XML spec [2]. + foreach (var i in Entities[c]) _buf.Enqueue(i); + } + else if (!(0x0 <= c && c <= 0x8) && + !new[] { 0xB, 0xC }.Contains(c) && + !(0xE <= c && c <= 0x1F) && + !(0x7F <= c && c <= 0x84) && + !(0x86 <= c && c <= 0x9F) && + !(0xD800 <= c && c <= 0xDFFF) && + !new[] { 0xFFFE, 0xFFFF }.Contains(c)) + { + // Allow if the Unicode codepoint is legal in XML [3]. + _buf.Enqueue(c); + } + else if (char.IsHighSurrogate(c) && + _source.Peek() != endSentinel && + char.IsLowSurrogate((char)_source.Peek())) + { + // Allow well-formed surrogate pairs [1]. + _buf.Enqueue(c); + _buf.Enqueue((char)_source.Read()); + } + else if (!_filterIllegalChars) + { + // Note that we cannot encode illegal characters as entity + // references due to the "Legal Character" constraint of + // XML [4]. Nor are they allowed in CDATA sections [5]. + throw new ArgumentException( + String.Format("Illegal character: '{0:X}'", (int)c)); + } + } + } + + static readonly Dictionary Entities = + new Dictionary { + { '"', """ }, { '&', "&"}, { '\'', "'" }, + { '<', "<" }, { '>', ">" }, + }; + + // References: + // [1] http://en.wikipedia.org/wiki/UTF-16/UCS-2 + // [2] http://www.w3.org/TR/xml11/#sec-predefined-ent + // [3] http://www.w3.org/TR/xml11/#charsets + // [4] http://www.w3.org/TR/xml11/#sec-references + // [5] http://www.w3.org/TR/xml11/#sec-cdata-sect + } } } From 14cde7ff539fb02f8b892e31143fc122eafd38bc Mon Sep 17 00:00:00 2001 From: Anthony DeMartini Date: Mon, 21 Apr 2014 16:47:27 -0400 Subject: [PATCH 2/6] Corrected parens for style guidelines --- gendarme/console/XmlResultWriter.cs | 56 ++++++++++++++--------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/gendarme/console/XmlResultWriter.cs b/gendarme/console/XmlResultWriter.cs index 05465a0a8..38d9d18c9 100644 --- a/gendarme/console/XmlResultWriter.cs +++ b/gendarme/console/XmlResultWriter.cs @@ -184,7 +184,7 @@ void CreateElement (Defect defect) writer.WriteAttributeString ("Source", defect.Source); //Built-in .net encoding for XML strings doesn't appear to handle all cases, so //we need an alternative approach. - writer.WriteRaw(XmlTextEncoder.Encode(defect.Text)); + writer.WriteRaw (XmlTextEncoder.Encode (defect.Text)); writer.WriteEndElement (); } @@ -214,12 +214,12 @@ protected override void Dispose (bool disposing) /// public class XmlTextEncoder : TextReader { - public static string Encode(string s) + public static string Encode (string s) { - using (var stream = new StringReader(s)) - using (var encoder = new XmlTextEncoder(stream)) + using (var stream = new StringReader (s)) + using (var encoder = new XmlTextEncoder (stream)) { - return encoder.ReadToEnd(); + return encoder.ReadToEnd (); } } @@ -227,68 +227,68 @@ public static string Encode(string s) /// It is illegal to encode certain /// characters in XML. If true, silently omit these characters from the /// output; if false, throw an error when encountered. - public XmlTextEncoder(TextReader source, bool filterIllegalChars = true) + public XmlTextEncoder (TextReader source, bool filterIllegalChars = true) { _source = source; _filterIllegalChars = filterIllegalChars; } - readonly Queue _buf = new Queue(); + readonly Queue _buf = new Queue (); readonly bool _filterIllegalChars; readonly TextReader _source; - public override int Peek() + public override int Peek () { - PopulateBuffer(); + PopulateBuffer (); if (_buf.Count == 0) return -1; - return _buf.Peek(); + return _buf.Peek (); } - public override int Read() + public override int Read () { - PopulateBuffer(); + PopulateBuffer (); if (_buf.Count == 0) return -1; - return _buf.Dequeue(); + return _buf.Dequeue (); } - void PopulateBuffer() + void PopulateBuffer () { const int endSentinel = -1; - while (_buf.Count == 0 && _source.Peek() != endSentinel) + while (_buf.Count == 0 && _source.Peek () != endSentinel) { // Strings in .NET are assumed to be UTF-16 encoded [1]. - var c = (char)_source.Read(); - if (Entities.ContainsKey(c)) + var c = (char)_source.Read (); + if (Entities.ContainsKey (c)) { // Encode all entities defined in the XML spec [2]. - foreach (var i in Entities[c]) _buf.Enqueue(i); + foreach (var i in Entities [c]) _buf.Enqueue (i); } else if (!(0x0 <= c && c <= 0x8) && - !new[] { 0xB, 0xC }.Contains(c) && + !new[] { 0xB, 0xC }.Contains (c) && !(0xE <= c && c <= 0x1F) && !(0x7F <= c && c <= 0x84) && !(0x86 <= c && c <= 0x9F) && !(0xD800 <= c && c <= 0xDFFF) && - !new[] { 0xFFFE, 0xFFFF }.Contains(c)) + !new[] { 0xFFFE, 0xFFFF }.Contains (c)) { // Allow if the Unicode codepoint is legal in XML [3]. - _buf.Enqueue(c); + _buf.Enqueue (c); } - else if (char.IsHighSurrogate(c) && - _source.Peek() != endSentinel && - char.IsLowSurrogate((char)_source.Peek())) + else if (char.IsHighSurrogate (c) && + _source.Peek () != endSentinel && + char.IsLowSurrogate ((char)_source.Peek ())) { // Allow well-formed surrogate pairs [1]. - _buf.Enqueue(c); - _buf.Enqueue((char)_source.Read()); + _buf.Enqueue (c); + _buf.Enqueue ((char)_source.Read ()); } else if (!_filterIllegalChars) { // Note that we cannot encode illegal characters as entity // references due to the "Legal Character" constraint of // XML [4]. Nor are they allowed in CDATA sections [5]. - throw new ArgumentException( - String.Format("Illegal character: '{0:X}'", (int)c)); + throw new ArgumentException ( + String.Format ("Illegal character: '{0:X}'", (int)c)); } } } From 1d25e89aa6e66c55697906ea8b8845bff4618512 Mon Sep 17 00:00:00 2001 From: Anthony DeMartini Date: Mon, 5 May 2014 10:49:32 -0400 Subject: [PATCH 3/6] Added unit test and license for xml encode fix --- gendarme/Tests.Gendarme/Tests.Gendarme.csproj | 69 +++++++++++++++++++ gendarme/Tests.Gendarme/XmlTextEncoderTest.cs | 48 +++++++++++++ gendarme/console/gendarme.csproj | 6 +- gendarme/gendarme-win.sln | 41 +++++++++++ 4 files changed, 159 insertions(+), 5 deletions(-) create mode 100644 gendarme/Tests.Gendarme/Tests.Gendarme.csproj create mode 100644 gendarme/Tests.Gendarme/XmlTextEncoderTest.cs diff --git a/gendarme/Tests.Gendarme/Tests.Gendarme.csproj b/gendarme/Tests.Gendarme/Tests.Gendarme.csproj new file mode 100644 index 000000000..dad9d2202 --- /dev/null +++ b/gendarme/Tests.Gendarme/Tests.Gendarme.csproj @@ -0,0 +1,69 @@ + + + + Debug + AnyCPU + + + 2.0 + {980F078D-36E7-4C5B-9738-8A0156A3D938} + Library + Properties + Tests.Gendarme + Tests.Gendarme + v4.0 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + 3.5 + + + + + + False + + + + + + + + + {E95A3AB9-A303-4859-8BCA-458C79496548} + gendarme + + + + + + + + \ No newline at end of file diff --git a/gendarme/Tests.Gendarme/XmlTextEncoderTest.cs b/gendarme/Tests.Gendarme/XmlTextEncoderTest.cs new file mode 100644 index 000000000..5aba7c3b0 --- /dev/null +++ b/gendarme/Tests.Gendarme/XmlTextEncoderTest.cs @@ -0,0 +1,48 @@ +// +// Unit Test for XmlTextEncoder +// +// Authors: +// Anthony DeMartini +// +// (C) 2014 Applied Visions +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Gendarme; +using System.Xml; +namespace Tests.Gendarme +{ + [TestClass] + public class XmlTextEncoderTest + { + [TestMethod] + public void TestEncode () + { + var result = XmlResultWriter.XmlTextEncoder.Encode ("Found string: \"\\x1\\x1\\n.\\x1\\x2\\x4.\\x3\\x2\\x1.\\x1\\x2\\x3.\\x2\\x2\\x1.\\x1\\x2\\x2.\\x3\\x2\\x2.\\x1\\x2\\x2.\\x1\\x2\\x1.\\x1\\x2\\x16.\\x1\\x2\\xb.\\x1\\x2\\x2.\\x2\\x2\\x7.\\x1\\x2\\x1.\\x2\\x2\\x1.\\x5\\x2\\x10.\\x1\\x2\\x5.\\x2\\x2\\x5.\\x1\\x2\\x1.\\x1\\x2\\t.\\x1\\x2\\xc.\\x1\\x2\\xf.\\x1\\x2\\x1.\\x4\\x2\\x5.\\x1\\x2\\x1.\\x1\\x2\\x2.\\x1\\x2\\x3.\\x1\\x2\\x3.\\x2\\x2\\x1.\\x1\\x2\\x2.\\x1\\x2\\x16.\\x1\\x2\\n.\\x1\\x2\\x3.\\x1\\x2\\x2.\\x1\\x2\\x1.\\x1\\x2\\x1.\\x7\\x2&.\\x1\\x2\\x1.\\x5\\x2\\x7.\\x1\\x2\\x14.\\x1\\x2\\x2.\\x1\\x2\\x2.\\x2\\x2\\x1.\\x2\\x2\\x18.\\x1\\x2\\x15.\\x1\\x2\\x2.\\x2\\x2\"."); + Assert.AreEqual ("Found string: "\\x1\\x1\\n.\\x1\\x2\\x4.\\x3\\x2\\x1.\\x1\\x2\\x3.\\x2\\x2\\x1.\\x1\\x2\\x2.\\x3\\x2\\x2.\\x1\\x2\\x2.\\x1\\x2\\x1.\\x1\\x2\\x16.\\x1\\x2\\xb.\\x1\\x2\\x2.\\x2\\x2\\x7.\\x1\\x2\\x1.\\x2\\x2\\x1.\\x5\\x2\\x10.\\x1\\x2\\x5.\\x2\\x2\\x5.\\x1\\x2\\x1.\\x1\\x2\\t.\\x1\\x2\\xc.\\x1\\x2\\xf.\\x1\\x2\\x1.\\x4\\x2\\x5.\\x1\\x2\\x1.\\x1\\x2\\x2.\\x1\\x2\\x3.\\x1\\x2\\x3.\\x2\\x2\\x1.\\x1\\x2\\x2.\\x1\\x2\\x16.\\x1\\x2\\n.\\x1\\x2\\x3.\\x1\\x2\\x2.\\x1\\x2\\x1.\\x1\\x2\\x1.\\x7\\x2&.\\x1\\x2\\x1.\\x5\\x2\\x7.\\x1\\x2\\x14.\\x1\\x2\\x2.\\x1\\x2\\x2.\\x2\\x2\\x1.\\x2\\x2\\x18.\\x1\\x2\\x15.\\x1\\x2\\x2.\\x2\\x2".", result); + } + } +} diff --git a/gendarme/console/gendarme.csproj b/gendarme/console/gendarme.csproj index eefae5e82..ddb55ea6a 100755 --- a/gendarme/console/gendarme.csproj +++ b/gendarme/console/gendarme.csproj @@ -138,11 +138,7 @@ --> - + diff --git a/gendarme/gendarme-win.sln b/gendarme/gendarme-win.sln index 4f0560021..dadbe2d6b 100755 --- a/gendarme/gendarme-win.sln +++ b/gendarme/gendarme-win.sln @@ -14,10 +14,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution AssemblyInfo.cs.in = AssemblyInfo.cs.in AUTHORS = AUTHORS ChangeLog = ChangeLog + gendarme-win.vsmdi = gendarme-win.vsmdi + Local.testsettings = Local.testsettings MIT.X11 = MIT.X11 NEWS = NEWS README = README TODO = TODO + TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{A208E677-6A00-4F5C-A15B-5CCA90AB78FF}" @@ -162,7 +165,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Rules.Gendarme", "rul EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil.Mdb", "..\..\cecil\symbols\mdb\Mono.Cecil.Mdb.csproj", "{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests.Gendarme", "Tests.Gendarme\Tests.Gendarme.csproj", "{980F078D-36E7-4C5B-9738-8A0156A3D938}" +EndProject Global + GlobalSection(TestCaseManagementSettings) = postSolution + CategoryFile = gendarme-win.vsmdi + EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Debug|Mixed Platforms = Debug|Mixed Platforms @@ -1879,6 +1887,38 @@ Global {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Release|Any CPU.Build.0 = net_4_0_Release|Any CPU {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Release|Mixed Platforms.ActiveCfg = net_4_0_Release|Any CPU {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Release|Mixed Platforms.Build.0 = net_4_0_Release|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.Debug|Any CPU.Build.0 = Debug|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_2_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_2_0_Debug|Any CPU.Build.0 = Debug|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_2_0_Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_2_0_Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_2_0_Release|Any CPU.ActiveCfg = Release|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_2_0_Release|Any CPU.Build.0 = Release|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_2_0_Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_2_0_Release|Mixed Platforms.Build.0 = Release|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_3_5_Debug|Any CPU.Build.0 = Debug|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_3_5_Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_3_5_Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_3_5_Release|Any CPU.ActiveCfg = Release|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_3_5_Release|Any CPU.Build.0 = Release|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_3_5_Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_3_5_Release|Mixed Platforms.Build.0 = Release|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_4_0_Debug|Any CPU.ActiveCfg = Debug|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_4_0_Debug|Any CPU.Build.0 = Debug|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_4_0_Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_4_0_Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_4_0_Release|Any CPU.ActiveCfg = Release|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_4_0_Release|Any CPU.Build.0 = Release|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_4_0_Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.net_4_0_Release|Mixed Platforms.Build.0 = Release|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.Release|Any CPU.ActiveCfg = Release|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.Release|Any CPU.Build.0 = Release|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {980F078D-36E7-4C5B-9738-8A0156A3D938}.Release|Mixed Platforms.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1928,6 +1968,7 @@ Global {0D974FFB-C19F-40D0-AD87-708D35E9BD3E} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {FE98135B-0CD0-4C0A-942D-2E5FF9E3A20F} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {C329FF89-4C07-4D72-AF5B-70B10670CB36} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} + {980F078D-36E7-4C5B-9738-8A0156A3D938} = {E83F7555-F98B-48D9-8CD6-1E46895F276D} {D68133BD-1E63-496E-9EDE-4FBDBF77B486} = {10772645-2837-44B1-9CFA-51A0A5CAC635} {63E6915C-7EA4-4D76-AB28-0D7191EEA626} = {10772645-2837-44B1-9CFA-51A0A5CAC635} {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD} = {10772645-2837-44B1-9CFA-51A0A5CAC635} From 3f86ff059a10717aaa0a9e2f073db15a4fe7892d Mon Sep 17 00:00:00 2001 From: Ryan McCauley Date: Wed, 9 Aug 2017 12:18:31 -0400 Subject: [PATCH 4/6] Update NUnit reference to 2.6.2 from Mono.Cecil 0.9.6 --- gendarme/framework/Test/Tests.Framework.csproj | 4 ++-- .../Test/Tests.Rules.BadPractice.csproj | 4 ++-- .../Test/Tests.Rules.Concurrency.csproj | 4 ++-- .../Test/Tests.Rules.Correctness.csproj | 4 ++-- .../Test/Tests.Rules.Design.Generic.csproj | 4 ++-- .../Test/Tests.Rules.Design.Linq.csproj | 4 ++-- .../Gendarme.Rules.Design/Test/Tests.Rules.Design.csproj | 4 ++-- .../Test/Tests.Rules.Exceptions.csproj | 4 ++-- .../Gendarme.Rules.Gendarme/Test/Tests.Rules.Gendarme.csproj | 4 ++-- .../Test/Tests.Rules.Globalization.csproj | 4 ++-- .../Test/Tests.Rules.Interoperability.Com.csproj | 4 ++-- .../Test/Tests.Rules.Interoperability.csproj | 4 ++-- .../Test/Tests.Rules.Maintainability.csproj | 4 ++-- .../rules/Gendarme.Rules.NUnit/Test/Tests.Rules.NUnit.csproj | 4 ++-- .../Gendarme.Rules.Naming/Test/Tests.Rules.Naming.csproj | 4 ++-- .../Test/Tests.Rules.Performance.csproj | 4 ++-- .../Test/Tests.Rules.Portability.csproj | 4 ++-- .../Test/Tests.Rules.Security.Cas.csproj | 4 ++-- .../Gendarme.Rules.Security/Test/Tests.Rules.Security.csproj | 4 ++-- .../Test/Tests.Rules.Serialization.csproj | 4 ++-- .../Gendarme.Rules.Smells/Test/Tests.Rules.Smells.csproj | 4 ++-- gendarme/rules/Gendarme.Rules.Ui/Test/Tests.Rules.Ui.csproj | 4 ++-- gendarme/rules/Test.Rules/Test.Rules.csproj | 4 ++-- 23 files changed, 46 insertions(+), 46 deletions(-) diff --git a/gendarme/framework/Test/Tests.Framework.csproj b/gendarme/framework/Test/Tests.Framework.csproj index 3e1b017f1..f87abee83 100755 --- a/gendarme/framework/Test/Tests.Framework.csproj +++ b/gendarme/framework/Test/Tests.Framework.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.BadPractice/Test/Tests.Rules.BadPractice.csproj b/gendarme/rules/Gendarme.Rules.BadPractice/Test/Tests.Rules.BadPractice.csproj index ec4cf335d..348dc68ec 100755 --- a/gendarme/rules/Gendarme.Rules.BadPractice/Test/Tests.Rules.BadPractice.csproj +++ b/gendarme/rules/Gendarme.Rules.BadPractice/Test/Tests.Rules.BadPractice.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Concurrency/Test/Tests.Rules.Concurrency.csproj b/gendarme/rules/Gendarme.Rules.Concurrency/Test/Tests.Rules.Concurrency.csproj index 292cdd37d..13795522d 100755 --- a/gendarme/rules/Gendarme.Rules.Concurrency/Test/Tests.Rules.Concurrency.csproj +++ b/gendarme/rules/Gendarme.Rules.Concurrency/Test/Tests.Rules.Concurrency.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Correctness/Test/Tests.Rules.Correctness.csproj b/gendarme/rules/Gendarme.Rules.Correctness/Test/Tests.Rules.Correctness.csproj index d3e97ecba..29f54c26c 100755 --- a/gendarme/rules/Gendarme.Rules.Correctness/Test/Tests.Rules.Correctness.csproj +++ b/gendarme/rules/Gendarme.Rules.Correctness/Test/Tests.Rules.Correctness.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Design.Generic/Test/Tests.Rules.Design.Generic.csproj b/gendarme/rules/Gendarme.Rules.Design.Generic/Test/Tests.Rules.Design.Generic.csproj index 5eb62ff0f..5441d5987 100644 --- a/gendarme/rules/Gendarme.Rules.Design.Generic/Test/Tests.Rules.Design.Generic.csproj +++ b/gendarme/rules/Gendarme.Rules.Design.Generic/Test/Tests.Rules.Design.Generic.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Design.Linq/Test/Tests.Rules.Design.Linq.csproj b/gendarme/rules/Gendarme.Rules.Design.Linq/Test/Tests.Rules.Design.Linq.csproj index 10db1dc8b..68f6c1926 100644 --- a/gendarme/rules/Gendarme.Rules.Design.Linq/Test/Tests.Rules.Design.Linq.csproj +++ b/gendarme/rules/Gendarme.Rules.Design.Linq/Test/Tests.Rules.Design.Linq.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Design/Test/Tests.Rules.Design.csproj b/gendarme/rules/Gendarme.Rules.Design/Test/Tests.Rules.Design.csproj index c59cc0966..8195df723 100755 --- a/gendarme/rules/Gendarme.Rules.Design/Test/Tests.Rules.Design.csproj +++ b/gendarme/rules/Gendarme.Rules.Design/Test/Tests.Rules.Design.csproj @@ -54,9 +54,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Exceptions/Test/Tests.Rules.Exceptions.csproj b/gendarme/rules/Gendarme.Rules.Exceptions/Test/Tests.Rules.Exceptions.csproj index 2e31f252e..f7d7b0031 100644 --- a/gendarme/rules/Gendarme.Rules.Exceptions/Test/Tests.Rules.Exceptions.csproj +++ b/gendarme/rules/Gendarme.Rules.Exceptions/Test/Tests.Rules.Exceptions.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Gendarme/Test/Tests.Rules.Gendarme.csproj b/gendarme/rules/Gendarme.Rules.Gendarme/Test/Tests.Rules.Gendarme.csproj index 877d2b745..cc57a7a0c 100755 --- a/gendarme/rules/Gendarme.Rules.Gendarme/Test/Tests.Rules.Gendarme.csproj +++ b/gendarme/rules/Gendarme.Rules.Gendarme/Test/Tests.Rules.Gendarme.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Globalization/Test/Tests.Rules.Globalization.csproj b/gendarme/rules/Gendarme.Rules.Globalization/Test/Tests.Rules.Globalization.csproj index d1c610799..4c2b15f04 100644 --- a/gendarme/rules/Gendarme.Rules.Globalization/Test/Tests.Rules.Globalization.csproj +++ b/gendarme/rules/Gendarme.Rules.Globalization/Test/Tests.Rules.Globalization.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test/Tests.Rules.Interoperability.Com.csproj b/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test/Tests.Rules.Interoperability.Com.csproj index 7f2162948..df74f2f8e 100755 --- a/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test/Tests.Rules.Interoperability.Com.csproj +++ b/gendarme/rules/Gendarme.Rules.Interoperability.Com/Test/Tests.Rules.Interoperability.Com.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Interoperability/Test/Tests.Rules.Interoperability.csproj b/gendarme/rules/Gendarme.Rules.Interoperability/Test/Tests.Rules.Interoperability.csproj index ce293e7eb..d2803872b 100755 --- a/gendarme/rules/Gendarme.Rules.Interoperability/Test/Tests.Rules.Interoperability.csproj +++ b/gendarme/rules/Gendarme.Rules.Interoperability/Test/Tests.Rules.Interoperability.csproj @@ -55,9 +55,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Maintainability/Test/Tests.Rules.Maintainability.csproj b/gendarme/rules/Gendarme.Rules.Maintainability/Test/Tests.Rules.Maintainability.csproj index 5f08e85ea..df9e458bd 100755 --- a/gendarme/rules/Gendarme.Rules.Maintainability/Test/Tests.Rules.Maintainability.csproj +++ b/gendarme/rules/Gendarme.Rules.Maintainability/Test/Tests.Rules.Maintainability.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.NUnit/Test/Tests.Rules.NUnit.csproj b/gendarme/rules/Gendarme.Rules.NUnit/Test/Tests.Rules.NUnit.csproj index 7fc3ffea7..80b21a0fb 100755 --- a/gendarme/rules/Gendarme.Rules.NUnit/Test/Tests.Rules.NUnit.csproj +++ b/gendarme/rules/Gendarme.Rules.NUnit/Test/Tests.Rules.NUnit.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Naming/Test/Tests.Rules.Naming.csproj b/gendarme/rules/Gendarme.Rules.Naming/Test/Tests.Rules.Naming.csproj index 549dc4d00..0dca8d7f9 100755 --- a/gendarme/rules/Gendarme.Rules.Naming/Test/Tests.Rules.Naming.csproj +++ b/gendarme/rules/Gendarme.Rules.Naming/Test/Tests.Rules.Naming.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Performance/Test/Tests.Rules.Performance.csproj b/gendarme/rules/Gendarme.Rules.Performance/Test/Tests.Rules.Performance.csproj index 531edcd6b..41137b0de 100755 --- a/gendarme/rules/Gendarme.Rules.Performance/Test/Tests.Rules.Performance.csproj +++ b/gendarme/rules/Gendarme.Rules.Performance/Test/Tests.Rules.Performance.csproj @@ -55,9 +55,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Portability/Test/Tests.Rules.Portability.csproj b/gendarme/rules/Gendarme.Rules.Portability/Test/Tests.Rules.Portability.csproj index fcd822097..4936335c7 100755 --- a/gendarme/rules/Gendarme.Rules.Portability/Test/Tests.Rules.Portability.csproj +++ b/gendarme/rules/Gendarme.Rules.Portability/Test/Tests.Rules.Portability.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Security.Cas/Test/Tests.Rules.Security.Cas.csproj b/gendarme/rules/Gendarme.Rules.Security.Cas/Test/Tests.Rules.Security.Cas.csproj index 8d2eec571..ee23df526 100644 --- a/gendarme/rules/Gendarme.Rules.Security.Cas/Test/Tests.Rules.Security.Cas.csproj +++ b/gendarme/rules/Gendarme.Rules.Security.Cas/Test/Tests.Rules.Security.Cas.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Security/Test/Tests.Rules.Security.csproj b/gendarme/rules/Gendarme.Rules.Security/Test/Tests.Rules.Security.csproj index 2568557b9..56d9abf51 100755 --- a/gendarme/rules/Gendarme.Rules.Security/Test/Tests.Rules.Security.csproj +++ b/gendarme/rules/Gendarme.Rules.Security/Test/Tests.Rules.Security.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Serialization/Test/Tests.Rules.Serialization.csproj b/gendarme/rules/Gendarme.Rules.Serialization/Test/Tests.Rules.Serialization.csproj index 090910b1b..4f35c66c4 100755 --- a/gendarme/rules/Gendarme.Rules.Serialization/Test/Tests.Rules.Serialization.csproj +++ b/gendarme/rules/Gendarme.Rules.Serialization/Test/Tests.Rules.Serialization.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Smells/Test/Tests.Rules.Smells.csproj b/gendarme/rules/Gendarme.Rules.Smells/Test/Tests.Rules.Smells.csproj index eb69c1df2..7954735a3 100755 --- a/gendarme/rules/Gendarme.Rules.Smells/Test/Tests.Rules.Smells.csproj +++ b/gendarme/rules/Gendarme.Rules.Smells/Test/Tests.Rules.Smells.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll diff --git a/gendarme/rules/Gendarme.Rules.Ui/Test/Tests.Rules.Ui.csproj b/gendarme/rules/Gendarme.Rules.Ui/Test/Tests.Rules.Ui.csproj index 902d88000..4232fd5c7 100644 --- a/gendarme/rules/Gendarme.Rules.Ui/Test/Tests.Rules.Ui.csproj +++ b/gendarme/rules/Gendarme.Rules.Ui/Test/Tests.Rules.Ui.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll 3.0 diff --git a/gendarme/rules/Test.Rules/Test.Rules.csproj b/gendarme/rules/Test.Rules/Test.Rules.csproj index 9ee6d8893..e9cf46a91 100755 --- a/gendarme/rules/Test.Rules/Test.Rules.csproj +++ b/gendarme/rules/Test.Rules/Test.Rules.csproj @@ -53,9 +53,9 @@ AllRules.ruleset - + False - ..\..\..\..\cecil\Test\libs\nunit-2.4.8\nunit.framework.dll + ..\..\..\..\cecil\Test\libs\nunit-2.6.2\nunit.framework.dll From 03b6e588d137c0a821d16234a8f994053479d415 Mon Sep 17 00:00:00 2001 From: Ryan McCauley Date: Wed, 9 Aug 2017 12:19:02 -0400 Subject: [PATCH 5/6] Update gendarme build instructions --- gendarme/README.vsnet | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gendarme/README.vsnet b/gendarme/README.vsnet index f3993aa23..66a95c49c 100644 --- a/gendarme/README.vsnet +++ b/gendarme/README.vsnet @@ -31,16 +31,18 @@ The minimal requirements are: * Microsoft Visual Studio.NET 2010 [2]; * Some modules from github - * 'jbevain/cecil' to get both Mono.Cecil and Mono.Cecil.[M|P]db - * 'mono/mono-tools' for Gendarme latest sources + * 'jbevain/cecil/0.9.6-nuget' to get both Mono.Cecil and Mono.Cecil.[M|P]db + * 'secdec/mono-tools' for Gendarme latest sources How To * Check out the source code from GIT. This is: - git clone git://github.com/mono/mono-tools.git + git clone git://github.com/secdec/mono-tools.git git clone git://github.com/jbevain/cecil.git + cd cecil + git checkout 0.9.6-nuget (Please clone both modules at the same level in the folder hierarchy because mono-tools references cecil as a relative path.) From 2a3026e43e219cbf03d53f394d4c1b07a2e89969 Mon Sep 17 00:00:00 2001 From: Ryan McCauley Date: Wed, 9 Aug 2017 12:30:41 -0400 Subject: [PATCH 6/6] Remove missing include from Tests.Gendarme --- gendarme/Tests.Gendarme/Tests.Gendarme.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/gendarme/Tests.Gendarme/Tests.Gendarme.csproj b/gendarme/Tests.Gendarme/Tests.Gendarme.csproj index dad9d2202..bb864cbd0 100644 --- a/gendarme/Tests.Gendarme/Tests.Gendarme.csproj +++ b/gendarme/Tests.Gendarme/Tests.Gendarme.csproj @@ -46,7 +46,6 @@ -