Skip to content

clean(ZMSKVR): CodeQL fixes for ASI, unused bindings, and dead code#2134

Open
ThomasAFink wants to merge 6 commits intomainfrom
clean-unused-vars-and-semicolon-insertions
Open

clean(ZMSKVR): CodeQL fixes for ASI, unused bindings, and dead code#2134
ThomasAFink wants to merge 6 commits intomainfrom
clean-unused-vars-and-semicolon-insertions

Conversation

@ThomasAFink
Copy link
Copy Markdown
Member

@ThomasAFink ThomasAFink commented Mar 24, 2026

  • Add explicit semicolons where ASI was relied on (vitest afterAll, ticketprinter form loop).
  • Remove unused imports and variables across zmsadmin, zmscitizenview, and zmsticketprinter.
  • Wire graph timetable conflict layer; mark selected availability row with aria-selected.
  • Drop redundant test config and simplify apiStatusService downtime test.

Pull Request Checklist (Feature Branch to next):

  • Ich habe die neuesten Änderungen aus dem next Branch in meinen Feature-Branch gemergt.
  • Relevante Tests wurden mit zmsautomation ausgeführt.
  • Das Code-Review wurde abgeschlossen.
  • Fachliche Tests wurden durchgeführt und sind abgeschlossen.

Summary by CodeRabbit

  • Refactor

    • Improved table row accessibility with explicit selection state
    • Streamlined conflict layer rendering logic
  • Bug Fixes

    • Ensure print dialog opens correctly on page load
    • Escape key now reliably minimizes emergency panel
    • Stabilized reload timer initialization to avoid unexpected behavior
  • Chores

    • Removed unused imports and cleaned up formatting across code and tests
- Add explicit semicolons where ASI was relied on (vitest afterAll, ticketprinter form loop). - Remove unused imports and variables across zmsadmin, zmscitizenview, and zmsticketprinter. - Wire graph timetable conflict layer; mark selected availability row with aria-selected. - Drop redundant test config and simplify apiStatusService downtime test.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 24, 2026

Warning

Rate limit exceeded

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

⌛ 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f5ccbd3d-39e0-4a36-8a88-f934f2361d43

📥 Commits

Reviewing files that changed from the base of the PR and between f135009 and c876da2.

📒 Files selected for processing (6)
  • zmsadmin/js/block/emergency/index.js
  • zmsadmin/js/lib/baseview.js
  • zmsadmin/js/page/availabilityDay/form/datepicker.js
  • zmsapi/bin/build_swagger.js
  • zmscitizenview/src/components/Appointment/AppointmentSelection/ListView.vue
  • zmsticketprinter/js/page/process.js
📝 Walkthrough

Walkthrough

Small-scale code cleanup and minor behavior clarifications across multiple projects: removed unused imports/variables, tightened conditionals and boolean coercion, adjusted event handlers and callback branching, and standardized statement terminators; no public APIs or major control flows were introduced.

Changes

