Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/_includes/py_console_script_binary.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ py_console_script_binary(
deps = [
# One can add extra dependencies to the entry point.
# This specifically allows us to add plugins to pylint.
"@pip//pylint_print",
"@pip//pylint_per_file_ignores",
],
)
```
Expand Down
2 changes: 1 addition & 1 deletion examples/bzlmod/entry_points/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ py_console_script_binary(
visibility = ["//entry_points:__subpackages__"],
deps = [
# One can add extra dependencies to the entry point.
"@pip//pylint_print",
"@pip//pylint_per_file_ignores",
],
)

Expand Down
3 changes: 2 additions & 1 deletion examples/bzlmod/entry_points/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ run_binary(
outs = ["pylint_report.txt"],
args = [
"--output-format=text:$(location pylint_report.txt)",
"--load-plugins=pylint_print",
"--load-plugins=pylint_per_file_ignores",
"--per-file-ignores=**/file_with_pylint_errors.py:unused-import",
# The `exit-zero` ensures that `run_binary` is successful even though there are lint errors.
# We check the generated report in the test below.
"--exit-zero",
Expand Down
11 changes: 6 additions & 5 deletions examples/bzlmod/entry_points/tests/file_with_pylint_errors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
A file to demonstrate the pylint-print checker works.
"""
"""A file to demonstrate that the pylint-per-file-ignores plugin works."""

if __name__ == "__main__":
print("Hello, World!")
import os # noqa: F401


def dummy():
pass
8 changes: 5 additions & 3 deletions examples/bzlmod/entry_points/tests/pylint_deps_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_pylint_entry_point(self):
"",
proc.stderr.decode("utf-8").strip(),
)
self.assertRegex(proc.stdout.decode("utf-8").strip(), r"^pylint 2\.17\.7")
self.assertRegex(proc.stdout.decode("utf-8").strip(), r"^pylint 4\.")

def test_pylint_report_has_expected_warnings(self):
rlocation_path = os.environ.get("PYLINT_REPORT")
Expand All @@ -61,10 +61,12 @@ def test_pylint_report_has_expected_warnings(self):
pylint_report = pathlib.Path(runfiles.Create().Rlocation(rlocation_path))
self.assertTrue(pylint_report.exists(), f"'{pylint_report}' does not exist")

report_text = pylint_report.read_text().strip()
self.assertRegex(
pylint_report.read_text().strip(),
r"W8201: Logging should be used instead of the print\(\) function\. \(print-function\)",
report_text,
r"C0116: Missing function or method docstring \(missing-function-docstring\)",
)
self.assertNotRegex(report_text, r"unused-import")


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion examples/bzlmod/entry_points/tests/pylint_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_pylint_entry_point(self):
"",
proc.stderr.decode("utf-8").strip(),
)
self.assertRegex(proc.stdout.decode("utf-8").strip(), r"^pylint 2\.17\.7")
self.assertRegex(proc.stdout.decode("utf-8").strip(), r"^pylint 4\.")


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions examples/bzlmod/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ dependencies = [
"s3cmd~=2.1.0",
"yamllint>=1.28.0",
"tabulate~=0.9.0",
"pylint~=2.17.7",
"pylint-print",
"pylint~=4.0.9",
"pylint-per-file-ignores",
"python-dateutil>=2.8.2",
"sphinx",
"sphinxcontrib-serializinghtml",
Expand Down
243 changes: 34 additions & 209 deletions examples/bzlmod/uv.lock

Large diffs are not rendered by default.

Loading