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

Rename tab-size to indent-width #8082

Merged
merged 1 commit into from
Oct 24, 2023
Merged

Conversation

MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Oct 20, 2023

Summary

This PR renames the tab-size configuration option to indent-width to express that the formatter uses the option to determine the indentation width AND as tab width.

I first preferred naming the option tab-width but then decided to go with indent-width because:

  • It aligns with the indent-style option
  • It would allow us to write a lint rule that asserts that each indentation uses indent-width spaces.

Closes #7643

Test Plan

Added integration test

@MichaReiser
Copy link
Member Author

MichaReiser commented Oct 20, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

/// This option changes the number of spaces the formatter inserts when
/// using soft-tabs (`indent-style = space`).
///
/// PEP8 recommends using 4 spaces per [indentation level](https://peps.python.org/pep-0008/#indentation).
Copy link
Member

Choose a reason for hiding this comment

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

Nit: We typically stylize as PEP 8.

Copy link
Member Author

Choose a reason for hiding this comment

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

I also fixed the reference to PEP257

@github-actions
Copy link
Contributor

github-actions bot commented Oct 20, 2023

PR Check Results

Ecosystem

✅ ecosystem check detected no changes.

@dhruvmanila dhruvmanila added the configuration Related to settings and configuration label Oct 20, 2023
@MichaReiser MichaReiser changed the base branch from rename-length-options to add-formatter-to-line-length-doc October 24, 2023 03:20
@@ -305,7 +305,7 @@ pub(crate) fn fits_or_shrinks(
node: AnyNodeRef,
locator: &Locator,
line_length: LineLength,
tab_size: TabSize,
tab_size: IndentWidth,
Copy link
Member Author

Choose a reason for hiding this comment

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

We could rename all these fields but here the indent-width is used as tab-width only, so keeping it as is felt correct.

@MichaReiser MichaReiser force-pushed the add-formatter-to-line-length-doc branch from 1c1aed4 to de85ade Compare October 24, 2023 07:45
Base automatically changed from add-formatter-to-line-length-doc to main October 24, 2023 07:55
@MichaReiser
Copy link
Member Author

MichaReiser commented Oct 24, 2023

Merge activity

  • Oct 24, 4:06 AM: Graphite rebased this pull request as part of a merge.
  • Oct 24, 4:14 AM: Graphite couldn't merge this PR because it had conflicts with the trunk branch.

@MichaReiser
Copy link
Member Author

@charliermarsh feel free to hit merge when the changes look reasonable to you

@charliermarsh charliermarsh merged commit 84979f9 into main Oct 24, 2023
17 of 20 checks passed
@charliermarsh charliermarsh deleted the rename-tab-size-to-tab-width branch October 24, 2023 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Related to settings and configuration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename tab-size to tab-width
3 participants