Cohort / File(s) Summary
zmsadmin — availability form & validation
zmsadmin/js/page/availabilityDay/form/datepicker.js, zmsadmin/js/page/availabilityDay/form/validate.js
Removed unused repeat import; removed unused hour/minute parsing variables; minor punctuation/terminator adjustments.
zmsadmin — availability page & layouts
zmsadmin/js/page/availabilityDay/index.js, zmsadmin/js/page/availabilityDay/layouts/graphBody.js, zmsadmin/js/page/availabilityDay/layouts/tableBody.js, zmsadmin/js/page/availabilityDay/timetable/graphview.js
Deleted unused germanWeekdays; replaced conflicts() helper with renderConflictLayer() returning null when disabled; explicit Boolean() coercion for row selection and added aria-selected; removed unused Workload import.
zmsadmin — misc view and base utilities
zmsadmin/js/block/emergency/index.js, zmsadmin/js/lib/baseview.js, zmsadmin/js/page/workstation/index.js
Converted event listener to arrow function and fixed Escape-key call; refactored lightbox callback branching from nested ternary to explicit if/else; initialized reloadTimer = null.
zmsstatistic — baseview
zmsstatistic/js/lib/baseview.js
Adjusted lightbox teardown callback to conditionally call callback() only when appropriate and removed unconditional destroyLightbox() call from that path.
zmsticketprinter — pages & init
zmsticketprinter/js/index.js, zmsticketprinter/js/page/main.js, zmsticketprinter/js/page/process.js
Fixed jQuery initializer termination and ensured printDialog() is invoked; removed unused jquery import.
zmsadmin tests / browser config
zmsadmin/tests/browser/lib/config.js, zmsadmin/tests/browser/source.js
Removed unused baseUrlEnv constant and unused getPageUrl import.
zmscitizenview — utils
zmscitizenview/src/utils/calculateEstimatedDuration.ts
Removed unused SubService type import; logic unchanged.
zmscitizenview — unit tests
zmscitizenview/tests/unit/...
Appointment/.../CalendarView.spec.ts, ListView.spec.ts, AppointmentView.spec.ts, ServiceFinder/SubserviceListItem.spec.ts, AppointmentDetail/AppointmentDetailView.spec.ts, AppointmentOverview/AppointmentOverviewView.spec.ts, AppointmentOverview/AppointmentSliderView.spec.ts, utils/apiStatusService.spec.ts
Removed unused Vitest imports (vi, beforeEach), standardized afterAll semicolons, and removed an unnecessary mock response/stub in apiStatusService tests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nibbled unused lines away,

Trimmed imports and fixed the play,
Semicolons hopped in place,
Booleans wear a clearer face,
A tidy burrow, code will stay. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main focus: removing unused imports/variables, adding explicit semicolons, and fixing code quality issues identified by CodeQL analysis across multiple modules.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch clean-unused-vars-and-semicolon-insertions

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
Contributor

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
zmsticketprinter/js/index.js (1)

6-6: ⚠️ Potential issue | 🟡 Minor

Remove console.log() statements and replace with proper logging or delete.

The imported jQuery version (4.0.0) is correctly specified and all used APIs (.each(), .on(), .prop(), .addClass(), .closest(), .submit()) remain fully compatible with jQuery 4.0.0. However, the code contains three console.log() statements (lines 24, 27, 35) that should be removed per the coding guidelines. For development purposes, replace with console.debug() if logging is needed; for production, remove entirely.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@zmsticketprinter/js/index.js` at line 6, Remove the three console.log(...) calls in zmsticketprinter/js/index.js (the ones at the previous review lines 24, 27 and 35) and either delete them for production or replace them with console.debug(...) if you need debug-level output during development; search for the exact "console.log" invocations inside the event handlers (e.g., the change/submit handlers and any functions referenced by .each(), .on(), or .submit()) and update those calls accordingly so no console.log remains. 
🧹 Nitpick comments (3)
zmsadmin/js/page/availabilityDay/layouts/tableBody.js (1)

87-88: Consider using strict equality (===) for comparisons.

The comparisons use loose equality (==), which can produce unexpected results with type coercion. If id values may be strings or numbers, consider normalizing types explicitly:

♻️ Suggested refactor for explicit type handling
 const isSelected = Boolean(data && ( - (data.id && availability.id == data.id) ||  - (data.tempId && availability.tempId == data.tempId) + (data.id && String(availability.id) === String(data.id)) ||  + (data.tempId && String(availability.tempId) === String(data.tempId)) ));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@zmsadmin/js/page/availabilityDay/layouts/tableBody.js` around lines 87 - 88, The comparisons use loose equality (==) between data.id/availability.id and data.tempId/availability.tempId which can cause type-coercion bugs; update the checks to use strict equality (===) and, if ids may be different types (string vs number), normalize both sides to the same type before comparing (e.g., convert both availability.id and data.id to string or number) so the (data.id && availability.id === data.id) and (data.tempId && availability.tempId === data.tempId) style checks are robust and type-safe. 
zmsadmin/js/page/availabilityDay/form/datepicker.js (1)

12-12: Consider removing commented-out import.

This commented-out import for formatTimestampDate should be removed entirely rather than left commented. The same applies to other commented-out code blocks in this file (lines 239-250, 272-274, 327).

