dsccommunity / dsccommunity/SharePointDsc

Implement usage of Strict Mode in resources

Open
#901 14 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion enhancement help wanted Technical Debt
Dominant language
C#
Stars
246
Forks
106
PR merge metrics
No merged PRs in 30d

Description

I think we should add Set-StrictMode with either version 1 or 2 to resources. This will make it easier to discover usage of uninitialized variables, references to non-existent properties of an object, function calls that use the syntax for calling methods, and variable without a name.
I have seen issues in some of the resources that possibly would have been discovered by setting strict mode.
Strict Mode will help increase the quality of the scripts.

Here is some more information: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/set-strictmode
https://blogs.technet.microsoft.com/heyscriptingguy/2014/12/03/enforce-better-script-practices-by-using-set-strictmode/

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

Review the SharePointDsc PowerShell resources and the linked Set-StrictMode documentation first. Determine whether version 1 or 2 is appropriate and how strict mode should be applied across the resources. Done means the resources consistently use strict mode and the resulting uninitialized-variable or invalid-reference issues are addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
devops
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.