Skip to content
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

ENH: generic surfaces pylint #689

Merged
merged 11 commits into from
Sep 14, 2024

Conversation

Lucas-Prates
Copy link
Contributor

Pull request type

  • Code maintenance (refactoring, formatting, tests)

Checklist

  • Docs have been reviewed and added / updated
  • Lint (black rocketpy/ tests/) has passed locally
  • All tests (pytest tests -m slow --runslow) have passed locally

Current behavior

Fixes pylint for the generic surfaces PR.

New behavior

There are two major changes:

  • The __init__ of GenericSurface and LinearGenericSurfaces have been reworked to receive a single argument for the coefficients instead of a multitude of arguments.

  • I cleaned up the arguments from compute_forces_and_moments method a bit. I kept the *args because of the way the function is called in the Flight class . Basically, the class iterates over all aerodynamic surfaces and calls this function for each of them. In turn, this function has different signatures depending on which aerodynamic surface we have. As I see it, there are three approaches:

    1. Put *args to ignore some arguments for functions with smaller signatures;
    2. Do a flow control (if/else) and match the arguments accordingly;
    3. Use some tools from the inspect module to get the signature before hand, create an accordingly dictionary with arguments as keys and its values, and pass to the method.

Approach 2) seems a bit ugly, approach 3) seems unnecessarily complicated and might difficult maintaining the code in the future. Hence, I chose 1). If someone has a better suggestion, I am eager to see it!

Breaking change

  • Yes
  • No

@Lucas-Prates Lucas-Prates requested a review from a team as a code owner September 13, 2024 20:34
Copy link
Member

@Gui-FernandesBR Gui-FernandesBR left a comment

Choose a reason for hiding this comment

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

Good work, Lucas!!

In the future I think we should make all aerosurfaces inherit from the generic surface class.

@Gui-FernandesBR Gui-FernandesBR force-pushed the enh/generic-surfaces-pylint branch from ce68698 to e45dc11 Compare September 14, 2024 12:19
@Lucas-Prates Lucas-Prates changed the title Enh/generic surfaces pylint ENH: generic surfaces pylint Sep 14, 2024
@Lucas-Prates Lucas-Prates force-pushed the enh/generic-surfaces-pylint branch from fb20304 to c543fae Compare September 14, 2024 13:39
@Gui-FernandesBR Gui-FernandesBR force-pushed the enh/generic-surfaces-pylint branch from 40a9cf8 to c7a4179 Compare September 14, 2024 18:18
Copy link

codecov bot commented Sep 14, 2024

Codecov Report

Attention: Patch coverage is 10.41667% with 43 lines in your changes missing coverage. Please review.

Please upload report for BASE (enh/generic-surfaces@70886df). Learn more about missing BASE report.

Files with missing lines Patch % Lines
rocketpy/simulation/flight.py 0.00% 23 Missing ⚠️
rocketpy/rocket/aero_surface/generic_surface.py 19.04% 17 Missing ⚠️
...etpy/rocket/aero_surface/linear_generic_surface.py 25.00% 3 Missing ⚠️
Additional details and impacted files
@@                   Coverage Diff                   @@
##             enh/generic-surfaces     #689   +/-   ##
=======================================================
  Coverage                        ?   74.87%           
=======================================================
  Files                           ?       98           
  Lines                           ?    11021           
  Branches                        ?        0           
=======================================================
  Hits                            ?     8252           
  Misses                          ?     2769           
  Partials                        ?        0           

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

@Gui-FernandesBR Gui-FernandesBR merged commit 4815fc1 into enh/generic-surfaces Sep 14, 2024
8 checks passed
@Gui-FernandesBR Gui-FernandesBR deleted the enh/generic-surfaces-pylint branch September 14, 2024 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

3 participants