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

[MAINTENANCE] Enable SIM110 #9836

Merged
merged 6 commits into from
Apr 29, 2024
Merged

[MAINTENANCE] Enable SIM110 #9836

merged 6 commits into from
Apr 29, 2024

Conversation

anthonyburdi
Copy link
Member

@anthonyburdi anthonyburdi commented Apr 29, 2024

https://docs.astral.sh/ruff/rules/reimplemented-builtin/

reimplemented-builtin (SIM110)

Derived from the flake8-simplify linter.

Fix is sometimes available.

What it does

Checks for for loops that can be replaced with a builtin function, like
any or all.

Why is this bad?

Using a builtin function is more concise and readable. Builtins are also
more efficient than for loops.

Example

for item in iterable:
    if predicate(item):
        return True
return False

Use instead:

return any(predicate(item) for item in iterable)

References

Copy link

netlify bot commented Apr 29, 2024

Deploy Preview for niobium-lead-7998 canceled.

Name Link
🔨 Latest commit dbae8e1
🔍 Latest deploy log https://app.netlify.com/sites/niobium-lead-7998/deploys/662fdeb32a85ca0008de6c24

Copy link

codecov bot commented Apr 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.15%. Comparing base (f204d6b) to head (dbae8e1).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9836      +/-   ##
===========================================
- Coverage    82.54%   82.15%   -0.40%     
===========================================
  Files          504      504              
  Lines        45097    45082      -15     
===========================================
- Hits         37227    37037     -190     
- Misses        7870     8045     +175     
Flag Coverage Δ
3.10 65.64% <100.00%> (-0.01%) ⬇️
3.10 athena or clickhouse or openpyxl or pyarrow or project or sqlite or aws_creds ?
3.10 aws_deps ?
3.10 databricks ?
3.10 filesystem ?
3.10 mysql ?
3.11 65.64% <100.00%> (-0.01%) ⬇️
3.11 athena or clickhouse or openpyxl or pyarrow or project or sqlite or aws_creds 53.31% <60.00%> (+<0.01%) ⬆️
3.11 aws_deps 44.23% <0.00%> (+0.01%) ⬆️
3.11 big 61.08% <40.00%> (+0.01%) ⬆️
3.11 databricks 45.27% <20.00%> (+<0.01%) ⬆️
3.11 filesystem 62.53% <60.00%> (+<0.01%) ⬆️
3.11 mssql 47.99% <0.00%> (+0.01%) ⬆️
3.11 mysql 48.04% <0.00%> (+0.01%) ⬆️
3.11 postgresql 51.69% <20.00%> (+0.01%) ⬆️
3.11 snowflake 45.86% <20.00%> (+<0.01%) ⬆️
3.11 spark 57.85% <0.00%> (+0.01%) ⬆️
3.11 trino 51.01% <20.00%> (+0.01%) ⬆️
3.8 65.65% <100.00%> (-0.01%) ⬇️
3.8 athena or clickhouse or openpyxl or pyarrow or project or sqlite or aws_creds 53.32% <60.00%> (+<0.01%) ⬆️
3.8 aws_deps 44.24% <0.00%> (+0.01%) ⬆️
3.8 big 61.08% <40.00%> (+0.01%) ⬆️
3.8 databricks 45.28% <20.00%> (+<0.01%) ⬆️
3.8 filesystem 62.54% <60.00%> (+<0.01%) ⬆️
3.8 mssql 47.97% <0.00%> (+0.01%) ⬆️
3.8 mysql 48.02% <0.00%> (+0.01%) ⬆️
3.8 postgresql 51.68% <20.00%> (+0.01%) ⬆️
3.8 snowflake 45.87% <20.00%> (+<0.01%) ⬆️
3.8 spark 57.80% <0.00%> (+0.01%) ⬆️
3.8 trino 51.00% <20.00%> (+0.01%) ⬆️
3.9 65.65% <100.00%> (-0.01%) ⬇️
3.9 athena or clickhouse or openpyxl or pyarrow or project or sqlite or aws_creds ?
3.9 aws_deps ?
3.9 databricks ?
3.9 filesystem ?
3.9 mysql ?
cloud 0.00% <0.00%> (ø)
docs-basic 52.03% <20.00%> (+0.01%) ⬆️
docs-creds-needed ?
docs-spark 51.67% <20.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

if target.startswith(quote) and target.endswith(quote):
return True
return False
return any(target.startswith(quote) and target.endswith(quote) for quote in ["`"])
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove loop altogether.

Copy link
Contributor

@billdirks billdirks left a comment

Choose a reason for hiding this comment

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

LGTM!

@anthonyburdi anthonyburdi self-assigned this Apr 29, 2024
@Kilo59 Kilo59 added this pull request to the merge queue Apr 29, 2024
Merged via the queue into develop with commit b8a8a7b Apr 29, 2024
68 checks passed
@Kilo59 Kilo59 deleted the m/_/enable-SIM110 branch April 29, 2024 22:06
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.

None yet

3 participants