mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-03 07:04:53 +00:00
Add black to pre-commit (#3192)
This commit is contained in:
parent
bda2a0007a
commit
a688a237d7
4 changed files with 14 additions and 3 deletions
|
@ -46,5 +46,16 @@ repos:
|
||||||
pass_filenames: false
|
pass_filenames: false
|
||||||
exclude: target
|
exclude: target
|
||||||
|
|
||||||
|
# Black
|
||||||
|
- repo: https://github.com/psf/black
|
||||||
|
rev: 23.1.0
|
||||||
|
hooks:
|
||||||
|
- id: black
|
||||||
|
exclude: |
|
||||||
|
(?x)^(
|
||||||
|
crates/ruff/resources/.*|
|
||||||
|
crates/ruff_python_formatter/resources/.*
|
||||||
|
)$
|
||||||
|
|
||||||
ci:
|
ci:
|
||||||
skip: [cargo-fmt, clippy, dev-generate-all]
|
skip: [cargo-fmt, clippy, dev-generate-all]
|
||||||
|
|
|
@ -95,7 +95,7 @@ mod tests {
|
||||||
with (ROOT_DIR / "crates/ruff/src/codes.rs").open("r") as fp:
|
with (ROOT_DIR / "crates/ruff/src/codes.rs").open("r") as fp:
|
||||||
while (line := next(fp)).strip() != "// ruff":
|
while (line := next(fp)).strip() != "// ruff":
|
||||||
text += line
|
text += line
|
||||||
text += " "*8 + f"// {plugin}\n"
|
text += " " * 8 + f"// {plugin}\n"
|
||||||
text += line
|
text += line
|
||||||
text += fp.read()
|
text += fp.read()
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ pub fn {rule_name_snake}(checker: &mut Checker) {{}}
|
||||||
text += line
|
text += line
|
||||||
text += line
|
text += line
|
||||||
linter_variant = pascal_case(linter)
|
linter_variant = pascal_case(linter)
|
||||||
text += " "*8 + f'({linter_variant}, "{code}") => Rule::{name},\n'
|
text += " " * 8 + f'({linter_variant}, "{code}") => Rule::{name},\n'
|
||||||
text += fp.read()
|
text += fp.read()
|
||||||
|
|
||||||
with (ROOT_DIR / "crates/ruff/src/codes.rs").open("w") as fp:
|
with (ROOT_DIR / "crates/ruff/src/codes.rs").open("w") as fp:
|
||||||
|
|
|
@ -42,7 +42,7 @@ pub static KNOWN_STANDARD_LIBRARY: Lazy<FxHashMap<(u32, u32), FxHashSet<&'static
|
||||||
FxHashMap::from_iter([
|
FxHashMap::from_iter([
|
||||||
""",
|
""",
|
||||||
)
|
)
|
||||||
for (major, minor) in VERSIONS:
|
for major, minor in VERSIONS:
|
||||||
version = f"{major}.{minor}"
|
version = f"{major}.{minor}"
|
||||||
url = URL.format(version)
|
url = URL.format(version)
|
||||||
invdata = fetch_inventory(FakeApp(), "", url)
|
invdata = fetch_inventory(FakeApp(), "", url)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue