-
Notifications
You must be signed in to change notification settings - Fork 15
CHORE: Setting up ruff #1233
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
base: main
Are you sure you want to change the base?
CHORE: Setting up ruff #1233
Conversation
… (no formatting), enforce I(sort) rule
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (15.00%) is below the target coverage (85.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1233 +/- ##
==========================================
+ Coverage 49.50% 49.56% +0.05%
==========================================
Files 254 254
Lines 37900 37857 -43
==========================================
- Hits 18764 18763 -1
+ Misses 19136 19094 -42 🚀 New features to boost your workflow:
|
…nfig and update files accordingly
# Conflicts: # .pre-commit-config.yaml # src/pyedb/configuration/cfg_components.py # src/pyedb/configuration/cfg_padstacks.py # src/pyedb/configuration/cfg_ports_sources.py # src/pyedb/dotnet/database/cell/layout.py # src/pyedb/dotnet/database/dotnet/database.py # src/pyedb/dotnet/database/padstack.py # src/pyedb/dotnet/edb.py # src/pyedb/generic/design_types.py # src/pyedb/grpc/database/components.py # src/pyedb/grpc/database/hfss.py # src/pyedb/grpc/database/layers/stackup_layer.py # src/pyedb/grpc/database/layout/layout.py # src/pyedb/grpc/database/layout_validation.py # src/pyedb/grpc/database/modeler.py # src/pyedb/grpc/database/net/net.py # src/pyedb/grpc/database/nets.py # src/pyedb/grpc/database/padstacks.py # src/pyedb/grpc/database/primitive/bondwire.py # src/pyedb/grpc/database/primitive/path.py # src/pyedb/grpc/database/primitive/rectangle.py # src/pyedb/grpc/database/source_excitations.py # src/pyedb/grpc/database/stackup.py # src/pyedb/grpc/database/terminal/bundle_terminal.py # src/pyedb/grpc/database/terminal/terminal.py # src/pyedb/grpc/database/utility/simulation_configuration.py # src/pyedb/grpc/edb.py # tests/grpc/system/conftest.py # tests/grpc/system/test_edb_future_features_242.py # tests/grpc/system/test_edb_materials.py # tests/grpc/system/test_edb_padstacks.py # tests/grpc/system/test_edb_stackup.py # tests/grpc/unit/conftest.py # tests/legacy/system/conftest.py # tests/legacy/system/test_edb_components.py # tests/legacy/system/test_edb_definition.py # tests/legacy/system/test_edb_extended_nets.py # tests/legacy/system/test_edb_ipc.py # tests/legacy/system/test_edb_modeler.py # tests/legacy/system/test_edb_nets.py # tests/legacy/system/test_edb_stackup.py # tests/legacy/system/test_emi_scanner.py # tests/legacy/system/test_siwave_features.py # tests/system/base_test_class.py # tests/system/test_edb_geometry.py # tests/system/test_edb_padstacks.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
For more information, see https://pre-commit.ci
…ply ruff linting and formatting
@svandenb-dev, |
src/pyedb/dotnet/database/edb_data/raptor_x_simulation_setup_data.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there should be some rewrite here to avoid the following changes from
nets.generate_extended_nets(
resistor_below=5,
...
)
to
nets.generate_extended_nets(
resistor_below = (5,)
...
)
>>> nets.generate_extended_nets(
>>> resistor_below=5,
>>> resistor_below = (5,)
>>>inductor_below=0.5,
>>> capacitor_above=0.1
>>> capacitor_above = 0.1
>>> )
It is even more strange with >>> power_nets=["VDD_CPU", "VDD_MEM"],
to >>> power_nets = (["VDD_CPU", "VDD_MEM"],)
.
@ecoussoux-ansys Could you have a look ? I think it complexifies the documentation
Co-authored-by: Sébastien Morais <[email protected]>
Thank you for pointing this out. Indeed, this type of reformatting, which occurred in several places, is incorrect. This happens because All occurrences of this kind of reformatting should be corrected by the changes introduced by c881dac. |
This PR corresponds to the first step towards using
ruff
for linting and formatting in the pyedb project, as described in #1237.As such, completion of this PR should not result in closing #1237.
The present changes aim at providing pyedb with a similar basic
ruff
configuration as the one implemented for pyaedt in ansys/pyaedt#6157, removingisort
,black
andflake8
at the same time.It should be noted that
ruff
does not replace the following tools, whose use in the project is therefore not affected by the changes introduced here:blacken-docs
(used for formatting Python code blocks in documentation files):ruff
does not support formatting/linting of embedded code (particularly in .rst or .md files). Similarly,blacken-docs
does not support theruff
formatter as an alternative forblack
. This tool is therefore retained (as a pre-commit hook), despite the remaining dependency onblack
,codespell
(fixes common misspellings in source code and other files), which is not integrated intoruff
,numpydoc
(used for formatting docstrings), which is also not integrated intoruff
.The changes in this PR are limited to the definition of a minimal configuration for
ruff
(in thepyproject.toml
file) with only a small set of rules (namely "I"(sort) rules) applied to the code base, together with the introduction of pre-commit hooks for linting and formatting withruff
. Python files fixed byruff
are updated. Configurations forisort
,black
andflake8
are removed and the associated pre-commit hooks are also dropped.The currently ignored rules (exhaustive list provided) shall be gradually applied to the project in subsequent PRs.
It is also worth mentioning that the list of rules selected until now for linting in the
.flake8
file is not regarded as a reference for defining the implementedruff
configuration. Instead, this config is based on the recommendations from the pyansys-dev-guide, as introduced in ansys/pyansys-dev-guide#592.