<commit_before>﻿#Import-Module PSScriptAnalyzer
$AvoidUninitializedVariable = "PSAvoidUninitializedVariable"
$violationMessage = "Variable 'MyProgressPreference' is not initialized. Non-global variables must be initialized. To fix a violation of this rule, please initialize non-global variables."
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
$violations = Invoke-ScriptAnalyzer $directory\AvoidUsingUninitializedVariable.ps1 -IncludeRule $AvoidUninitializedVariable
$noViolations = Invoke-ScriptAnalyzer $directory\AvoidUsingUninitializedVariableNoViolations.ps1 -IncludeRule $AvoidUninitializedVariable

Describe "AvoidUsingUninitializedVariable" {
    Context "Script uses uninitialized variables - Violation" {
        It "Have 3 rule violations" {<commit_msg>Forgot to import our module<commit_after>﻿Import-Module PSScriptAnalyzer
$AvoidUninitializedVariable = "PSAvoidUninitializedVariable"
$violationMessage = "Variable 'MyProgressPreference' is not initialized. Non-global variables must be initialized. To fix a violation of this rule, please initialize non-global variables."
$directory = Split-Path -Parent $MyInvocation.MyCommand.Path
$violations = Invoke-ScriptAnalyzer $directory\AvoidUsingUninitializedVariable.ps1 -IncludeRule $AvoidUninitializedVariable
$noViolations = Invoke-ScriptAnalyzer $directory\AvoidUsingUninitializedVariableNoViolations.ps1 -IncludeRule $AvoidUninitializedVariable

Describe "AvoidUsingUninitializedVariable" {
    Context "Script uses uninitialized variables - Violation" {
        It "Have 3 rule violations" {
{'fraction_non_alphanumeric': 0.06929434202161475, 'fraction_numerical': 0.003814367450731087, 'mean_word_length': 7.2408376963350785, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5391035', 'n_tokens_mistral': 412, 'n_tokens_neox': 420, 'n_words': 110}