Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some issues which were reported by Codacy #4266

Merged
merged 2 commits into from
Jun 11, 2024
Merged

Conversation

stweil
Copy link
Contributor

@stweil stweil commented Jun 11, 2024

No description provided.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Apply also some smaller optimizations and add TODO comments
for local variables which require further examination.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
@stweil
Copy link
Contributor Author

stweil commented Jun 11, 2024

According to Codacy this pull request fixes about 32 issues (from a total of currently 590 issues), so much more work remains to be done.

@egorpugin
Copy link
Contributor

Is it possible to use auto in more places?

while (page_res_it.word() != nullptr && page_res_it.block() == current_block) {
current_row = page_res_it.row();
ROW_RES *current_row = page_res_it.row();
Copy link
Contributor

Choose a reason for hiding this comment

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

auto?

@@ -539,7 +533,7 @@ void Tesseract::tilde_delete(PAGE_RES_IT &page_res_it) {

page_res_it.restart_page();
while (page_res_it.word() != nullptr) {
word = page_res_it.word();
WERD_RES *word = page_res_it.word();
Copy link
Contributor

Choose a reason for hiding this comment

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

auto?

@@ -183,7 +182,7 @@ void Tesseract::fix_fuzzy_space_list(WERD_RES_LIST &best_perm, ROW *row, BLOCK *

while ((best_score != PERFECT_WERDS) && !current_perm.empty()) {
match_current_words(current_perm, row, block);
current_score = eval_word_spacing(current_perm);
int16_t current_score = eval_word_spacing(current_perm);
Copy link
Contributor

Choose a reason for hiding this comment

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

auto?

WERD_RES *new_wd;

for (src_it.mark_cycle_pt(); !src_it.cycled_list(); src_it.forward()) {
src_wd = src_it.data();
WERD_RES *src_wd = src_it.data();
Copy link
Contributor

Choose a reason for hiding this comment

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

auto?

@stweil
Copy link
Contributor Author

stweil commented Jun 11, 2024

Is it possible to use auto in more places?

Yes, sure, but sometimes I want to be able to see the data types explicitly for myself, and in other cases more work is needed to verify that auto or auto * really gives the same result.

Maybe some tools can auto-fy the code automatically. Then we could consider using such tools in separate commits.

@stweil stweil merged commit 96772c5 into tesseract-ocr:main Jun 11, 2024
7 checks passed
@stweil stweil deleted the codacy branch June 11, 2024 15:53
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.

None yet

2 participants