Skip to content

chore: add code linting and formatting#77

Merged
chawyehsu merged 1 commit into
ScoopInstaller:mainfrom
chawyehsu:push-rmvtqkklxyoo
May 7, 2026
Merged

chore: add code linting and formatting#77
chawyehsu merged 1 commit into
ScoopInstaller:mainfrom
chawyehsu:push-rmvtqkklxyoo

Conversation

@chawyehsu
Copy link
Copy Markdown
Member

@chawyehsu chawyehsu commented May 7, 2026

Summary by CodeRabbit

  • Tests

    • Added continuous integration automation with code quality validation
    • Introduced formatting and linting tests with detailed diagnostic reporting
  • Chores

    • Established PowerShell code formatting and style standards
    • Updated development environment configuration for improved code consistency

@chawyehsu chawyehsu self-assigned this May 7, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Review Change Stack

Warning

Rate limit exceeded

@chawyehsu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 8 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ce68f86c-5156-4828-abce-ec3822d6bf57

📥 Commits

Reviewing files that changed from the base of the PR and between c585512 and 4a34bfd.

📒 Files selected for processing (7)
  • .editorconfig
  • .github/workflows/ci.yml
  • .psformatrules.psd1
  • .pslintrules.psd1
  • .vscode/settings.json
  • tests/Linter.Tests.ps1
  • tests/run.ps1

Walkthrough

This PR establishes PowerShell code quality infrastructure by introducing linting and formatting rule configurations, a test suite to validate compliance, VS Code integration, and an automated GitHub Actions CI workflow that runs tests on every push and pull request.

Changes

PowerShell Code Quality Infrastructure

Layer / File(s) Summary
Linting and Formatting Rules
.pslintrules.psd1, .psformatrules.psd1
Defines Severity levels and ExcludeRules for linting; defines IncludeRules and per-rule formatting options for indentation (4 spaces), brace placement, whitespace, assignment alignment, quote handling, and casing.
Test Harness and Runner
tests/run.ps1, tests/Linter.Tests.ps1
Implements test runner with Pester configuration and test suite that loads formatting/linting rules, runs Invoke-ScriptAnalyzer recursively, asserts zero diagnostics, and prints colorized per-severity failure details.
Development Environment Settings
.vscode/settings.json
Updates PowerShell script analysis settingsPath to point to the new .pslintrules.psd1 configuration file.
CI Workflow
.github/workflows/ci.yml
Adds CI workflow triggering on push/pull_request events, checking out code on windows-latest, caching PowerShell modules for PSScriptAnalyzer and Pester, and executing ./tests/run.ps1.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

A rabbit hops through formatting rules so neat,
With Pester tests that make the code complete,
From linting checks to workflows that compile,
PowerShell quality shines with every style! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: add code linting and formatting' accurately summarizes the main changes: adding PSScriptAnalyzer linting rules, formatting rules, CI workflow, and test infrastructure for code quality validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Line 1: Normalize the .github/workflows/ci.yml file to use LF line endings
instead of CRLF: open the file and convert all line endings to LF, commit the
change, and optionally add/update a .gitattributes entry (e.g., for *.yml text
eol=lf) to prevent future CRLF commits; ensure CI/lint passes locally after
conversion before pushing.

In `@tests/Linter.Tests.ps1`:
- Around line 23-27: Initialize $type before the extension switch (or add a
default branch) to avoid carrying a stale value when $r.ScriptName doesn't match
'*.psm1','*.ps1', or '*.psd1'; update the switch block that uses "switch
-wildCard ($r.ScriptName)" (and the similar block around lines 53-57) so that
$type is either set to a safe default prior to the switch or add a default
pattern (e.g., Default) that assigns an explicit value, ensuring tests/logs
never reuse a previous record's $type.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 68c4a255-171b-496f-b9c9-052f7b25b1a3

📥 Commits

Reviewing files that changed from the base of the PR and between 6f53ec8 and c585512.

📒 Files selected for processing (6)
  • .github/workflows/ci.yml
  • .psformatrules.psd1
  • .pslintrules.psd1
  • .vscode/settings.json
  • tests/Linter.Tests.ps1
  • tests/run.ps1

Comment thread .github/workflows/ci.yml
Comment thread tests/Linter.Tests.ps1
@chawyehsu chawyehsu force-pushed the push-rmvtqkklxyoo branch 7 times, most recently from b90c316 to 3836a66 Compare May 7, 2026 12:26
@chawyehsu
Copy link
Copy Markdown
Member Author

CI is expected to fail as I haven't touched src files to fix all linting/formatting errors

@chawyehsu chawyehsu force-pushed the push-rmvtqkklxyoo branch from 3836a66 to 92918f6 Compare May 7, 2026 12:44
Signed-off-by: Chawye Hsu <su+git@chawyehsu.com>
@chawyehsu chawyehsu force-pushed the push-rmvtqkklxyoo branch from 92918f6 to 4a34bfd Compare May 7, 2026 12:50
@chawyehsu chawyehsu merged commit c9e2207 into ScoopInstaller:main May 7, 2026
1 of 2 checks passed
@chawyehsu chawyehsu mentioned this pull request May 7, 2026
@chawyehsu chawyehsu deleted the push-rmvtqkklxyoo branch May 8, 2026 10:19
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.

1 participant