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

A few refactors of lint.py #16940

Merged
merged 3 commits into from
Sep 21, 2022
Merged

Conversation

thejcannon
Copy link
Member

@thejcannon thejcannon commented Sep 21, 2022

The big changes are:

  • Bumping the "metadata" of a partition to be a first-class-citizen and renaming it to "PartitionKey" to better encompass its intent.
  • Making Partitions a mapping from key -> partition (with the key option for single partitions. Will be None)
  • Refactored the memoized class property types to be unconditionally declared with most of the relevant type-checking-and-runtime info, and only conditionally declare the runtime version (which inherits from the both-type)

[ci skip-build-sheels]
[ci skip-rust]

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@thejcannon thejcannon changed the title Refactor lint so "PartitionKey Refactor lint so "PartitionKey" is a first-class citizen Sep 21, 2022
@thejcannon thejcannon added the category:internal CI, fixes for not-yet-released features, etc. label Sep 21, 2022
@thejcannon thejcannon changed the title Refactor lint so "PartitionKey" is a first-class citizen Refactor lint so "PartitionKey" is a first-class citizen of "Partitions" Sep 21, 2022
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@thejcannon thejcannon marked this pull request as ready for review September 21, 2022 14:19
@thejcannon thejcannon changed the title Refactor lint so "PartitionKey" is a first-class citizen of "Partitions" A few refactors of lint.py Sep 21, 2022

class SubPartition(Collection[_ElementT]):
pass
_SubPartitionBase = SubPartition
Copy link
Member Author

Choose a reason for hiding this comment

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

These are required so we can use them as the "base" class. Otherwise we'd hit an infinite recursion trying to lookup the class.

@thejcannon thejcannon merged commit 1d007fb into pantsbuild:main Sep 21, 2022
@thejcannon thejcannon deleted the metadata-1st branch September 21, 2022 17:56
@stuhood
Copy link
Member

stuhood commented Sep 21, 2022

Unrelated to this one in particular, but: it looks like convert_fmt_result_to_lint_result is currently marked level=INFO:

10:58:39.61 [INFO] Completed: Format with docformatter - docformatter made no changes.
10:58:39.61 [INFO] Completed: pants.core.goals.lint.convert_fmt_result_to_lint_result - docformatter succeeded.
10:58:39.88 [INFO] Completed: Format with isort - isort made no changes.
10:58:39.89 [INFO] Completed: pants.core.goals.lint.convert_fmt_result_to_lint_result - isort succeeded.
10:58:40.36 [INFO] Completed: Format with Autoflake - autoflake made no changes.
10:58:40.36 [INFO] Completed: pants.core.goals.lint.convert_fmt_result_to_lint_result - autoflake succeeded.
10:58:41.49 [INFO] Completed: Format with Black - black made no changes.
10:58:41.49 [INFO] Completed: pants.core.goals.lint.convert_fmt_result_to_lint_result - black succeeded.

@thejcannon
Copy link
Member Author

It has taken me until today to actually realize why level=LogLevel.DEBUG is used in rule(). LOL.

I'll fix it in the fmt big refactor, as I'm moving the rule in that branch anyways,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:internal CI, fixes for not-yet-released features, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants