Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/api-doc-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMike Norman <mike.norman@xamarin.com>2017-07-22 01:51:50 +0300
committerJoel Martinez <joelmartinez@gmail.com>2017-08-24 19:01:36 +0300
commitc6342d0745d67407a4bcedc104d78d48484127ce (patch)
tree9b77b7121df19b3e8317f92548a6bcf842035249 /tools
parent54296f0a668f40954ffb6ba78539cf17ed424804 (diff)
Rationalized reporting of types needing type summaries
Diffstat (limited to 'tools')
-rw-r--r--tools/DocStat/DocStat/comparereport.cs73
1 files changed, 47 insertions, 26 deletions
diff --git a/tools/DocStat/DocStat/comparereport.cs b/tools/DocStat/DocStat/comparereport.cs
index c692282f..4673a1dd 100644
--- a/tools/DocStat/DocStat/comparereport.cs
+++ b/tools/DocStat/DocStat/comparereport.cs
@@ -56,16 +56,9 @@ namespace DocStat
StreamWriter reportStream = new StreamWriter(reportFile);
- reportStream.WriteLine(String.Format(CommandUtils.CSVFormatString(3), "File Name", "Type", "Member"));
+ reportStream.WriteLine(String.Format(CommandUtils.CSVFormatString(5), "File Name", "Type", "Member","Need file summary", "Need member summary"));
- Action<XElement> Write = null;
-
- Action<XElement> WriteSubsequent = (XElement e) =>
- {
- reportStream.WriteLine(CommandUtils.CSVFormatString(3), "", "", e.Attribute("MemberName").Value);
- };
-
- Func<XElement, bool> hasSigil = null;
+ Func<XElement, bool> hasSigil = null;
if (nosigil)
{
@@ -76,43 +69,71 @@ namespace DocStat
hasSigil = (XElement e) => e.Element("Docs").Element("summary").Value == "To be added.";
}
+ //Func<XElement, bool> needSummary = (XElement e) => e.Element("Docs").Element("summary").Value == "To be added.";
+
+ Func<XElement, string> MemberLine = (XElement e) => {
+ return string.Format(
+ CommandUtils.CSVFormatString(5),
+ "",
+ "",
+ e.Attribute("MemberName").Value,
+ "",
+ hasSigil(e) ? "y" : "n");
+ };
+
+
+
+ List<string> toWrite = new List<string>();
foreach (string updatedXMLFile in updated)
{
+
+ bool fileLineAdded = false;
+
XDocument updatedXDoc = XDocument.Load(updatedXMLFile);
- Action<string> WriteFileLine = (string fname) =>
+ Func<string> FileLine = () =>
{
- reportStream.WriteLine(CommandUtils.CSVFormatString(2),
- fname,
- updatedXDoc.Element("Type").Attribute("FullName").Value);
- Write = WriteSubsequent;
+ return string.Format(
+ CommandUtils.CSVFormatString(5),
+ updatedXMLFile,
+ updatedXDoc.Element("Type").Attribute("FullName").Value,
+ "",
+ hasSigil(updatedXDoc.Element("Type")) ? "y" : "n",
+ "");
};
- Write = (XElement e) =>
- {
- reportStream.WriteLine(CommandUtils.CSVFormatString(2),
- updatedXMLFile,
- updatedXDoc.Element("Type").Attribute("FullName").Value);
- WriteSubsequent(e);
- Write = WriteSubsequent;
- };
string oldXMLFile = EcmaXmlHelper.GetParallelFilePathFor(updatedXMLFile, oldFilesDir, updatedDir);
XDocument oldXDoc = File.Exists(oldXMLFile) ? XDocument.Load(oldXMLFile) : null;
- if (null == oldXDoc)
- WriteFileLine(updatedXMLFile);
+ if (null == oldXDoc && hasSigil(updatedXDoc.Element("Type")))
+ {
+ toWrite.Add(FileLine());
+ fileLineAdded = true;
+ }
IEnumerable<XElement> newMembers = EcmaXmlHelper.NewMembers(updatedXDoc, oldXDoc);
- if (null != newMembers && newMembers.Count() > 0)
+ if (null != newMembers && newMembers.Where((f) => hasSigil(f)).Any())
{
+ if (!fileLineAdded)
+ toWrite.Add(FileLine());
+
foreach (XElement e in newMembers.Where((f) => hasSigil(f)))
{
- Write(e);
+ toWrite.Add(MemberLine(e));
}
}
+
+ // If toWrite isn't empty, write all lines
+ if (toWrite.Any())
+ {
+ foreach (string s in toWrite)
+ reportStream.WriteLine(s);
+ }
+ toWrite.Clear();
}
reportStream.Flush();
reportStream.Close();
+
}
}