Skip to content

Conversation

@littleKitchen
Copy link
Contributor

Summary

Resolves #324

Moves inline class definitions from Test-DependencyPinning.ps1 to a dedicated module for improved reusability and testability.

Changes

New: scripts/security/Modules/SecurityClasses.psm1

  • DependencyViolation class - represents a single pinning violation
    • Default constructor
    • Parameterized constructor for common use cases
  • ComplianceReport class - aggregates violations and generates reports
    • AddViolation() method
    • CalculateScore() method
    • ToHashtable() method for serialization
  • Full documentation with examples

Updated: Test-DependencyPinning.ps1

  • Added using module import for SecurityClasses.psm1
  • Removed ~35 lines of inline class definitions

Testing

  • npm run lint:ps - PSScriptAnalyzer passes
  • npm run test:ps - All Pester tests pass (779 passed)

Notes

Follows the pattern established by FrontmatterValidation.psm1 in the linting modules.

…shared module

Resolves microsoft#324

- Create scripts/security/Modules/SecurityClasses.psm1 with:
  - DependencyViolation class with constructor overloads
  - ComplianceReport class with helper methods (AddViolation, CalculateScore, ToHashtable)
  - Documentation and examples

- Update Test-DependencyPinning.ps1:
  - Add 'using module' import for SecurityClasses.psm1
  - Remove inline class definitions (~35 lines)

This follows the pattern established by FrontmatterValidation.psm1 and
improves reusability and testability of the security scanning infrastructure.
@littleKitchen littleKitchen requested a review from a team as a code owner January 31, 2026 06:49
@codecov-commenter
Copy link

codecov-commenter commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 16.66667% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.93%. Comparing base (92fce72) to head (cff7265).

Files with missing lines Patch % Lines
scripts/security/Modules/SecurityClasses.psm1 16.66% 30 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #378      +/-   ##
==========================================
- Coverage   62.21%   60.93%   -1.28%     
==========================================
  Files          18       19       +1     
  Lines        3202     3233      +31     
==========================================
- Hits         1992     1970      -22     
- Misses       1210     1263      +53     
Flag Coverage Δ
pester 60.93% <16.66%> (-1.28%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
scripts/security/Test-DependencyPinning.ps1 67.74% <ø> (-6.83%) ⬇️
scripts/security/Modules/SecurityClasses.psm1 16.66% <16.66%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

WilliamBerryiii and others added 2 commits February 3, 2026 11:38
- add copyright and SPDX-License-Identifier header
- remove date from header comment
- clarify export comment for module classes

🔧 - Generated by Copilot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Issue]: Move DependencyViolation and ComplianceReport classes to dedicated module

3 participants