PowerShell / PowerShell/PSScriptAnalyzer

Report when multiple values are returned from a function implicitly

Open
#1,728 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area - Rules Issue - Enhancement Up-for-Grabs
Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

Summary of the new feature

I'd like to be able to run a command such that if I implicitly return values as well as have a return statement that it is flagged.

Ex
function fun1 { mkdir (Join-Path $env:TEMP "myFolder"); return $true }

This should produce an error/warning because mkdir (New-Item) is actually returning a value though we also explicitly return $true.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by reviewing the repository's analyzer and test structure, then determine where implicit output and explicit return statements are analyzed. Done means the example is flagged for returning multiple values while existing behavior remains covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.