Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: add UseCompatibleTypes Rule, including related resources. Refactor UseCompatibleCmdlets Rule. #960

Closed
wants to merge 11 commits into from
22,520 changes: 22,520 additions & 0 deletions Engine/Settings/core-6.0.1-ARM64-windows.json

Large diffs are not rendered by default.

1,648 changes: 0 additions & 1,648 deletions Engine/Settings/core-6.0.2-linux.json

This file was deleted.

2,075 changes: 0 additions & 2,075 deletions Engine/Settings/core-6.0.2-windows.json

This file was deleted.

23,567 changes: 23,567 additions & 0 deletions Engine/Settings/core-6.1.0-preview.2-linux.json

Large diffs are not rendered by default.

24,502 changes: 24,502 additions & 0 deletions Engine/Settings/core-6.1.0-preview.2-windows.json

Large diffs are not rendered by default.

10,207 changes: 0 additions & 10,207 deletions Engine/Settings/desktop-5.1.14393.206-windows.json

This file was deleted.

151,800 changes: 151,800 additions & 0 deletions Engine/Settings/desktop-5.1.14393.2248-windows.json

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions Engine/Settings/knownCmdletIssues.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
"Wait-Process",
"Register-PSSessionConfiguration",
"Unregister-PSSessionConfiguration",
"Get-PSSessionConfiguration",
"Get-Event",
"New-Event",
"Register-EngineEvent",
"Register-WmiEvent",
"Remove-Event",
"Unregister-Event",
"Set-ExecutionPolicy",
"New-PSSessionOption",
"New-PSTransportOption"
]
100 changes: 100 additions & 0 deletions Engine/Settings/typeAccelerators.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"powershell": "System.Management.Automation.PowerShell",
"int32": "System.Int32",
"wildcardpattern": "System.Management.Automation.WildcardPattern",
"x500distinguishedname": "System.Security.Cryptography.X509Certificates.X500DistinguishedName",
"void": "System.Void",
"ipaddress": "System.Net.IPAddress",
"pscredential": "System.Management.Automation.PSCredential",
"nullstring": "System.Management.Automation.Language.NullString",
"pslistmodifier": "System.Management.Automation.PSListModifier",
"ciminstance": "Microsoft.Management.Infrastructure.CimInstance",
"regex": "System.Text.RegularExpressions.Regex",
"validatenotnullorempty": "System.Management.Automation.ValidateNotNullOrEmptyAttribute",
"int64": "System.Int64",
"guid": "System.Guid",
"int16": "System.Int16",
"xml": "System.Xml.XmlDocument",
"single": "System.Single",
"psnoteproperty": "System.Management.Automation.PSNoteProperty",
"adsisearcher": "System.DirectoryServices.DirectorySearcher",
"cimconverter": "Microsoft.Management.Infrastructure.CimConverter",
"cultureinfo": "System.Globalization.CultureInfo",
"dsclocalconfigurationmanager": "System.Management.Automation.DscLocalConfigurationManagerAttribute",
"ordered": "System.Collections.Specialized.OrderedDictionary",
"psprimitivedictionary": "System.Management.Automation.PSPrimitiveDictionary",
"byte": "System.Byte",
"dscproperty": "System.Management.Automation.DscPropertyAttribute",
"validatecount": "System.Management.Automation.ValidateCountAttribute",
"dscresource": "System.Management.Automation.DscResourceAttribute",
"psscriptproperty": "System.Management.Automation.PSScriptProperty",
"securestring": "System.Security.SecureString",
"wmisearcher": "System.Management.ManagementObjectSearcher",
"psmoduleinfo": "System.Management.Automation.PSModuleInfo",
"version": "System.Version",
"outputtype": "System.Management.Automation.OutputTypeAttribute",
"mailaddress": "System.Net.Mail.MailAddress",
"pscustomobject": "System.Management.Automation.PSObject",
"wmi": "System.Management.ManagementObject",
"psaliasproperty": "System.Management.Automation.PSAliasProperty",
"psdefaultvalue": "System.Management.Automation.PSDefaultValueAttribute",
"long": "System.Int64",
"switch": "System.Management.Automation.SwitchParameter",
"psvariable": "System.Management.Automation.PSVariable",
"char": "System.Char",
"allowemptystring": "System.Management.Automation.AllowEmptyStringAttribute",
"wmiclass": "System.Management.ManagementClass",
"semver": "System.Management.Automation.SemanticVersion",
"argumentcompleter": "System.Management.Automation.ArgumentCompleterAttribute",
"x509certificate": "System.Security.Cryptography.X509Certificates.X509Certificate",
"psscriptmethod": "System.Management.Automation.PSScriptMethod",
"validatedrive": "System.Management.Automation.ValidateDriveAttribute",
"cimclass": "Microsoft.Management.Infrastructure.CimClass",
"double": "System.Double",
"validateset": "System.Management.Automation.ValidateSetAttribute",
"validatescript": "System.Management.Automation.ValidateScriptAttribute",
"scriptblock": "System.Management.Automation.ScriptBlock",
"supportswildcards": "System.Management.Automation.SupportsWildcardsAttribute",
"ref": "System.Management.Automation.PSReference",
"int": "System.Int32",
"string": "System.String",
"adsi": "System.DirectoryServices.DirectoryEntry",
"cimsession": "Microsoft.Management.Infrastructure.CimSession",
"float": "System.Single",
"bool": "System.Boolean",
"runspace": "System.Management.Automation.Runspaces.Runspace",
"parameter": "System.Management.Automation.ParameterAttribute",
"bigint": "System.Numerics.BigInteger",
"uri": "System.Uri",
"sbyte": "System.SByte",
"type": "System.Type",
"uint32": "System.UInt32",
"initialsessionstate": "System.Management.Automation.Runspaces.InitialSessionState",
"validaterange": "System.Management.Automation.ValidateRangeAttribute",
"alias": "System.Management.Automation.AliasAttribute",
"hashtable": "System.Collections.Hashtable",
"uint16": "System.UInt16",
"objectsecurity": "System.Security.AccessControl.ObjectSecurity",
"decimal": "System.Decimal",
"ipendpoint": "System.Net.IPEndPoint",
"psobject": "System.Management.Automation.PSObject",
"validateuserdrive": "System.Management.Automation.ValidateUserDriveAttribute",
"physicaladdress": "System.Net.NetworkInformation.PhysicalAddress",
"runspacefactory": "System.Management.Automation.Runspaces.RunspaceFactory",
"uint64": "System.UInt64",
"cimtype": "Microsoft.Management.Infrastructure.CimType",
"timespan": "System.TimeSpan",
"validatepattern": "System.Management.Automation.ValidatePatternAttribute",
"object": "System.Object",
"validatelength": "System.Management.Automation.ValidateLengthAttribute",
"cmdletbinding": "System.Management.Automation.CmdletBindingAttribute",
"array": "System.Array",
"validatetrusteddata": "System.Management.Automation.ValidateTrustedDataAttribute",
"argumentcompletions": "System.Management.Automation.ArgumentCompletionsAttribute",
"datetime": "System.DateTime",
"validatenotnull": "System.Management.Automation.ValidateNotNullAttribute",
"psvariableproperty": "System.Management.Automation.PSVariableProperty",
"pstypenameattribute": "System.Management.Automation.PSTypeNameAttribute",
"allownull": "System.Management.Automation.AllowNullAttribute",
"allowemptycollection": "System.Management.Automation.AllowEmptyCollectionAttribute"
}
2 changes: 1 addition & 1 deletion Engine/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -327,4 +327,4 @@
<data name="TypeNotFoundParseErrorFound" xml:space="preserve">
<value>Ignoring 'TypeNotFound' parse error on type '{0}'. Check if the specified type is correct. This can also be due the type not being known at parse time due to types imported by 'using' statements.</value>
</data>
</root>
</root>
74 changes: 73 additions & 1 deletion Rules/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 25 additions & 1 deletion Rules/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1026,4 +1026,28 @@
<data name="PossibleIncorrectUsageOfRedirectionOperatorName" xml:space="preserve">
<value>PossibleIncorrectUsageOfRedirectionOperator</value>
</data>
</root>
<data name="UseCompatibleCmdletsKnownIssueError" xml:space="preserve">
<value>'{0}' is present in PowerShell edition '{1}', version '{2}', on OS '{3}' but is not functional.</value>
</data>
<data name="UseCompatibleCmdletsWindowsPowerShellError" xml:space="preserve">
<value>'{0}' is a full Windows PowerShell cmdlet. This cmdlet may work with PowerShell edition '{1}', version '{2}' on OS '{3}' but compatibility cannot be guaranteed.</value>
</data>
<data name="UseCompatibleTypesCommonName" xml:space="preserve">
<value>Use compatible types</value>
</data>
<data name="UseCompatibleTypesDescription" xml:space="preserve">
<value>Use types compatible with the given PowerShell version and edition and operating system</value>
</data>
<data name="UseCompatibleTypesError" xml:space="preserve">
<value>'{0}' is not compatible with PowerShell edition '{1}', version '{2}' and OS '{3}'</value>
</data>
<data name="UseCompatibleTypesName" xml:space="preserve">
<value>UseCompatibleTypes</value>
</data>
<data name="UseCompatibleTypesUnresolvedError" xml:space="preserve">
<value>Could not resolve type '{0}'.</value>
</data>
<data name="UseCompatibleTypesException" xml:space="preserve">
<value>'{0}' throws a {1}: {2}</value>
</data>
</root>
Loading