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

Prevent mutable default arguments #2443

Merged
merged 8 commits into from
Jun 6, 2024

Conversation

eapolinario
Copy link
Collaborator

Why are the changes needed?

Mutable default arguments are an anti-pattern in python. Let's catch that via a lint rule.

What changes were proposed in this pull request?

Enable https://docs.astral.sh/ruff/rules/mutable-argument-default/ in ruff.

How was this patch tested?

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

Signed-off-by: Eduardo Apolinario <[email protected]>
Copy link

codecov bot commented May 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.90%. Comparing base (db2ff9e) to head (263b410).
Report is 5 commits behind head on master.

Current head 263b410 differs from pull request most recent head 41ab1cc

Please upload reports for the commit 41ab1cc to get more accurate results.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2443       +/-   ##
===========================================
- Coverage   89.99%   75.90%   -14.09%     
===========================================
  Files          45      182      +137     
  Lines        1919    18472    +16553     
  Branches        0     3610     +3610     
===========================================
+ Hits         1727    14022    +12295     
- Misses        192     3846     +3654     
- Partials        0      604      +604     

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

cosmicBboy
cosmicBboy previously approved these changes May 23, 2024
@wild-endeavor
Copy link
Contributor

need to fix tho

wild-endeavor
wild-endeavor previously approved these changes May 24, 2024
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Eduardo Apolinario <[email protected]>
@eapolinario eapolinario dismissed stale reviews from wild-endeavor and cosmicBboy via de87986 June 4, 2024 21:39
@eapolinario eapolinario merged commit c03eaad into master Jun 6, 2024
46 checks passed
bgedik pushed a commit to bgedik/flytekit that referenced this pull request Jul 3, 2024
* Prevent mutable default arguments

Signed-off-by: Eduardo Apolinario <[email protected]>

* Do not lint tests

Signed-off-by: Eduardo Apolinario <[email protected]>

* Bump precommit hook version

Signed-off-by: Eduardo Apolinario <[email protected]>

* Remove default value for dictionary in Spark class

Signed-off-by: Eduardo Apolinario <[email protected]>

* Run precommit hook locally

Signed-off-by: Eduardo Apolinario <[email protected]>

* Fix lint error in openai plugin

Signed-off-by: Eduardo Apolinario <[email protected]>

* Handle nil databricks_conf in spark plugin

Signed-off-by: Eduardo Apolinario <[email protected]>

---------

Signed-off-by: Eduardo Apolinario <[email protected]>
Co-authored-by: Eduardo Apolinario <[email protected]>
Signed-off-by: bugra.gedik <[email protected]>
fiedlerNr9 pushed a commit that referenced this pull request Jul 25, 2024
* Prevent mutable default arguments

Signed-off-by: Eduardo Apolinario <[email protected]>

* Do not lint tests

Signed-off-by: Eduardo Apolinario <[email protected]>

* Bump precommit hook version

Signed-off-by: Eduardo Apolinario <[email protected]>

* Remove default value for dictionary in Spark class

Signed-off-by: Eduardo Apolinario <[email protected]>

* Run precommit hook locally

Signed-off-by: Eduardo Apolinario <[email protected]>

* Fix lint error in openai plugin

Signed-off-by: Eduardo Apolinario <[email protected]>

* Handle nil databricks_conf in spark plugin

Signed-off-by: Eduardo Apolinario <[email protected]>

---------

Signed-off-by: Eduardo Apolinario <[email protected]>
Co-authored-by: Eduardo Apolinario <[email protected]>
Signed-off-by: Jan Fiedler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants