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

Keep trailing part comment associated with its part #15378

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MichaReiser
Copy link
Member

Summary

WIP

Fixes #15375

Test Plan

@MichaReiser MichaReiser added bug Something isn't working formatter Related to the formatter labels Jan 9, 2025
@MichaReiser
Copy link
Member Author

MichaReiser commented Jan 9, 2025

It might actually be better to handle this inside FormatStatementsLastExpression::left_to_right but I have to take another look how comments in assignments are handled (it's complicated)

Copy link
Contributor

github-actions bot commented Jan 9, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

ℹ️ ecosystem check detected format changes. (+12 -12 lines in 6 files in 2 projects; 1 project error; 52 projects unchanged)

langchain-ai/langchain (+2 -2 lines across 1 file)

libs/core/tests/unit_tests/utils/test_html.py~L166

         '<a href="https://foobar.com:9999">BAD</a>'
         '<a href="http://foobar.com:9999/">BAD</a>'
         '<a href="https://foobar.com/OK">OK</a>'
-        '<a href="http://foobar.com/BAD">BAD</a>'
-    )  # Change in scheme is not OK here
+        '<a href="http://foobar.com/BAD">BAD</a>'  # Change in scheme is not OK here
+    )
 
     expected = sorted(
         [

rotki/rotki (+10 -10 lines across 5 files)

rotkehlchen/db/history_events.py~L362

         free_base_suffix = (
             f"* FROM (SELECT {base_suffix}) WHERE event_identifier IN ("
             f"SELECT DISTINCT event_identifier FROM history_events {ignore_asset_filter} "
-            "ORDER BY timestamp DESC,sequence_index ASC LIMIT ?)"
-        )  # free query only select the last LIMIT groups  # noqa: E501
+            "ORDER BY timestamp DESC,sequence_index ASC LIMIT ?)"  # free query only select the last LIMIT groups  # noqa: E501
+        )
 
         if has_premium:
             suffix, limit = premium_base_suffix, []

rotkehlchen/db/upgrades/v42_v43.py~L83

                 "DELETE FROM history_events WHERE identifier IN ("
                 "SELECT H.identifier from history_events H INNER JOIN evm_events_info E "
                 "ON H.identifier=E.identifier AND E.tx_hash IN "
-                "(SELECT tx_hash FROM evm_transactions) AND H.location != 'o')"
-            )  # location 'o' is zksync lite  # noqa: E501
+                "(SELECT tx_hash FROM evm_transactions) AND H.location != 'o')"  # location 'o' is zksync lite  # noqa: E501
+            )
             bindings: tuple = ()
             if customized_events != 0:
                 querystr += " AND identifier NOT IN (SELECT parent_identifier FROM history_events_mappings WHERE name=? AND value=?)"  # noqa: E501

rotkehlchen/db/upgrades/v43_v44.py~L222

                 "DELETE FROM history_events WHERE identifier IN ("
                 "SELECT H.identifier from history_events H INNER JOIN evm_events_info E "
                 "ON H.identifier=E.identifier AND E.tx_hash IN "
-                "(SELECT tx_hash FROM evm_transactions) AND H.location != 'o')"
-            )  # location 'o' is zksync lite  # noqa: E501
+                "(SELECT tx_hash FROM evm_transactions) AND H.location != 'o')"  # location 'o' is zksync lite  # noqa: E501
+            )
             bindings: tuple = ()
             if customized_events != 0:
                 querystr += " AND identifier NOT IN (SELECT parent_identifier FROM history_events_mappings WHERE name=? AND value=?)"  # noqa: E501

rotkehlchen/db/upgrades/v44_v45.py~L46

                 "DELETE FROM history_events WHERE identifier IN ("
                 "SELECT H.identifier from history_events H INNER JOIN evm_events_info E "
                 "ON H.identifier=E.identifier AND E.tx_hash IN "
-                "(SELECT tx_hash FROM evm_transactions) AND H.location != 'o')"
-            )  # location 'o' is zksync lite  # noqa: E501
+                "(SELECT tx_hash FROM evm_transactions) AND H.location != 'o')"  # location 'o' is zksync lite  # noqa: E501
+            )
             bindings: tuple = ()
             if customized_events != 0:
                 querystr += " AND identifier NOT IN (SELECT parent_identifier FROM history_events_mappings WHERE name=? AND value=?)"  # noqa: E501

rotkehlchen/db/upgrades/v45_v46.py~L187

                 "DELETE FROM history_events WHERE identifier IN ("
                 "SELECT H.identifier from history_events H INNER JOIN evm_events_info E "
                 "ON H.identifier=E.identifier AND E.tx_hash IN "
-                "(SELECT tx_hash FROM evm_transactions) AND H.location != 'o')"
-            )  # location 'o' is zksync lite  # noqa: E501
+                "(SELECT tx_hash FROM evm_transactions) AND H.location != 'o')"  # location 'o' is zksync lite  # noqa: E501
+            )
             bindings: tuple = ()
             if customized_events != 0:
                 querystr += " AND identifier NOT IN (SELECT parent_identifier FROM history_events_mappings WHERE name=? AND value=?)"  # noqa: E501

openai/openai-cookbook (error)

