Skip to content

Add tests and coverage report, update modules - #18

Merged
aeiwz merged 1 commit into
mainfrom
origin/dev/refactor-code
May 28, 2026
Merged

Add tests and coverage report, update modules#18
aeiwz merged 1 commit into
mainfrom
origin/dev/refactor-code

Conversation

@aeiwz

@aeiwz aeiwz commented May 28, 2026

Copy link
Copy Markdown
Owner

This pull request introduces several improvements and bug fixes across the codebase, focusing on enhanced logging, improved error handling, and minor API and UI adjustments. The most significant change is the refactoring of metbit/nmr_preprocess.py to replace print-based debugging with structured logging, making the codebase cleaner and more maintainable. Additional changes improve error handling and user feedback, and update UI components for better accessibility and consistency.

Logging and Debugging Improvements:

  • Replaced all print statements with Python's logging module for debug, info, and error messages in metbit/nmr_preprocess.py, providing more structured and configurable logging throughout the NMR preprocessing pipeline. [1] [2] [3] [4] [5] [6] [7] [8]

Error Handling and API Robustness:

  • Improved error raising in metbit/peak_processe.py by raising a ValueError instead of printing and raising, ensuring proper exception handling.
  • Added validation to plotting methods in metbit/plotting.py to require file_name when save_plot=True, raising a ValueError if not provided. Also fixed the type annotation for the file_name parameter in splot. [1] [2] [3] [4]
  • Added a check in metbit/pretreatment.py to raise a ValueError for unknown scaler types, improving input validation.
  • Fixed logic in metbit/pls.py to handle n_comp=None by setting it to the minimum of sample and feature count, and corrected component indexing in predict. [1] [2]

UI and Accessibility Enhancements:

  • Updated the ThemeToggle component in docs/app/components/ThemeToggle.tsx to explicitly set type="button" on all buttons, improving accessibility and preventing unintended form submissions. [1] [2] [3]
  • Replaced anchor tags with Next.js Link components in docs/app/page.tsx for navigation, ensuring proper client-side routing and accessibility.

Minor Refactors and Cleanups:

  • Removed unnecessary return print(...) statements in several methods, replacing them with just print(...) for clarity and correctness in metbit/genpage.py, metbit/lazy_opls_da.py, and metbit/metbit.py. [1] [2] [3] [4] [5]

These changes collectively improve the maintainability, reliability, and usability of the codebase.Add a comprehensive test suite and coverage output (coverage.json); update pytest.ini and include many new test files under tests/. Update docs components (docs/app/components/ThemeToggle.tsx and docs/app/page.tsx). Modify multiple metbit modules and include regenerated pycache (.pyc) artifacts. Update .gitignore to ignore metbit/pycache.

Add a comprehensive test suite and coverage output (coverage.json); update pytest.ini and include many new test files under tests/. Update docs components (docs/app/components/ThemeToggle.tsx and docs/app/page.tsx). Modify multiple metbit modules and include regenerated __pycache__ (.pyc) artifacts. Update .gitignore to ignore metbit/__pycache__.
Copilot AI review requested due to automatic review settings May 28, 2026 02:42
@aeiwz aeiwz added dependencies Pull requests that update a dependency file enhancement New feature or request help wanted Extra attention is needed labels May 28, 2026
@aeiwz
aeiwz merged commit 3beb702 into main May 28, 2026
6 of 7 checks passed
@aeiwz
aeiwz removed the request for review from Copilot May 28, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement New feature or request help wanted Extra attention is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant