From 78cf806e2108fff5bf93df3f101ba9e5ec3413d7 Mon Sep 17 00:00:00 2001 From: Paul Sanders Date: Wed, 25 Oct 2023 15:41:05 -0400 Subject: [PATCH 1/3] Switch from black to ruff formatting --- src/package_version.rs | 1 - src/project_generator.rs | 564 ++++++++++++++++----------------------- 2 files changed, 237 insertions(+), 328 deletions(-) diff --git a/src/package_version.rs b/src/package_version.rs index 322c2a2..11b324c 100644 --- a/src/package_version.rs +++ b/src/package_version.rs @@ -4,7 +4,6 @@ use anyhow::Result; #[derive(Debug)] pub enum PreCommitHook { - Black, PreCommit, MyPy, Ruff, diff --git a/src/project_generator.rs b/src/project_generator.rs index 59045a1..0d79d3d 100644 --- a/src/project_generator.rs +++ b/src/project_generator.rs @@ -207,11 +207,6 @@ fn build_latest_pre_commit_dependencies( repo: "https://github.com/pre-commit/pre-commit-hooks".to_string(), rev: "v4.5.0".to_string(), }, - PreCommitHookVersion { - id: PreCommitHook::Black, - repo: "https://github.com/psf/black".to_string(), - rev: "23.10.1".to_string(), - }, PreCommitHookVersion { id: PreCommitHook::MyPy, repo: "https://github.com/pre-commit/mirrors-mypy".to_string(), @@ -239,7 +234,7 @@ fn build_latest_pre_commit_dependencies( hooks } -fn create_pre_commit_file(max_line_length: &u8, download_latest_packages: bool) -> String { +fn create_pre_commit_file(download_latest_packages: bool) -> String { let mut pre_commit_str = "repos:".to_string(); let hooks = build_latest_pre_commit_dependencies(download_latest_packages); for hook in hooks { @@ -251,13 +246,6 @@ fn create_pre_commit_file(max_line_length: &u8, download_latest_packages: bool) ); pre_commit_str.push_str(&info); } - PreCommitHook::Black => { - let info = format!( - "\n - repo: {}\n rev: {}\n hooks:\n - id: black\n language_version: python3\n args: [--line-length={max_line_length}]", - hook.repo, hook.rev - ); - pre_commit_str.push_str(&info); - } PreCommitHook::MyPy => { let info = format!( "\n - repo: {}\n rev: {}\n hooks:\n - id: mypy", @@ -267,7 +255,7 @@ fn create_pre_commit_file(max_line_length: &u8, download_latest_packages: bool) } PreCommitHook::Ruff => { let info = format!( - "\n - repo: {}\n rev: {}\n hooks:\n - id: ruff\n args: [--fix, --exit-non-zero-on-fix]", + "\n - repo: {}\n rev: {}\n hooks:\n - id: ruff\n args: [--fix, --exit-non-zero-on-fix]\n - id: ruff-format", hook.repo, hook.rev ); pre_commit_str.push_str(&info); @@ -281,10 +269,7 @@ fn create_pre_commit_file(max_line_length: &u8, download_latest_packages: bool) fn save_pre_commit_file(project_info: &ProjectInfo) -> Result<()> { let file_path = project_info.base_dir().join(".pre-commit-config.yaml"); - let content = create_pre_commit_file( - &project_info.max_line_length, - project_info.download_latest_packages, - ); + let content = create_pre_commit_file(project_info.download_latest_packages); save_file_with_content(&file_path, &content)?; Ok(()) @@ -297,10 +282,6 @@ fn build_latest_dev_dependencies( ) -> String { let mut version_string = String::new(); let mut packages = vec![ - PythonPackageVersion { - name: "black".to_string(), - version: "23.10.1".to_string(), - }, PythonPackageVersion { name: "mypy".to_string(), version: "1.6.1".to_string(), @@ -451,28 +432,7 @@ include = ["{{ source_dir }}*"] }; pyproject.push_str( - r#"[tool.black] -line-length = {{ max_line_length }} -include = '\.pyi?$' -exclude = ''' -/( - \.egg - | \.git - | \.hg - | \.mypy_cache - | \.nox - | \.tox - | \.venv - | \venv - | _build - | buck-out - | build - | dist - | setup.py -)/ -''' - -[tool.mypy] + r#"[tool.mypy] check_untyped_defs = true disallow_untyped_defs = true @@ -489,7 +449,24 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] -ignore = ["E501"] +ignore=[ + "E501", + # Recommened ignores by ruff when using formatter + "W191", + "E111", + "E114", + "E117", + "D206", + "D300", + "Q000", + "Q001", + "Q002", + "Q003", + "COM812", + "COM819", + "ISC001", + "ISC002", +] line-length = {{ max_line_length }} target-version = "py{{ pyupgrade_version }}" fix = true @@ -553,10 +530,10 @@ fn create_pyo3_justfile(source_dir: &str) -> String { just --justfile {{{{justfile()}}}} fmt echo mypy just --justfile {{{{justfile()}}}} mypy - echo black - just --justfile {{{{justfile()}}}} black - echo ruff + echo ruff linting just --justfile {{{{justfile()}}}} ruff + echo ruff formatting + just --justfile {{{{justfile()}}}} ruff-format @check: cargo check @@ -567,15 +544,15 @@ fn create_pyo3_justfile(source_dir: &str) -> String { @fmt: cargo fmt --all -- --check -@black: - black {} tests - @mypy: mypy . @ruff: ruff check . --fix +@ruff-format: + ruff format {} tests + @test: pytest "#, @@ -729,7 +706,6 @@ mod tests { fn pinned_poetry_dependencies() -> String { r#"[tool.poetry.group.dev.dependencies] -black = "23.10.1" mypy = "1.6.1" pre-commit = "3.5.0" pytest = "7.4.2" @@ -741,7 +717,6 @@ tomli = {version = "2.0.1", python = "<3.11"}"# fn min_poetry_dependencies() -> String { r#"[tool.poetry.group.dev.dependencies] -black = ">=23.10.1" mypy = ">=1.6.1" pre-commit = ">=3.5.0" pytest = ">=7.4.2" @@ -752,8 +727,7 @@ tomli = {version = ">=2.0.1", python = "<3.11"}"# } fn pinned_requirments_file() -> String { - r#"black==23.10.1 -mypy==1.6.1 + r#"mypy==1.6.1 pre-commit==3.5.0 pytest==7.4.2 pytest-cov==4.1.0 @@ -765,8 +739,7 @@ maturin==1.3.1 } fn min_requirments_file() -> String { - r#"black>=23.10.1 -mypy>=1.6.1 + r#"mypy>=1.6.1 pre-commit>=3.5.0 pytest>=7.4.2 pytest-cov>=4.1.0 @@ -1096,9 +1069,7 @@ dmypy.json #[test] fn test_save_pre_commit_file() { - let max_line_length: u8 = 100; - let expected = format!( - r#"repos: + let expected = r#"repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: @@ -1108,12 +1079,6 @@ dmypy.json - id: debug-statements - id: end-of-file-fixer - id: trailing-whitespace - - repo: https://github.com/psf/black - rev: 23.10.1 - hooks: - - id: black - language_version: python3 - args: [--line-length={max_line_length}] - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.6.1 hooks: @@ -1123,8 +1088,8 @@ dmypy.json hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] -"# - ); + - id: ruff-format +"#; let project_info = project_info_dummy(); let base = project_info.base_dir(); @@ -1167,27 +1132,6 @@ python = "^{}" requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" -[tool.black] -line-length = {} -include = '\.pyi?$' -exclude = ''' -/( - \.egg - | \.git - | \.hg - | \.mypy_cache - | \.nox - | \.tox - | \.venv - | \venv - | _build - | buck-out - | build - | dist - | setup.py -)/ -''' - [tool.mypy] check_untyped_defs = true disallow_untyped_defs = true @@ -1205,7 +1149,24 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] -ignore = ["E501"] +ignore=[ + "E501", + # Recommened ignores by ruff when using formatter + "W191", + "E111", + "E114", + "E117", + "D206", + "D300", + "Q000", + "Q001", + "Q002", + "Q003", + "COM812", + "COM819", + "ISC001", + "ISC002", +] line-length = {} target-version = "py{}" fix = true @@ -1217,7 +1178,6 @@ fix = true project_info.creator_email, project_info.min_python_version, pinned_poetry_dependencies(), - project_info.max_line_length, project_info.source_dir, project_info.max_line_length, pyupgrade_version, @@ -1260,27 +1220,6 @@ python = "^{}" requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" -[tool.black] -line-length = {} -include = '\.pyi?$' -exclude = ''' -/( - \.egg - | \.git - | \.hg - | \.mypy_cache - | \.nox - | \.tox - | \.venv - | \venv - | _build - | buck-out - | build - | dist - | setup.py -)/ -''' - [tool.mypy] check_untyped_defs = true disallow_untyped_defs = true @@ -1298,7 +1237,24 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] -ignore = ["E501"] +ignore=[ + "E501", + # Recommened ignores by ruff when using formatter + "W191", + "E111", + "E114", + "E117", + "D206", + "D300", + "Q000", + "Q001", + "Q002", + "Q003", + "COM812", + "COM819", + "ISC001", + "ISC002", +] line-length = {} target-version = "py{}" fix = true @@ -1310,7 +1266,6 @@ fix = true project_info.creator_email, project_info.min_python_version, pinned_poetry_dependencies(), - project_info.max_line_length, project_info.source_dir, project_info.max_line_length, pyupgrade_version, @@ -1352,27 +1307,6 @@ python = "^{}" requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" -[tool.black] -line-length = {} -include = '\.pyi?$' -exclude = ''' -/( - \.egg - | \.git - | \.hg - | \.mypy_cache - | \.nox - | \.tox - | \.venv - | \venv - | _build - | buck-out - | build - | dist - | setup.py -)/ -''' - [tool.mypy] check_untyped_defs = true disallow_untyped_defs = true @@ -1390,7 +1324,24 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] -ignore = ["E501"] +ignore=[ + "E501", + # Recommened ignores by ruff when using formatter + "W191", + "E111", + "E114", + "E117", + "D206", + "D300", + "Q000", + "Q001", + "Q002", + "Q003", + "COM812", + "COM819", + "ISC001", + "ISC002", +] line-length = {} target-version = "py{}" fix = true @@ -1402,7 +1353,6 @@ fix = true project_info.creator_email, project_info.min_python_version, pinned_poetry_dependencies(), - project_info.max_line_length, project_info.source_dir, project_info.max_line_length, pyupgrade_version, @@ -1445,27 +1395,6 @@ python = "^{}" requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" -[tool.black] -line-length = {} -include = '\.pyi?$' -exclude = ''' -/( - \.egg - | \.git - | \.hg - | \.mypy_cache - | \.nox - | \.tox - | \.venv - | \venv - | _build - | buck-out - | build - | dist - | setup.py -)/ -''' - [tool.mypy] check_untyped_defs = true disallow_untyped_defs = true @@ -1483,7 +1412,24 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] -ignore = ["E501"] +ignore=[ + "E501", + # Recommened ignores by ruff when using formatter + "W191", + "E111", + "E114", + "E117", + "D206", + "D300", + "Q000", + "Q001", + "Q002", + "Q003", + "COM812", + "COM819", + "ISC001", + "ISC002", +] line-length = {} target-version = "py{}" fix = true @@ -1495,7 +1441,6 @@ fix = true project_info.creator_email, project_info.min_python_version, min_poetry_dependencies(), - project_info.max_line_length, project_info.source_dir, project_info.max_line_length, pyupgrade_version, @@ -1537,27 +1482,6 @@ module-name = "{}._{}" binding = "pyo3" features = ["pyo3/extension-module"] -[tool.black] -line-length = {} -include = '\.pyi?$' -exclude = ''' -/( - \.egg - | \.git - | \.hg - | \.mypy_cache - | \.nox - | \.tox - | \.venv - | \venv - | _build - | buck-out - | build - | dist - | setup.py -)/ -''' - [tool.mypy] check_untyped_defs = true disallow_untyped_defs = true @@ -1575,7 +1499,24 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] -ignore = ["E501"] +ignore=[ + "E501", + # Recommened ignores by ruff when using formatter + "W191", + "E111", + "E114", + "E117", + "D206", + "D300", + "Q000", + "Q001", + "Q002", + "Q003", + "COM812", + "COM819", + "ISC001", + "ISC002", +] line-length = {} target-version = "py{}" fix = true @@ -1586,7 +1527,6 @@ fix = true project_info.creator_email, project_info.source_dir, project_info.source_dir, - project_info.max_line_length, project_info.source_dir, project_info.max_line_length, pyupgrade_version, @@ -1628,27 +1568,6 @@ module-name = "{}._{}" binding = "pyo3" features = ["pyo3/extension-module"] -[tool.black] -line-length = {} -include = '\.pyi?$' -exclude = ''' -/( - \.egg - | \.git - | \.hg - | \.mypy_cache - | \.nox - | \.tox - | \.venv - | \venv - | _build - | buck-out - | build - | dist - | setup.py -)/ -''' - [tool.mypy] check_untyped_defs = true disallow_untyped_defs = true @@ -1666,7 +1585,24 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] -ignore = ["E501"] +ignore=[ + "E501", + # Recommened ignores by ruff when using formatter + "W191", + "E111", + "E114", + "E117", + "D206", + "D300", + "Q000", + "Q001", + "Q002", + "Q003", + "COM812", + "COM819", + "ISC001", + "ISC002", +] line-length = {} target-version = "py{}" fix = true @@ -1677,7 +1613,6 @@ fix = true project_info.creator_email, project_info.source_dir, project_info.source_dir, - project_info.max_line_length, project_info.source_dir, project_info.max_line_length, pyupgrade_version, @@ -1718,27 +1653,6 @@ module-name = "{}._{}" binding = "pyo3" features = ["pyo3/extension-module"] -[tool.black] -line-length = {} -include = '\.pyi?$' -exclude = ''' -/( - \.egg - | \.git - | \.hg - | \.mypy_cache - | \.nox - | \.tox - | \.venv - | \venv - | _build - | buck-out - | build - | dist - | setup.py -)/ -''' - [tool.mypy] check_untyped_defs = true disallow_untyped_defs = true @@ -1756,7 +1670,24 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] -ignore = ["E501"] +ignore=[ + "E501", + # Recommened ignores by ruff when using formatter + "W191", + "E111", + "E114", + "E117", + "D206", + "D300", + "Q000", + "Q001", + "Q002", + "Q003", + "COM812", + "COM819", + "ISC001", + "ISC002", +] line-length = {} target-version = "py{}" fix = true @@ -1767,7 +1698,6 @@ fix = true project_info.creator_email, project_info.source_dir, project_info.source_dir, - project_info.max_line_length, project_info.source_dir, project_info.max_line_length, pyupgrade_version, @@ -1817,27 +1747,6 @@ include = ["{}*"] [tool.setuptools.package-data] {} = ["py.typed"] -[tool.black] -line-length = {} -include = '\.pyi?$' -exclude = ''' -/( - \.egg - | \.git - | \.hg - | \.mypy_cache - | \.nox - | \.tox - | \.venv - | \venv - | _build - | buck-out - | build - | dist - | setup.py -)/ -''' - [tool.mypy] check_untyped_defs = true disallow_untyped_defs = true @@ -1855,7 +1764,24 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] -ignore = ["E501"] +ignore=[ + "E501", + # Recommened ignores by ruff when using formatter + "W191", + "E111", + "E114", + "E117", + "D206", + "D300", + "Q000", + "Q001", + "Q002", + "Q003", + "COM812", + "COM819", + "ISC001", + "ISC002", +] line-length = {} target-version = "py{}" fix = true @@ -1868,7 +1794,6 @@ fix = true project_info.source_dir, project_info.source_dir, project_info.source_dir, - project_info.max_line_length, project_info.source_dir, project_info.max_line_length, pyupgrade_version, @@ -1918,27 +1843,6 @@ include = ["{}*"] [tool.setuptools.package-data] {} = ["py.typed"] -[tool.black] -line-length = {} -include = '\.pyi?$' -exclude = ''' -/( - \.egg - | \.git - | \.hg - | \.mypy_cache - | \.nox - | \.tox - | \.venv - | \venv - | _build - | buck-out - | build - | dist - | setup.py -)/ -''' - [tool.mypy] check_untyped_defs = true disallow_untyped_defs = true @@ -1956,7 +1860,24 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] -ignore = ["E501"] +ignore=[ + "E501", + # Recommened ignores by ruff when using formatter + "W191", + "E111", + "E114", + "E117", + "D206", + "D300", + "Q000", + "Q001", + "Q002", + "Q003", + "COM812", + "COM819", + "ISC001", + "ISC002", +] line-length = {} target-version = "py{}" fix = true @@ -1969,7 +1890,6 @@ fix = true project_info.source_dir, project_info.source_dir, project_info.source_dir, - project_info.max_line_length, project_info.source_dir, project_info.max_line_length, pyupgrade_version, @@ -2018,27 +1938,6 @@ include = ["{}*"] [tool.setuptools.package-data] {} = ["py.typed"] -[tool.black] -line-length = {} -include = '\.pyi?$' -exclude = ''' -/( - \.egg - | \.git - | \.hg - | \.mypy_cache - | \.nox - | \.tox - | \.venv - | \venv - | _build - | buck-out - | build - | dist - | setup.py -)/ -''' - [tool.mypy] check_untyped_defs = true disallow_untyped_defs = true @@ -2056,7 +1955,24 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] -ignore = ["E501"] +ignore=[ + "E501", + # Recommened ignores by ruff when using formatter + "W191", + "E111", + "E114", + "E117", + "D206", + "D300", + "Q000", + "Q001", + "Q002", + "Q003", + "COM812", + "COM819", + "ISC001", + "ISC002", +] line-length = {} target-version = "py{}" fix = true @@ -2069,7 +1985,6 @@ fix = true project_info.source_dir, project_info.source_dir, project_info.source_dir, - project_info.max_line_length, project_info.source_dir, project_info.max_line_length, pyupgrade_version, @@ -2119,27 +2034,6 @@ include = ["{}*"] [tool.setuptools.package-data] {} = ["py.typed"] -[tool.black] -line-length = {} -include = '\.pyi?$' -exclude = ''' -/( - \.egg - | \.git - | \.hg - | \.mypy_cache - | \.nox - | \.tox - | \.venv - | \venv - | _build - | buck-out - | build - | dist - | setup.py -)/ -''' - [tool.mypy] check_untyped_defs = true disallow_untyped_defs = true @@ -2157,7 +2051,24 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] -ignore = ["E501"] +ignore=[ + "E501", + # Recommened ignores by ruff when using formatter + "W191", + "E111", + "E114", + "E117", + "D206", + "D300", + "Q000", + "Q001", + "Q002", + "Q003", + "COM812", + "COM819", + "ISC001", + "ISC002", +] line-length = {} target-version = "py{}" fix = true @@ -2170,7 +2081,6 @@ fix = true project_info.source_dir, project_info.source_dir, project_info.source_dir, - project_info.max_line_length, project_info.source_dir, project_info.max_line_length, pyupgrade_version, @@ -2277,10 +2187,10 @@ fix = true just --justfile {{{{justfile()}}}} fmt echo mypy just --justfile {{{{justfile()}}}} mypy - echo black - just --justfile {{{{justfile()}}}} black - echo ruff + echo ruff linting just --justfile {{{{justfile()}}}} ruff + echo ruff formatting + just --justfile {{{{justfile()}}}} ruff-format @check: cargo check @@ -2291,15 +2201,15 @@ fix = true @fmt: cargo fmt --all -- --check -@black: - black {} tests - @mypy: mypy . @ruff: ruff check . --fix +@ruff-format: + ruff format {} tests + @test: pytest "#, From 47470ff706ea1594751b4949609e475200cd243c Mon Sep 17 00:00:00 2001 From: Paul Sanders Date: Thu, 26 Oct 2023 14:47:20 -0400 Subject: [PATCH 2/3] Update README and github actions for ruff format --- README.md | 8 +++----- src/github_actions.rs | 48 +++++++++++++++++++++---------------------- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index c56e227..0ee6d1b 100644 --- a/README.md +++ b/README.md @@ -15,25 +15,23 @@ For package managment choose between: Dev packages: -- [black](https://github.com/psf/black) for code formatting - [mypy](https://www.mypy-lang.org/) for static type checking - [pre-commit](https://github.com/pre-commit/pre-commit) for pre-commit hooks - [pytest](https://docs.pytest.org/en/latest/) for testing - [pytest-cov](https://github.com/pytest-dev/pytest-cov) for test coverage reports -- [ruff](https://beta.ruff.rs/docs/) for linting +- [ruff](https://beta.ruff.rs/docs/) for linting and code formatting ## Python project with Rust modules included packages - [maturin](https://github.com/PyO3/maturin) for package management -- [black](https://github.com/psf/black) for code formatting - [mypy](https://www.mypy-lang.org/) for static type checking - [pre-commit](https://github.com/pre-commit/pre-commit) for pre-commit hooks - [pytest](https://docs.pytest.org/en/latest/) for testing - [pytest-cov](https://github.com/pytest-dev/pytest-cov) for test coverage reports -- [ruff](https://beta.ruff.rs/docs/) for linting +- [ruff](https://beta.ruff.rs/docs/) for linting and code formatting - [PyO3](https://github.com/PyO3/pyo3) for managing the Rust/Python FFI - [justfile](https://github.com/casey/just) for running commands (to use this you will need to -install just) + install just) ## Installation diff --git a/src/github_actions.rs b/src/github_actions.rs index 3380e87..6cb3a1f 100644 --- a/src/github_actions.rs +++ b/src/github_actions.rs @@ -44,8 +44,8 @@ jobs: cache: "poetry" - name: Install Dependencies run: poetry install - - name: Black check - run: poetry run black {source_dir} tests --check + - name: Ruff format check + run: poetry run ruff format {source_dir} tests --check - name: Lint with ruff run: poetry run ruff check . - name: mypy check @@ -106,8 +106,8 @@ jobs: run: | python -m pip install -U pip python -m pip install -r requirements-dev.txt - - name: Black check - run: black {source_dir} tests --check + - name: Ruff format check + run: ruff format {source_dir} tests --check - name: Lint with ruff run: ruff check . - name: mypy check @@ -195,8 +195,8 @@ jobs: python -m pip install -e . maturin build --out dist python -m pip install --no-index --find-links=dist/ prelude-parser - - name: Black check - run: black {source_dir} tests --check + - name: Ruff format check + run: ruff format {source_dir} tests --check - name: Lint with ruff run: ruff check . - name: mypy check @@ -287,8 +287,8 @@ jobs: cache: "poetry" - name: Install Dependencies run: poetry install - - name: Black check - run: poetry run black {source_dir} tests --check + - name: Ruff format check + run: poetry run ruff format {source_dir} tests --check - name: Lint with ruff run: poetry run ruff check . - name: mypy check @@ -350,8 +350,8 @@ jobs: run: | python -m pip install -U pip python -m pip install -r requirements-dev.txt - - name: Black check - run: black {source_dir} tests --check + - name: Ruff format check + run: ruff format {source_dir} tests --check - name: Lint with ruff run: ruff check . - name: mypy check @@ -440,8 +440,8 @@ jobs: python -m pip install -e . maturin build --out dist python -m pip install --no-index --find-links=dist/ prelude-parser - - name: Black check - run: black {source_dir} tests --check + - name: Ruff format check + run: ruff format {source_dir} tests --check - name: Lint with ruff run: ruff check . - name: mypy check @@ -978,8 +978,8 @@ jobs: cache: "poetry" - name: Install Dependencies run: poetry install - - name: Black check - run: poetry run black {} tests --check + - name: Ruff format check + run: poetry run ruff format {} tests --check - name: Lint with ruff run: poetry run ruff check . - name: mypy check @@ -1080,8 +1080,8 @@ jobs: python -m pip install -e . maturin build --out dist python -m pip install --no-index --find-links=dist/ prelude-parser - - name: Black check - run: black {} tests --check + - name: Ruff format check + run: ruff format {} tests --check - name: Lint with ruff run: ruff check . - name: mypy check @@ -1151,8 +1151,8 @@ jobs: run: | python -m pip install -U pip python -m pip install -r requirements-dev.txt - - name: Black check - run: black {} tests --check + - name: Ruff format check + run: ruff format {} tests --check - name: Lint with ruff run: ruff check . - name: mypy check @@ -1223,8 +1223,8 @@ jobs: cache: "poetry" - name: Install Dependencies run: poetry install - - name: Black check - run: poetry run black {} tests --check + - name: Ruff format check + run: poetry run ruff format {} tests --check - name: Lint with ruff run: poetry run ruff check . - name: mypy check @@ -1296,8 +1296,8 @@ jobs: run: | python -m pip install -U pip python -m pip install -r requirements-dev.txt - - name: Black check - run: black {} tests --check + - name: Ruff format check + run: ruff format {} tests --check - name: Lint with ruff run: ruff check . - name: mypy check @@ -1396,8 +1396,8 @@ jobs: python -m pip install -e . maturin build --out dist python -m pip install --no-index --find-links=dist/ prelude-parser - - name: Black check - run: black {} tests --check + - name: Ruff format check + run: ruff format {} tests --check - name: Lint with ruff run: ruff check . - name: mypy check From 1ceb033ea104f4ac348c45f06d1c18e6c11361e6 Mon Sep 17 00:00:00 2001 From: Paul Sanders Date: Thu, 26 Oct 2023 14:56:35 -0400 Subject: [PATCH 3/3] Fix typo --- src/project_generator.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/project_generator.rs b/src/project_generator.rs index 0d79d3d..d4abdd5 100644 --- a/src/project_generator.rs +++ b/src/project_generator.rs @@ -450,8 +450,8 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] ignore=[ + # Recommended ignores by ruff when using formatter "E501", - # Recommened ignores by ruff when using formatter "W191", "E111", "E114", @@ -1150,8 +1150,8 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] ignore=[ + # Recommended ignores by ruff when using formatter "E501", - # Recommened ignores by ruff when using formatter "W191", "E111", "E114", @@ -1238,8 +1238,8 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] ignore=[ + # Recommended ignores by ruff when using formatter "E501", - # Recommened ignores by ruff when using formatter "W191", "E111", "E114", @@ -1325,8 +1325,8 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] ignore=[ + # Recommended ignores by ruff when using formatter "E501", - # Recommened ignores by ruff when using formatter "W191", "E111", "E114", @@ -1413,8 +1413,8 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] ignore=[ + # Recommended ignores by ruff when using formatter "E501", - # Recommened ignores by ruff when using formatter "W191", "E111", "E114", @@ -1500,8 +1500,8 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] ignore=[ + # Recommended ignores by ruff when using formatter "E501", - # Recommened ignores by ruff when using formatter "W191", "E111", "E114", @@ -1586,8 +1586,8 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] ignore=[ + # Recommended ignores by ruff when using formatter "E501", - # Recommened ignores by ruff when using formatter "W191", "E111", "E114", @@ -1671,8 +1671,8 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] ignore=[ + # Recommended ignores by ruff when using formatter "E501", - # Recommened ignores by ruff when using formatter "W191", "E111", "E114", @@ -1765,8 +1765,8 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] ignore=[ + # Recommended ignores by ruff when using formatter "E501", - # Recommened ignores by ruff when using formatter "W191", "E111", "E114", @@ -1861,8 +1861,8 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] ignore=[ + # Recommended ignores by ruff when using formatter "E501", - # Recommened ignores by ruff when using formatter "W191", "E111", "E114", @@ -1956,8 +1956,8 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] ignore=[ + # Recommended ignores by ruff when using formatter "E501", - # Recommened ignores by ruff when using formatter "W191", "E111", "E114", @@ -2052,8 +2052,8 @@ exclude_lines = ["if __name__ == .__main__.:", "pragma: no cover"] [tool.ruff] select = ["E", "F", "UP", "I001", "T201", "T203"] ignore=[ + # Recommended ignores by ruff when using formatter "E501", - # Recommened ignores by ruff when using formatter "W191", "E111", "E114",