warning: Detected debug build without --no-cache.
error: Failed to read examples/Assistants_API_overview_python.ipynb: Expected a Jupyter Notebook, which must be internally stored as JSON, but this file isn't valid JSON: expected `,` or `]` at line 197 column 8

Formatter (preview)

ℹ️ ecosystem check detected format changes. (+12 -12 lines in 6 files in 2 projects; 1 project error; 52 projects unchanged)

langchain-ai/langchain (+2 -2 lines across 1 file)

ruff format --preview

libs/core/tests/unit_tests/utils/test_html.py~L158

         '<a href="https://foobar.com:9999">BAD</a>'
         '<a href="http://foobar.com:9999/">BAD</a>'
         '<a href="https://foobar.com/OK">OK</a>'
-        '<a href="http://foobar.com/BAD">BAD</a>'
-    )  # Change in scheme is not OK here
+        '<a href="http://foobar.com/BAD">BAD</a>'  # Change in scheme is not OK here
+    )
 
     expected = sorted([
         "https://foobar.com/OK",

rotki/rotki (+10 -10 lines across 5 files)

ruff format --preview

rotkehlchen/db/history_events.py~L362

         free_base_suffix = (
             f"* FROM (SELECT {base_suffix}) WHERE event_identifier IN ("
             f"SELECT DISTINCT event_identifier FROM history_events {ignore_asset_filter} "
-            "ORDER BY timestamp DESC,sequence_index ASC LIMIT ?)"
-        )  # free query only select the last LIMIT groups  # noqa: E501
+            "ORDER BY timestamp DESC,sequence_index ASC LIMIT ?)"  # free query only select the last LIMIT groups  # noqa: E501
+        )
 
         if has_premium:
             suffix, limit = premium_base_suffix, []

rotkehlchen/db/upgrades/v42_v43.py~L83

                 "DELETE FROM history_events WHERE identifier IN ("
                 "SELECT H.identifier from history_events H INNER JOIN evm_events_info E "
                 "ON H.identifier=E.identifier AND E.tx_hash IN "
-                "(SELECT tx_hash FROM evm_transactions) AND H.location != 'o')"
-            )  # location 'o' is zksync lite  # noqa: E501
+                "(SELECT tx_hash FROM evm_transactions) AND H.location != 'o')"  # location 'o' is zksync lite  # noqa: E501
+            )
             bindings: tuple = ()
             if customized_events != 0:
                 querystr += " AND identifier NOT IN (SELECT parent_identifier FROM history_events_mappings WHERE name=? AND value=?)"  # noqa: E501

rotkehlchen/db/upgrades/v43_v44.py~L220

                 "DELETE FROM history_events WHERE identifier IN ("
                 "SELECT H.identifier from history_events H INNER JOIN evm_events_info E "
                 "ON H.identifier=E.identifier AND E.tx_hash IN "
-                "(SELECT tx_hash FROM evm_transactions) AND H.location != 'o')"
-            )  # location 'o' is zksync lite  # noqa: E501
+                "(SELECT tx_hash FROM evm_transactions) AND H.location != 'o')"  # location 'o' is zksync lite  # noqa: E501
+            )
             bindings: tuple = ()
             if customized_events != 0:
                 querystr += " AND identifier NOT IN (SELECT parent_identifier FROM history_events_mappings WHERE name=? AND value=?)"  # noqa: E501

rotkehlchen/db/upgrades/v44_v45.py~L46

                 "DELETE FROM history_events WHERE identifier IN ("
                 "SELECT H.identifier from history_events H INNER JOIN evm_events_info E "
                 "ON H.identifier=E.identifier AND E.tx_hash IN "
-                "(SELECT tx_hash FROM evm_transactions) AND H.location != 'o')"
-            )  # location 'o' is zksync lite  # noqa: E501
+                "(SELECT tx_hash FROM evm_transactions) AND H.location != 'o')"  # location 'o' is zksync lite  # noqa: E501
+            )
             bindings: tuple = ()
             if customized_events != 0:
                 querystr += " AND identifier NOT IN (SELECT parent_identifier FROM history_events_mappings WHERE name=? AND value=?)"  # noqa: E501

rotkehlchen/db/upgrades/v45_v46.py~L187

                 "DELETE FROM history_events WHERE identifier IN ("
                 "SELECT H.identifier from history_events H INNER JOIN evm_events_info E "
                 "ON H.identifier=E.identifier AND E.tx_hash IN "
-                "(SELECT tx_hash FROM evm_transactions) AND H.location != 'o')"
-            )  # location 'o' is zksync lite  # noqa: E501
+                "(SELECT tx_hash FROM evm_transactions) AND H.location != 'o')"  # location 'o' is zksync lite  # noqa: E501
+            )
             bindings: tuple = ()
             if customized_events != 0:
                 querystr += " AND identifier NOT IN (SELECT parent_identifier FROM history_events_mappings WHERE name=? AND value=?)"  # noqa: E501

openai/openai-cookbook (error)

ruff format --preview

warning: Detected debug build without --no-cache.
error: Failed to read examples/Assistants_API_overview_python.ipynb: Expected a Jupyter Notebook, which must be internally stored as JSON, but this file isn't valid JSON: expected `,` or `]` at line 197 column 8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working formatter Related to the formatter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implicit concatenated f-string: Trailing end-of-line comment is moved
1 participant