☂️ Remove dependencies of `Tok` from downstream tools
dhruvmanila opened this issue · comments
Dhruv Manilawala commented
This issue is to keep track of all the tasks required to remove the Tok
dependency from the downstream tools (linter and formatter).
Notes:
- Certain tasks might need to be clubbed with the parser changes
- The implementation logic for certain usages isn't finalized yet
Linter
- Move these rules to the AST checker:
-
doc_lines_from_tokens
(#11418) - Following rules can be updated to directly use
TokenKind
(via #11361): -
remove_import_members
useslex
method (#11511) -
extract_noqa_line_for
uses thekind
information from the string token -
locate_cmp_ops
uses thelex
method (#11562) -
tokens_and_ranges
extracts the comment ranges from the token stream -
unsorted_dunder_all
andunsorted_dunder_slots
extracts the value from the string token (#11511) -
UP032
uses thelex_starts_at
method (#11511) -
I001
(trailing_comma
) uses thelex_starts_at
method (#11511) -
Stylist
extracts the indentation and quote information from the token (#11592) -
Indexer
extracts trivia and string ranges, line continuation start value (#11592)
Formatter
- Move away from
lex_starts_at
inwrite_suppressed_statements_starting_with_trailing_comment
(#11515)
Internal document: https://www.notion.so/astral-sh/Downstream-work-items-551b86e104a34054b7192675550a6c25?pvs=4
Dhruv Manilawala commented
Closed by #11628