Skip to content

Pre commit fix #115

Merged
tekrajchhetri merged 12 commits into
sensein:mainfrom
djarecka:pre-commit_fix_new
Apr 15, 2026
Merged

Pre commit fix #115
tekrajchhetri merged 12 commits into
sensein:mainfrom
djarecka:pre-commit_fix_new

Conversation

@djarecka

Copy link
Copy Markdown
Contributor

I run pre-commit, some issues were fixed automatically, spelling issues and poetry I had to solve manually. I also modify pre-commit to remove the fix that perhaps shouldn't be run, mostly:

  • removing checks for svg, pdf and images files
  • removing checks on json files since I believe these files are always files with results, and shouldn' t be probably formatted, we can think about it later
  • removed checks from evaluation directory, except for yaml, md and py files

There are no other changes in this commit. I will add the description to CONTRIBUTING in a separate PR, to keep this PR clean.

If you want to change specific settings, let me know, otherwise we can just merge it and start using.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request primarily focuses on refactoring and cleaning up the codebase, including improvements to pre-commit configurations, memory management, and logging. My feedback highlights opportunities to reduce duplication in configuration files, improve robustness in environment variable handling, and optimize performance in loops.

Comment thread .pre-commit-config.yaml Outdated
Comment on lines +36 to +38
exclude: \.(pdf|svg|png|jpg|jpeg|zip|json)$|^evaluation/(?!.*\.(md|yaml|py)$).*$
- id: trailing-whitespace
- id: pretty-format-json
args:
- --autofix
- --indent=4
- --no-sort-keys
exclude: \.(pdf|svg|png|jpg|jpeg|zip|json)$|^evaluation/(?!.*\.(md|yaml|py)$).*$

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The exclude regex patterns are repeated for both end-of-file-fixer and trailing-whitespace. Consider defining a shared anchor or using a more centralized configuration approach to avoid duplication and improve maintainability.

os.getenv("LOCAL_CONCEPT_MAPPING_API_KEY", "").strip()
or os.getenv("OPENROUTER_API_KEY", "").strip()
)
v = os.getenv("LOCAL_CONCEPT_MAPPING_API_KEY", "").strip() or os.getenv("OPENROUTER_API_KEY", "").strip()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The use of or for environment variable fallback is correct, but ensure that os.getenv is not returning an empty string that might be treated as a valid API key. Using or on a stripped string is generally safe, but explicit checks for non-empty values are more robust.

t for t in key_terms
if isinstance(t, str) and t.strip() and t.strip().lower() in text_lower
]
key_terms_valid = [t for t in key_terms if isinstance(t, str) and t.strip() and t.strip().lower() in text_lower]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The inject_alignment_concept_mapping_into_ner_entities function is called inside a loop. If this function performs heavy operations, consider batching or optimizing the call to avoid performance bottlenecks.

@codecov-commenter

codecov-commenter commented Apr 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 16.90821% with 172 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@4a4bc89). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/structsense/app.py 0.00% 44 Missing ⚠️
src/utils/postprocessing.py 15.21% 39 Missing ⚠️
src/utils/crew_utils.py 0.00% 36 Missing ⚠️
src/utils/conceptmappingtool.py 11.11% 16 Missing ⚠️
src/utils/conceptmappinglocal.py 0.00% 7 Missing ⚠️
src/utils/ner_tool.py 0.00% 7 Missing ⚠️
src/utils/text_chunking.py 16.66% 5 Missing ⚠️
src/utils/context_window_manager.py 63.63% 4 Missing ⚠️
src/utils/json_repair_tool.py 0.00% 3 Missing ⚠️
src/structsense/cli.py 0.00% 2 Missing ⚠️
... and 6 more
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #115   +/-   ##
=======================================
  Coverage        ?   15.48%           
=======================================
  Files           ?       28           
  Lines           ?     6850           
  Branches        ?        0           
=======================================
  Hits            ?     1061           
  Misses          ?     5789           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@djarecka

Copy link
Copy Markdown
Contributor Author

I was getting error since the new changes to main had some extra spaces, but now everything is fine

@tekrajchhetri
tekrajchhetri merged commit 115bae1 into sensein:main Apr 15, 2026
6 checks passed
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.

4 participants