As per coding guidelines: "Don't comment out code. Just remove."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@zmsadmin/js/page/availabilityDay/form/datepicker.js` at line 12, Remove the leftover commented-out import for formatTimestampDate and delete the other commented-out code blocks in this file (the stashed blocks around the datepicker logic and unused helpers) rather than leaving them commented; specifically remove the commented import "formatTimestampDate" and any commented sections related to date formatting/unused helper code so the module only contains active code, then run the linter/formatter to ensure no trailing whitespace or unused-import warnings remain. 
zmsticketprinter/js/index.js (1)

23-28: Remove or replace console.log() statements.

These console.log() calls should be removed or replaced according to the coding guidelines. For development-only debugging, use console.debug(). For production code, these should be removed entirely.

♻️ Proposed fix
 if ($('.digitaluhr').length > 0) { - console.log('Found digitaluhr elements, initializing DigitalTime...'); $('.digitaluhr').each(function() { new DigitalTime(this); }); -} else { - console.log('No digitaluhr elements found.'); }

And remove line 35:

-console.log("Welcome to the ZMS Ticketprinter interface...");

As per coding guidelines: "Flag any usage of console.log() as it should be replaced with proper logging or removed."

Also applies to: 35-35

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@zmsticketprinter/js/index.js` around lines 23 - 28, Replace the development console.log calls around the DigitalTime initialization with the appropriate action: either remove them entirely for production or change them to console.debug() for dev-only logging; specifically update the two console.log occurrences that announce finding/initializing or not finding elements around the DigitalTime setup so no console.log remains and use console.debug(...) if you still want debug output. 
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed. Outside diff comments: In `@zmsticketprinter/js/index.js`: - Line 6: Remove the three console.log(...) calls in zmsticketprinter/js/index.js (the ones at the previous review lines 24, 27 and 35) and either delete them for production or replace them with console.debug(...) if you need debug-level output during development; search for the exact "console.log" invocations inside the event handlers (e.g., the change/submit handlers and any functions referenced by .each(), .on(), or .submit()) and update those calls accordingly so no console.log remains. --- Nitpick comments: In `@zmsadmin/js/page/availabilityDay/form/datepicker.js`: - Line 12: Remove the leftover commented-out import for formatTimestampDate and delete the other commented-out code blocks in this file (the stashed blocks around the datepicker logic and unused helpers) rather than leaving them commented; specifically remove the commented import "formatTimestampDate" and any commented sections related to date formatting/unused helper code so the module only contains active code, then run the linter/formatter to ensure no trailing whitespace or unused-import warnings remain. In `@zmsadmin/js/page/availabilityDay/layouts/tableBody.js`: - Around line 87-88: The comparisons use loose equality (==) between data.id/availability.id and data.tempId/availability.tempId which can cause type-coercion bugs; update the checks to use strict equality (===) and, if ids may be different types (string vs number), normalize both sides to the same type before comparing (e.g., convert both availability.id and data.id to string or number) so the (data.id && availability.id === data.id) and (data.tempId && availability.tempId === data.tempId) style checks are robust and type-safe. In `@zmsticketprinter/js/index.js`: - Around line 23-28: Replace the development console.log calls around the DigitalTime initialization with the appropriate action: either remove them entirely for production or change them to console.debug() for dev-only logging; specifically update the two console.log occurrences that announce finding/initializing or not finding elements around the DigitalTime setup so no console.log remains and use console.debug(...) if you still want debug output. 

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: bea8b92e-b43e-472b-a409-7f4798f34b15

📥 Commits

Reviewing files that changed from the base of the PR and between 56d5bd0 and dc8eae8.

