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

CI move validate unwanted patterns over to pre-commit #37379

Merged
merged 3 commits into from
Oct 26, 2020

Conversation

MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli commented Oct 24, 2020

This becomes much simpler with pre-commit 😄 As with other PRs of this kind, the motivation for moving checks like these over to pre-commit is that they become cross-platform and that they provide faster feedback to devs


example: if I apply

diff --git a/pandas/io/formats/info.py b/pandas/io/formats/info.py
index 891b3ea7a..6c1075910 100644
--- a/pandas/io/formats/info.py
+++ b/pandas/io/formats/info.py
@@ -479,7 +479,7 @@ class DataFrameTableBuilder(TableBuilderAbstract):
         collected_dtypes = [
             f"{key}({val:d})" for key, val in sorted(self.dtype_counts.items())
         ]
-        self._lines.append(f"dtypes: {', '.join(collected_dtypes)}")
+        self._lines.append(" " f"dtypes: {', '.join(collected_dtypes)}")
 
     def add_memory_usage_line(self) -> None:
         """Add line containing memory usage."""

then I get

$ pre-commit run unwanted-patterns-strings-to-concatenate --all
Check for use of not concatenated strings................................Failed
- hook id: unwanted-patterns-strings-to-concatenate
- exit code: 1

pandas/io/formats/info.py:482:String unnecessarily split in two by black. Please merge them manually.

@MarcoGorelli MarcoGorelli marked this pull request as draft October 24, 2020 11:29
@MarcoGorelli MarcoGorelli marked this pull request as ready for review October 24, 2020 12:13
@jbrockmendel jbrockmendel added CI Continuous Integration Code Style Code style, linting, code_checks labels Oct 25, 2020
@jreback jreback added this to the 1.2 milestone Oct 26, 2020
@jreback
Copy link
Contributor

jreback commented Oct 26, 2020

thanks

@jreback jreback merged commit b151b04 into pandas-dev:master Oct 26, 2020
@MarcoGorelli MarcoGorelli deleted the unwanted-patterns-pre-commit branch October 26, 2020 12:51
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Oct 26, 2020
* move validate unwanted patterns over to pre-commit

* better names
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
* move validate unwanted patterns over to pre-commit

* better names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants