KEMBAR78
Ruff rules for comprehensions and performance by cclauss · Pull Request #329 · cpplint/cpplint · GitHub
Skip to content

Conversation

@cclauss
Copy link
Member

@cclauss cclauss commented Mar 7, 2025

% ruff check --select=C4,PERF --output-format=concise

cpplint.py:60:21: C405 Unnecessary list literal (rewrite as a set literal)
cpplint.py:829:22: C404 Unnecessary list comprehension (rewrite as a dict comprehension)
cpplint.py:948:16: C405 Unnecessary list literal (rewrite as a set literal)
cpplint.py:1041:10: C405 Unnecessary list literal (rewrite as a set literal)
cpplint.py:1046:59: C405 Unnecessary list literal (rewrite as a set literal)
cpplint.py:1104:23: C417 Unnecessary `map()` usage (rewrite using a set comprehension)
cpplint.py:6072:5: PERF401 Use `list.extend` to create a transformed list
cpplint.py:6088:5: PERF401 Use `list.extend` to create a transformed list
cpplint.py:6096:5: PERF401 Use `list.extend` to create a transformed list
cpplint.py:6106:5: PERF401 Use `list.extend` to create a transformed list
cpplint.py:6743:31: C414 Unnecessary `list()` call within `sorted()`
cpplint.py:6744:17: C414 Unnecessary `list()` call within `sorted()`
cpplint.py:6930:7: PERF401 Use a list comprehension to create a transformed list
cpplint_unittest.py:4262:24: C405 Unnecessary list literal (rewrite as a set literal)
cpplint_unittest.py:4268:24: C405 Unnecessary list literal (rewrite as a set literal)
cpplint_unittest.py:4274:24: C405 Unnecessary list literal (rewrite as a set literal)
cpplint_unittest.py:4275:24: C405 Unnecessary list literal (rewrite as a set literal)
cpplint_unittest.py:4281:24: C405 Unnecessary list literal (rewrite as a set literal)
cpplint_unittest.py:4282:24: C405 Unnecessary list literal (rewrite as a set literal)
cpplint_unittest.py:4332:32: C405 Unnecessary list literal (rewrite as a set literal)
cpplint_unittest.py:4333:37: C405 Unnecessary list literal (rewrite as a set literal)
cpplint_unittest.py:4358:24: C405 Unnecessary list literal (rewrite as a set literal)
cpplint_unittest.py:4376:18: C405 Unnecessary list literal (rewrite as a set literal)
cpplint_unittest.py:5630:28: C405 Unnecessary list literal (rewrite as a set literal)
cpplint_unittest.py:5631:33: C405 Unnecessary list literal (rewrite as a set literal)
Found 25 errors.
No fixes available (20 hidden fixes can be enabled with the `--unsafe-fixes` option).

@cclauss cclauss force-pushed the ruff-rules-C4-and-PERF branch from bfa7806 to 13c4725 Compare March 7, 2025 14:21
cpplint.py Outdated
Copy link
Member

Choose a reason for hiding this comment

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

double space at "_USAGE " - odd that ruff isnt picking that up

Copy link
Member Author

Choose a reason for hiding this comment

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

This will be automatically fixed when we add ruff format to pre-commit.

@cclauss cclauss requested review from aaronliu0130 and jayvdb March 8, 2025 06:16
@cclauss cclauss force-pushed the ruff-rules-C4-and-PERF branch from 19ec1b4 to c2afaa7 Compare March 8, 2025 12:38
@cclauss cclauss force-pushed the ruff-rules-C4-and-PERF branch from c2afaa7 to b181eaa Compare March 11, 2025 18:17
@cclauss
Copy link
Member Author

cclauss commented Mar 11, 2025

Reviews please.

@aaronliu0130 aaronliu0130 merged commit 776a72b into develop Mar 11, 2025
10 checks passed
@cclauss cclauss deleted the ruff-rules-C4-and-PERF branch March 11, 2025 21:34
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.

3 participants