Skip to content

Improve code quality and add status badges to README - #23

Merged
Malcolmnixon merged 2 commits into
mainfrom
chore/codeql-findings-cleanup
Jul 25, 2026
Merged

Improve code quality and add status badges to README#23
Malcolmnixon merged 2 commits into
mainfrom
chore/codeql-findings-cleanup

Conversation

@Malcolmnixon

Copy link
Copy Markdown
Member

This pull request contains a mix of documentation improvements, codebase refactoring, and enhanced error handling. The most significant changes include the addition of project status badges to the README.md, improved error handling and user feedback throughout the UI event boundaries, refactoring of several view models to use public properties for data binding, and documentation clarifications for the file watcher subsystem. There are also minor code improvements for path handling and syntax highlighting safety.

Documentation and Project Metadata:

  • Added GitHub and quality badges to the top of README.md and defined their references at the bottom for improved project visibility and status reporting. [1] [2]
  • Clarified terminology and method descriptions in the file watcher subsystem documentation, replacing references to PendingChanges with "pending-change set" and updating method signatures and descriptions for accuracy. [1] [2] [3] [4] [5]

Error Handling and User Feedback:

  • Added comprehensive, intentionally broad exception handling with explanatory comments to all major UI event boundaries (file/folder open, close all, drag-and-drop, and predefined view selection) to ensure user-facing error messages and prevent application crashes. [1] [2] [3] [4] [5]

ViewModel Refactoring for Data Binding:

  • Changed several private fields in view models to public partial properties using [ObservableProperty] for improved data binding and testability in DiagnosticsToolViewModel, PredefinedViewsToolViewModel, and QueryDialogViewModel. [1] [2] [3]

Code Quality and Safety Improvements:

  • Updated file path handling to use PathHelpers.SafePathCombine for safer path construction in application initialization and design-time shell factory. [1] [2]
  • Added a bounded timeout to the regular expression used for keyword syntax highlighting to prevent catastrophic backtracking on user input.
  • Added explanatory comments to reflection-based keyword extraction for maintainability and graceful degradation.

Other Minor Improvements:

  • Refactored static/shared constants in AboutDialogViewModel and eliminated string literal duplication for license names. [1] [2]
  • Minor corrections in dock layout initialization and event handler signatures. [1] [2]

These changes collectively improve project documentation, robustness, maintainability, and the user experience.

Malcolm Nixon and others added 2 commits July 24, 2026 14:52
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
CodeQL cleanup:
- Add internal PathHelpers.SafePathCombine helper (src + duplicate in
  IntegrationTests, which has no ProjectReference to main by design) and
  replace ~95 Path.Combine call sites across src and test projects to
  resolve cs/path-combine findings.
- Add clarifying comments to 10 intentionally-broad catch-of-all-exceptions
  sites (UI/drag-drop/best-effort boundaries) rather than narrowing, since
  narrowing would contradict their documented never-throws contracts.
- Fix 2 cs/linq/missed-select findings, 1 missed-readonly-modifier
  (ViewDefinitionModel._exposeTargets), 1 useless-upcast, and 1
  dispose-not-called-on-throw (WorkspaceSubsystemTests).
- Refactor AppFixture.cs's LinuxDriver into a Create factory method that
  disposes its HttpCommandExecutor on constructor failure, fixing a
  cs/local-not-disposed finding.

SonarQube cleanup:
- Remove a redundant null-forgiving operator and add a Regex timeout and a
  reflection-safety comment in SourceTextDocumentView.axaml.cs.
- Make AboutDialogViewModel's ApplicationName/Tagline/Copyright,
  SysmlSnippetGenerator.SanitizeIdentifier, and two Avalonia drag-over
  handlers static where they access no instance state.
- Introduce a shared MIT-license constant and replace a LINQ
  FirstOrDefault with a Count/indexer check.
- Rename FileWatcher.PendingChanges (a collection-copying property) to
  GetPendingChanges(), updating all call sites and its design doc.
- Extract a helper method from ViewDefinitionModel.ValidateAgainstWorkspace
  to reduce cognitive complexity.
- Convert ~20 CommunityToolkit.Mvvm [ObservableProperty] backing fields
  across 7 view models to C# 13 partial auto-properties.
- Add a missing assertion to a previously assertion-less test case
  (DiagramDocumentViewModelTests.CopyAsSysmlAsync_NoClipboardServiceAssigned_DoesNotThrow).

Also adds README badges (forks/stars/contributors/license/build/SonarCloud
quality/security/GitHub Release).

All changes validated: dotnet build (0 warnings/errors), build.ps1 -Test
(290/290 passed), build.ps1 -IntegrationTest (10/10 passed), dotnet
reqstream --lint (clean), lint.ps1 (clean). Reviewed via code-review and
formal-review agents (gpt-5.4-mini) across all 18 affected review-sets,
all confirmed SUCCEEDED.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Malcolmnixon
Malcolmnixon merged commit 1caa1f3 into main Jul 25, 2026
7 checks passed
@Malcolmnixon
Malcolmnixon deleted the chore/codeql-findings-cleanup branch July 25, 2026 00:30
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