ansys / pyaedt

AEDT Python Client Package
https://aedt.docs.pyansys.com
MIT License
201 stars 120 forks source link

CHORE: add license headers #4785

Closed jorgepiloto closed 3 months ago

jorgepiloto commented 3 months ago

This pull-request configures the ansys pre-commit-hooks. It also enables the license header checks. Related with #4775.

ansys-reviewer-bot[bot] commented 3 months ago

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 82.67%. Comparing base (f8e714c) to head (c761bdb).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #4785 +/- ## ========================================== - Coverage 82.67% 82.67% -0.01% ========================================== Files 117 117 Lines 54186 54186 ========================================== - Hits 44798 44797 -1 - Misses 9388 9389 +1 ```
jorgepiloto commented 3 months ago

Is it normal that the IronPython tests fail? Seems that some LOG file is missing.

Samuelopez-ansys commented 3 months ago

Hi @jorgepiloto and @SMoraisAnsys ,

I was able to reproduce the issue, and we need to add the encoding line at the beginning of the file (before the license header), for instance in aedt_logger.py:

image

I found the issue because the .log locally told me :)

image

This modification is only needed for the files where # -- coding: utf-8 -- is defined... @jorgepiloto could you make the changes?

Thanks!

jorgepiloto commented 3 months ago

Hi @Samuelopez-ansys, thank's for pointing this out. Let me fix this. I hope the ansys-license-headers hooks does not remove those UTF8 lines.

jorgepiloto commented 3 months ago

Changing this to draft. Pinging @klmcadams.

The license headers get placed on top of the # -*- coding: utf-8 -*- line. This makes Python to ignore the actual encoding.

Adding a custom template leads to a duplicated # -*- coding: utf-8 -*-:

# -*- coding: utf-8 -*-
... LICENSE STUFF ...

# -*- coding: utf-8 -*- (the original one)
Samuelopez-ansys commented 3 months ago

@jorgepiloto Could we merge this PR?

jorgepiloto commented 3 months ago

I crafted a custom template to ensure the UTF-8 line is added before every license check. Before adding the headers, I removed every UTF-8 line using a custom script.

Everything should be ready to go now.