Skip to content

Support for custom rules as streams #312

Closed
@raghushantha

Description

@raghushantha

I am creating this issue to have a discussion around having the support to consume rules as streams.

Today we only have the file based approach - where the rules are written in C# and compiled into a dll or as PowerShell scripts.

From Tobias - for more context:

"ScriptAnalyzer may well become a generic service for script analysis. So it will be consumed not only by end users running cmdlets, but also from within software created by ISVs.

Having to load rules as files limits usability. There may be scenarios where it can be useful to dynamically create rules, or use rules for other purposes than script analysis. In these cases, rules would need to come from streams because these rules may never exist as files, and it would be an awkward workaround having to convert streams to files, then read the files into ScriptAnalyzer, then have ScriptAnalyzer convert the files back to streams. In general, the more scenarios you enable, the more impact will ScriptAnalyzer have, and I can see no reason why rules should have only a file-based way to get to ScriptAnalyzer.

It is similar to the –Path parameter where you specify the script to check. This, too, should accept streams or at least strings. Interfacing to ScriptAnalyzer should not be limited to file based content. In ISESteroids beta, for example, we added real-time checks. It is a burden having to save the current editor content to file just to feed this into ScriptAnalyzer, and would be much more efficient if it could be submitted as text. Your file based input, for example, prevents Untitled scripts from being checked.
"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions