/// <summary>Creates the specified statistics for the source lines.</summary> /// <param name="sourceLines">The source lines.</param> /// <param name="ii">The ii.</param> /// <param name="comments">The comments.</param> /// <param name="header">The header.</param> /// <param name="attributeLines">The attribute lines.</param> /// <returns></returns> public static MethodNTstats_ Create(List <string> sourceLines, ref int ii, MethodNTComment_ comments = null, MethodNTHeader_ header = null, int attributeLines = 0) { var result = new MethodNTstats_(); // {Name = name, Value = value}; // Execute static method to populate result parameters sourceLines.zTo_IList(result.SourceLines, true, ii); // comments var commentCount = 0; if (comments != null) { commentCount = comments.CommentParameters.Count; if (comments.CommentReturn != "") { commentCount++; } if (comments.CommentSummary != "") { commentCount++; } } result.MethodTotalCommentLines = commentCount; result.MethodTotalLines = sourceLines.Count; result.MethodTotalBodyLines = sourceLines.Count - commentCount - attributeLines - 3; // 3 = header + { + } if (result.MethodTotalBodyLines < 1) { result.MethodTotalBodyLines = 1; } MethodNTstats_Methods.Method_Stats(result.SourceLines, out result.CodeComplexity, out result.CodeMaintainability, out result.ReferenceCalls, header); return(result); }
/// <summary> /// Merges the parameters with comments. /// </summary> /// <param name="header">The header.</param> /// <param name="comments">The comments.</param> public static void SyncParametersWithComments(MethodNTHeader_ header, MethodNTComment_ comments) { var parameters = header.Header_Parameters; foreach (MethodNTHeaderParameter_ parameter in parameters) { var name = parameter.ParameterName.Replace("@", ""); MethodNTCommentParameter_ parmComment = comments.CommentParameters.FirstOrDefault(x => x.ParameterName == name); if (parmComment != null) { parameter.ParameterComment = parmComment.ParameterComment; } } }
/// <summary> /// Parse the method. /// </summary> /// <param name="sourceLines">The source lines.</param> /// <param name="ii">The ii.</param> /// <param name="iiMethodEnd">The ii method end.</param> /// <param name="methodName">Name of the method.</param> /// <param name="sourceCode">The source code.</param> /// <param name="comment">The comment.</param> /// <param name="attribute_Lines">The attribute_ lines.</param> /// <param name="attribute_Breakdown">The attribute_ breakdown.</param> /// <param name="methodRule">The blueprint method rule.</param> /// <param name="methodAliasDef">The method alias definition.</param> /// <param name="header">The header.</param> /// <param name="stats">The body.</param> public static void Method_Parse(List <string> sourceLines, ref int ii, int iiMethodEnd, out string methodName, out List <string> sourceCode, out MethodNTComment_ comment, out List <string> attribute_Lines, out ClassNTAttributes_ attribute_Breakdown, out ClassNTBlueprintMethodRule_ methodRule, out ClassNTBlueprintMethodRule_AliasDef_ methodAliasDef, out MethodNTHeader_ header, out MethodNTstats_ stats) { if (iiMethodEnd == 0) { iiMethodEnd = sourceLines.Count - 1; } sourceCode = new List <string>(); sourceCode.zFrom_IList(sourceLines, true, ii, iiMethodEnd); ii = iiMethodEnd; int jj = 0; comment = MethodNTComment_.Create(sourceCode, ref jj, out attribute_Lines); methodRule = ClassNTBlueprintMethodRule_.Create(attribute_Lines); methodAliasDef = ClassNTBlueprintMethodRule_AliasDef_.Create(attribute_Lines); attribute_Breakdown = ClassNTAttributes_.Create(attribute_Lines); // attributes header = MethodNTHeader_.Create(sourceCode, ref jj); stats = MethodNTstats_.Create(sourceCode, ref jj, comment, header, attribute_Lines.Count); methodName = header.Header_Name; }