@@ -141,6 +141,54 @@ public AnalysisService(IConsoleHost consoleHost, string settingsPath = null)
141141
142142 #region Public Methods
143143
144+ /// <summary>
145+ /// Get PSScriptAnalyzer settings hashtable for PSProvideCommentHelp rule.
146+ /// </summary>
147+ /// <param name="enable">Enable the rule.</param>
148+ /// <param name="exportedOnly">Analyze only exported functions/cmdlets.</param>
149+ /// <param name="blockComment">Use block comment or line comment.</param>
150+ /// <param name="vscodeSnippetCorrection">Return a vscode snipped correction should be returned.</param>
151+ /// <param name="placement">Place comment help at the given location relative to the function definition.</param>
152+ /// <returns>A PSScriptAnalyzer settings hashtable.</returns>
153+ public static Hashtable GetCommentHelpRuleSettings (
154+ bool enable ,
155+ bool exportedOnly ,
156+ bool blockComment ,
157+ bool vscodeSnippetCorrection ,
158+ string placement )
159+ {
160+ var settings = new Dictionary < string , Hashtable > ( ) ;
161+ var ruleSettings = new Hashtable ( ) ;
162+ ruleSettings . Add ( "Enable" , enable ) ;
163+ ruleSettings . Add ( "ExportedOnly" , exportedOnly ) ;
164+ ruleSettings . Add ( "BlockComment" , blockComment ) ;
165+ ruleSettings . Add ( "VSCodeSnippetCorrection" , vscodeSnippetCorrection ) ;
166+ ruleSettings . Add ( "Placement" , placement ) ;
167+ settings . Add ( "PSProvideCommentHelp" , ruleSettings ) ;
168+ return GetPSSASettingsHashtable ( settings ) ;
169+ }
170+
171+ /// <summary>
172+ /// Construct a PSScriptAnalyzer settings hashtable
173+ /// </summary>
174+ /// <param name="ruleSettingsMap">A settings hashtable</param>
175+ /// <returns></returns>
176+ public static Hashtable GetPSSASettingsHashtable ( IDictionary < string , Hashtable > ruleSettingsMap )
177+ {
178+ var hashtable = new Hashtable ( ) ;
179+ var ruleSettingsHashtable = new Hashtable ( ) ;
180+
181+ hashtable [ "IncludeRules" ] = ruleSettingsMap . Keys . ToArray < object > ( ) ;
182+ hashtable [ "Rules" ] = ruleSettingsHashtable ;
183+
184+ foreach ( var kvp in ruleSettingsMap )
185+ {
186+ ruleSettingsHashtable . Add ( kvp . Key , kvp . Value ) ;
187+ }
188+
189+ return hashtable ;
190+ }
191+
144192 /// <summary>
145193 /// Perform semantic analysis on the given ScriptFile and returns
146194 /// an array of ScriptFileMarkers.
@@ -181,27 +229,6 @@ public IEnumerable<string> GetPSScriptAnalyzerRules()
181229 return ruleNames ;
182230 }
183231
184- /// <summary>
185- /// Construct a PSScriptAnalyzer settings hashtable
186- /// </summary>
187- /// <param name="ruleSettingsMap">A settings hashtable</param>
188- /// <returns></returns>
189- public static Hashtable GetPSSASettingsHashtable ( IDictionary < string , Hashtable > ruleSettingsMap )
190- {
191- var hashtable = new Hashtable ( ) ;
192- var ruleSettingsHashtable = new Hashtable ( ) ;
193-
194- hashtable [ "IncludeRules" ] = ruleSettingsMap . Keys . ToArray < object > ( ) ;
195- hashtable [ "Rules" ] = ruleSettingsHashtable ;
196-
197- foreach ( var kvp in ruleSettingsMap )
198- {
199- ruleSettingsHashtable . Add ( kvp . Key , kvp . Value ) ;
200- }
201-
202- return hashtable ;
203- }
204-
205232 /// <summary>
206233 /// Disposes the runspace being used by the analysis service.
207234 /// </summary>
0 commit comments