harshith1118 commented on PR #1402:
URL: https://github.com/apache/hamilton/pull/1402#issuecomment-3392798949

   Hi  *skrawcz.*
   
   I've resolved the pre-commit errors that were occurring in the Hamilton
   project:
      1. Fixed the B904 error in hamilton/cli/logic.py - changed the exception
   handling in the _read_toml_context
         function to use raise ImportError(...) from None instead of just
   raise ImportError(...) to properly chain
          the exception as required by the linter.
      2. Fixed end-of-file issues in the TOML test files (test_context.toml
   and test_tool_hamilton.toml) by
         ensuring they properly end with newlines as expected by the
   pre-commit hook.
      3. Some additional minor formatting changes were made by the
   auto-formatter (like changing single quotes to
         double quotes and minor spacing adjustments).
     All tests are passing and the pre-commit checks should now run
   successfully without errors. The changes
     maintain the same functionality while meeting the code quality standards
   required by the project's
     pre-commit hooks.
   
   On Fri, 10 Oct 2025 at 11:55, Stefan Krawczyk ***@***.***>
   wrote:
   
   > *skrawcz* left a comment (apache/hamilton#1402)
   > <https://github.com/apache/hamilton/pull/1402#issuecomment-3388454435>
   >
   > @harshith1118 <https://github.com/harshith1118> can you fix the
   > pre-commit errors please:
   >
   > 
ruff.....................................................................Failed
   > - hook id: ruff
   > - exit code: 1
   > - files were modified by this hook
   >
   > hamilton/cli/logic.py:349:9: B904 Within an `except` clause, raise 
exceptions with `raise ... from err` or `raise ... from None` to distinguish 
them from errors in exception handling
   >     |
   > 347 |       except ImportError:
   > 348 |           # Provide a helpful error message if tomli is not available
   > 349 |           raise ImportError(
   >     |  _________^
   > 350 | |             "tomli is required to read TOML files. "
   > 351 | |             "Install it with `pip install tomli` or `pip install 
sf-hamilton[cli]` which includes TOML support."
   > 352 | |         )
   >     | |_________^ B904
   > 353 |
   > 354 |       with open(file_path, "rb") as f:
   >     |
   >
   > Found 15 errors (14 fixed, 1 remaining).
   >
   > 
ruff-format..............................................................Passed
   > trim trailing 
whitespace.................................................Passed
   > fix end of 
files.........................................................Failed
   > - hook id: end-of-file-fixer
   > - exit code: 1
   > - files were modified by this hook
   >
   > Fixing tests/cli/resources/test_context.toml
   > Fixing tests/cli/resources/test_tool_hamilton.toml
   >
   > fix 
requirements.txt.....................................................Passed
   > check python 
ast.........................................................Passed
   > validate example 
notebooks...............................................Passed
   >
   > you can run this by installing the pre-commit hook and then running it
   >
   > —
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/hamilton/pull/1402#issuecomment-3388454435>,
   > or unsubscribe
   > 
<https://github.com/notifications/unsubscribe-auth/BAIHD2FOZTTEFVJ7DURSZPD3W5GPJAVCNFSM6AAAAACIILXX6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGOBYGQ2TINBTGU>
   > .
   > You are receiving this because you were mentioned.Message ID:
   > ***@***.***>
   >
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to