📒 Files selected for processing (19)
  • zmsadmin/js/page/availabilityDay/form/datepicker.js
  • zmsadmin/js/page/availabilityDay/form/validate.js
  • zmsadmin/js/page/availabilityDay/index.js
  • zmsadmin/js/page/availabilityDay/layouts/graphBody.js
  • zmsadmin/js/page/availabilityDay/layouts/tableBody.js
  • zmsadmin/js/page/availabilityDay/timetable/graphview.js
  • zmsadmin/tests/browser/lib/config.js
  • zmsadmin/tests/browser/source.js
  • zmscitizenview/src/utils/calculateEstimatedDuration.ts
  • zmscitizenview/tests/unit/Appointment/AppointmentSelection/CalendarView.spec.ts
  • zmscitizenview/tests/unit/Appointment/AppointmentSelection/ListView.spec.ts
  • zmscitizenview/tests/unit/Appointment/AppointmentView.spec.ts
  • zmscitizenview/tests/unit/Appointment/ServiceFinder/SubserviceListItem.spec.ts
  • zmscitizenview/tests/unit/AppointmentDetail/AppointmentDetailView.spec.ts
  • zmscitizenview/tests/unit/AppointmentOverview/AppointmentOverviewView.spec.ts
  • zmscitizenview/tests/unit/AppointmentOverview/AppointmentSliderView.spec.ts
  • zmscitizenview/tests/unit/utils/apiStatusService.spec.ts
  • zmsticketprinter/js/index.js
  • zmsticketprinter/js/page/main.js
💤 Files with no reviewable changes (8)
  • zmsadmin/js/page/availabilityDay/timetable/graphview.js
  • zmsticketprinter/js/page/main.js
  • zmsadmin/tests/browser/lib/config.js
  • zmsadmin/tests/browser/source.js
  • zmscitizenview/src/utils/calculateEstimatedDuration.ts
  • zmscitizenview/tests/unit/utils/apiStatusService.spec.ts
  • zmsadmin/js/page/availabilityDay/form/validate.js
  • zmsadmin/js/page/availabilityDay/index.js
- Ticketprinter: call printDialog on DOM ready with correct this binding. - zmsadmin/zmsstatistic baseview: replace useless ternary no-ops in lightbox/dialog callbacks. - Workstation: initialize reloadTimer to null instead of no-op expression. - Emergency: ESC handler uses arrow function and this.minimize().
- datepicker: drop redundant startDate/endDate updates in updateState when name/date set. - build_swagger: readApiVersion returns VERSION via readFileContent (sync), not async callback. - ListView: remove unused newDayPart initializer; assign only in branches.
Copy link
Copy Markdown
Contributor

@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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed. Inline comments: In `@zmsadmin/js/block/emergency/index.js`: - Line 36: Remove the stray console.log('ESC') from the Escape handler to avoid debug output in production UI code; locate the Escape handler (the key/event handler that logs "ESC") and either delete the console.log call or replace it with the approved structured logging API used in the project, ensuring no raw console.log remains in that handler. In `@zmsadmin/js/lib/baseview.js`: - Around line 155-160: The background-click branch inside the lightbox callback only calls abortCallback() and neglects to restore focus to returnTarget like the normal abort path; update that branch (the anonymous callback passed to lightbox where callbackAsBackgroundAction, callback, and abortCallback are checked) to also call returnTarget.focus() (or the existing focus-restoration helper used elsewhere) after invoking abortCallback(), ensuring lightboxContentElement/destroyLightbox flows restore focus consistently for background dismissals. In `@zmsticketprinter/js/page/process.js`: - Around line 9-12: Remove the stray console.log on the ready path by deleting or replacing the console.log('Print data and redirect to home url after presetted time') call; ensure the ready handler still invokes this.printDialog() (the printDialog function) but uses the project's approved logging mechanism if a log is required (e.g., replace with the centralized logger or remove entirely) so no console.log/console.debug/console.warn remain in this execution path. 

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 49038aa6-1a92-4e82-910c-4c1d4b6dae99

📥 Commits

Reviewing files that changed from the base of the PR and between dc8eae8 and f135009.

📒 Files selected for processing (5)
  • zmsadmin/js/block/emergency/index.js
  • zmsadmin/js/lib/baseview.js
  • zmsadmin/js/page/workstation/index.js
  • zmsstatistic/js/lib/baseview.js
  • zmsticketprinter/js/page/process.js
ThomasAFink and others added 2 commits March 24, 2026 22:36
 Update zmsadmin/js/block/emergency/index.js Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- baseview: runUserAbortCallback + focusReturnTarget; restore returnTarget focus when closing lightbox via background (not only dialog abort). - ticketprinter process: remove constructor and beforePrint console.log per logging guidelines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment