Skip to content

Commit

Permalink
Update python files
Browse files Browse the repository at this point in the history
  • Loading branch information
Micha Reiser committed Jan 26, 2023
1 parent 3310c5f commit 1b0a458
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ urls = { repository = "https://github.com/charliermarsh/ruff" }

[tool.maturin]
bindings = "bin"
manifest-path = "ruff_cli/Cargo.toml"
manifest-path = "crates/ruff_cli/Cargo.toml"
python-source = "python"
strip = true
8 changes: 4 additions & 4 deletions scripts/add_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def main(*, plugin: str, url: str, prefix_code: str) -> None:
)

# Create the Plugin rules module.
plugin_dir = ROOT_DIR / "src/rules" / dir_name(plugin)
plugin_dir = ROOT_DIR / "crates/ruff/src/rules" / dir_name(plugin)
plugin_dir.mkdir(exist_ok=True)

with (plugin_dir / "mod.rs").open("w+") as fp:
Expand Down Expand Up @@ -69,13 +69,13 @@ def main(*, plugin: str, url: str, prefix_code: str) -> None:
(plugin_dir / "snapshots").mkdir(exist_ok=True)

# Add the plugin to `rules/mod.rs`.
with (ROOT_DIR / "src/rules/mod.rs").open("a") as fp:
with (ROOT_DIR / "crates/ruff/src/rules/mod.rs").open("a") as fp:
fp.write(f"pub mod {dir_name(plugin)};")

# Add the relevant sections to `src/registry.rs`.
content = (ROOT_DIR / "src/registry.rs").read_text()
content = (ROOT_DIR / "crates/ruff/src/registry.rs").read_text()

with (ROOT_DIR / "src/registry.rs").open("w") as fp:
with (ROOT_DIR / "crates/ruff/src/registry.rs").open("w") as fp:
for line in content.splitlines():
indent = get_indent(line)

Expand Down
6 changes: 3 additions & 3 deletions scripts/add_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def main(*, name: str, code: str, linter: str) -> None:
):
pass

plugin_module = ROOT_DIR / "src/rules" / dir_name(linter)
plugin_module = ROOT_DIR / "crates/ruff/src/rules" / dir_name(linter)
rule_name_snake = snake_case(name)

# Add the relevant `#testcase` macro.
Expand Down Expand Up @@ -102,11 +102,11 @@ def main(*, name: str, code: str, linter: str) -> None:
fp.write("\n")

# Add the relevant code-to-violation pair to `src/registry.rs`.
content = (ROOT_DIR / "src/registry.rs").read_text()
content = (ROOT_DIR / "crates/ruff/src/registry.rs").read_text()

seen_macro = False
has_written = False
with (ROOT_DIR / "src/registry.rs").open("w") as fp:
with (ROOT_DIR / "crates/ruff/src/registry.rs").open("w") as fp:
for line in content.splitlines():
fp.write(line)
fp.write("\n")
Expand Down

0 comments on commit 1b0a458

Please sign in to comment.