{"action":"created","issue":{"url":"https://api.github.com/repos/PowerShell/PSScriptAnalyzer/issues/1021","repository_url":"https://api.github.com/repos/PowerShell/PSScriptAnalyzer","labels_url":"https://api.github.com/repos/PowerShell/PSScriptAnalyzer/issues/1021/labels{/name}","comments_url":"https://api.github.com/repos/PowerShell/PSScriptAnalyzer/issues/1021/comments","events_url":"https://api.github.com/repos/PowerShell/PSScriptAnalyzer/issues/1021/events","html_url":"https://github.com/PowerShell/PSScriptAnalyzer/issues/1021","id":330865912,"node_id":"MDU6SXNzdWUzMzA4NjU5MTI=","number":1021,"title":"$null should be on left side of equality comparison","user":{"login":"PrzemyslawKlys","id":15063294,"node_id":"MDQ6VXNlcjE1MDYzMjk0","avatar_url":"https://avatars1.githubusercontent.com/u/15063294?v=4","gravatar_id":"","url":"https://api.github.com/users/PrzemyslawKlys","html_url":"https://github.com/PrzemyslawKlys","followers_url":"https://api.github.com/users/PrzemyslawKlys/followers","following_url":"https://api.github.com/users/PrzemyslawKlys/following{/other_user}","gists_url":"https://api.github.com/users/PrzemyslawKlys/gists{/gist_id}","starred_url":"https://api.github.com/users/PrzemyslawKlys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PrzemyslawKlys/subscriptions","organizations_url":"https://api.github.com/users/PrzemyslawKlys/orgs","repos_url":"https://api.github.com/users/PrzemyslawKlys/repos","events_url":"https://api.github.com/users/PrzemyslawKlys/events{/privacy}","received_events_url":"https://api.github.com/users/PrzemyslawKlys/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-06-09T08:24:23Z","updated_at":"2018-06-11T22:16:19Z","closed_at":null,"author_association":"NONE","body":"Before submitting a bug report:\r\n\r\n- Make sure you are able to repro it on the latest released version\r\n- Perform a quick search for existing issues to check if this bug has already been reported\r\n\r\nSteps to reproduce\r\n------------------\r\n\r\n```\r\nfunction Test {\r\nparam (\r\n[string[]] $ListData = $null\r\n)\r\nif ($ListData -eq $null) {\r\n}\r\n}\r\n\r\n```\r\n\r\nExpected behavior\r\n-----------------\r\n\r\n```\r\nNo warnings\r\n```\r\n\r\nActual behavior\r\n---------------\r\n\r\n```\r\n$null should be on left side of equality comparison\r\n```\r\n\r\nIf an unexpected error was thrown then please report the full error details using e.g. `$error[0] | Select-Object *`\r\n\r\nEnvironment data\r\n----------------\r\n\r\n<!-- Provide the output of the following 2 commands -->\r\n\r\n```PowerShell\r\n> $PSVersionTable\r\n\r\n\r\nName                           Value\r\n----                           -----\r\nPSVersion                      5.1.17672.1000\r\nPSEdition                      Desktop\r\nPSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}\r\nBuildVersion                   10.0.17672.1000\r\nCLRVersion                     4.0.30319.42000\r\nWSManStackVersion              3.0\r\nPSRemotingProtocolVersion      2.3\r\nSerializationVersion           1.1.0.1\r\n\r\n> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }\r\n\r\n1.17.1\r\n\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/PowerShell/PSScriptAnalyzer/issues/comments/396404723","html_url":"https://github.com/PowerShell/PSScriptAnalyzer/issues/1021#issuecomment-396404723","issue_url":"https://api.github.com/repos/PowerShell/PSScriptAnalyzer/issues/1021","id":396404723,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NjQwNDcyMw==","user":{"login":"bergmeister","id":9250262,"node_id":"MDQ6VXNlcjkyNTAyNjI=","avatar_url":"https://avatars0.githubusercontent.com/u/9250262?v=4","gravatar_id":"","url":"https://api.github.com/users/bergmeister","html_url":"https://github.com/bergmeister","followers_url":"https://api.github.com/users/bergmeister/followers","following_url":"https://api.github.com/users/bergmeister/following{/other_user}","gists_url":"https://api.github.com/users/bergmeister/gists{/gist_id}","starred_url":"https://api.github.com/users/bergmeister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bergmeister/subscriptions","organizations_url":"https://api.github.com/users/bergmeister/orgs","repos_url":"https://api.github.com/users/bergmeister/repos","events_url":"https://api.github.com/users/bergmeister/events{/privacy}","received_events_url":"https://api.github.com/users/bergmeister/received_events","type":"User","site_admin":false},"created_at":"2018-06-11T22:16:19Z","updated_at":"2018-06-11T22:16:19Z","author_association":"COLLABORATOR","body":"@PrzemyslawKlys That is the point of this rule, see rule documentation [here](https://github.com/PowerShell/PSScriptAnalyzer/blob/development/RuleDocumentation/PossibleIncorrectComparisonWithNull.md). I always like to give the following example why `$null` should not be on the left hand side in PowerShell:\r\n```powershell\r\nif (@() -eq $null) { 'true' }else { 'false' }\r\nif (@() -ne $null) { 'true' }else { 'false' }\r\n```"}}
{"actor":{"display_login":"bergmeister"}}