Skip to content

Reorder all function definitions before use in resize.js (fixes Codacy issues)#7095

Open
stweil wants to merge 1 commit into
kitodo:mainfrom
stweil:fix_codacy_issue
Open

Reorder all function definitions before use in resize.js (fixes Codacy issues)#7095
stweil wants to merge 1 commit into
kitodo:mainfrom
stweil:fix_codacy_issue

Conversation

@stweil

@stweil stweil commented Jun 24, 2026

Copy link
Copy Markdown
Member

Move every function declaration before the first call sites to eliminate Codacy 'defined before used' warnings for:

resizeMap, toggleCollapseButtons, resizeSecondAndThird,
handleMouseDown, resizeFirstAndSecond, resizeFirstAndThird,
resizeVerticalFirstColumn, resizeVerticalSecondColumn, getElements,
setSizes, setSectionHeightFirstColumn, setSectionHeightSecondColumn,
toggleResizers, toggleCollapseButtons, toggleSecondColumn,
updateMetadataEditorView.

Assisted-by: qwen3.6-36b (Alibaba)

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

…y issues)

Move every function declaration before the first call sites to
eliminate Codacy 'defined before used' warnings for:

  resizeMap, toggleCollapseButtons, resizeSecondAndThird,
  handleMouseDown, resizeFirstAndSecond, resizeFirstAndThird,
  resizeVerticalFirstColumn, resizeVerticalSecondColumn, getElements,
  setSizes, setSectionHeightFirstColumn, setSectionHeightSecondColumn,
  toggleResizers, toggleCollapseButtons, toggleSecondColumn,
  updateMetadataEditorView.

Assisted-by: qwen3.6-36b (Alibaba)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
@stweil stweil force-pushed the fix_codacy_issue branch from dd54dcc to ae1cdf3 Compare June 24, 2026 10:09
@stweil

stweil commented Jun 24, 2026

Copy link
Copy Markdown
Member Author

Codacy reports 12 solved issues for this PR.

@solth solth requested a review from thomaslow June 24, 2026 12:35
@thomaslow

Copy link
Copy Markdown
Member

@stweil Did you copy/paste these functions yourself or did you rely on Qwen to re-generate them 1:1 in a different place? I wouldn't really want to check whether there might be a one-character copy/paste mistake made by Qwen somewhere.

@stweil

stweil commented Jun 24, 2026

Copy link
Copy Markdown
Member Author

Qwen claimed to have fixed all issues, but had only moved two functions (both correct). I fixed the rest manually by cut+paste operations.

@stweil

stweil commented Jun 24, 2026

Copy link
Copy Markdown
Member Author

@thomaslow, here is a manual check:

stweil@dock02 kitodo-production % git show HEAD~1:Kitodo/src/main/webapp/WEB-INF/resources/js/resize.js|sort >old
stweil@dock02 kitodo-production % git show HEAD:Kitodo/src/main/webapp/WEB-INF/resources/js/resize.js|sort >new 

stweil@dock02 kitodo-production % wc old new
     539    1647   24150 old
     540    1647   24151 new

stweil@dock02 kitodo-production % diff -u old new
--- old 2026-06-24 17:46:34
+++ new 2026-06-24 17:46:41
@@ -53,6 +53,7 @@
 
 
 
+
                 firstColumn.animate({width: firstColumn.data('min-width')});
                 firstColumn.animate({width: firstColumn.data('min-width')});
                 firstColumn.animate({width: firstColumnWidth - substractFromWidth});

secondSectionFirstColumn.height(sectionWrapperPosFirstColumn + sectionWrapperHeightFirstColumn - e.pageY - SEPARATOR_HEIGHT - HEADING_HEIGHT);
}
}

@stweil stweil Jun 24, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Here I added an empty line. Therefore the new file has one more line than the old one.

@thomaslow

Copy link
Copy Markdown
Member

@stweil Thank you for clarifying. Nice idea sorting both files to check whether they are identical (apart from the order).

@thomaslow thomaslow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Resizing in the metadata editor works the same as before.

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.

2 participants