Skip to content

Conversation

@blorente
Copy link
Contributor

@blorente blorente commented Dec 12, 2025

Depends on bazelbuild/rules_rust#3772, and is a step towards #385 .

Store the exit code for clippy in a file instead of trying to guess it from the success marker.
This means that we no longer have to pass cap_at_warning=True, and we can properly report errors as errors without crashing the entire run.

Changes are visible to end-users: yes. They are now able to see errors as errors instead of warnings.

  • Searched for relevant documentation and updated as needed: yes
  • Breaking change (forces users to change their own code or config): no
  • Suggested release notes appear below: no

Test plan

  • New test cases added: Added a new machine_outputs test case that checks that both warnings and errors are produced.

@aspect-workflows
Copy link

aspect-workflows bot commented Dec 12, 2025

Test

All tests were cache hits

5 tests (100.0%) were fully cached saving 2s.


Test

example

⚠️ Buildkite build #590 failed.

//src/rust:ok_binary failed to build

in //tools/lint:linters.bzl%clippy aspect on rust_binary rule //src/rust:ok_binary:
Traceback (most recent call last):
	File "/mnt/ephemeral/output/rules_lint/example/external/aspect_rules_lint~/lint/clippy.bzl", line 84, column
30, in _clippy_aspect_impl
		rust_clippy_action.action(
	File "/mnt/ephemeral/output/rules_lint/example/external/rules_rust~/rust/private/clippy.bzl", line 104,
column 5, in rust_clippy_action
		def rust_clippy_action(ctx, clippy_executable, process_wrapper, crate_info, config, output = None,
success_marker = None, cap_at_warnings = False, extra_clippy_flags = [], error_format = None,
clippy_diagnostics_file = None):
Error: rust_clippy_action() got unexpected keyword arguments: exit_code_file, forward_clippy_exit_code

//src/rust:bad_lib failed to build

in //tools/lint:linters.bzl%clippy aspect on rust_library rule //src/rust:bad_lib:
Traceback (most recent call last):
	File "/mnt/ephemeral/output/rules_lint/example/external/aspect_rules_lint~/lint/clippy.bzl", line 84, column
30, in _clippy_aspect_impl
		rust_clippy_action.action(
	File "/mnt/ephemeral/output/rules_lint/example/external/rules_rust~/rust/private/clippy.bzl", line 104,
column 5, in rust_clippy_action
		def rust_clippy_action(ctx, clippy_executable, process_wrapper, crate_info, config, output = None,
success_marker = None, cap_at_warnings = False, extra_clippy_flags = [], error_format = None,
clippy_diagnostics_file = None):
Error: rust_clippy_action() got unexpected keyword arguments: exit_code_file, forward_clippy_exit_code

//src/rust:ok_binary_with_bad_noclippy_dep failed to build

in //tools/lint:linters.bzl%clippy aspect on rust_binary rule //src/rust:ok_binary_with_bad_noclippy_dep:
Traceback (most recent call last):
	File "/mnt/ephemeral/output/rules_lint/example/external/aspect_rules_lint~/lint/clippy.bzl", line 84, column
30, in _clippy_aspect_impl
		rust_clippy_action.action(
	File "/mnt/ephemeral/output/rules_lint/example/external/rules_rust~/rust/private/clippy.bzl", line 104,
column 5, in rust_clippy_action
		def rust_clippy_action(ctx, clippy_executable, process_wrapper, crate_info, config, output = None,
success_marker = None, cap_at_warnings = False, extra_clippy_flags = [], error_format = None,
clippy_diagnostics_file = None):
Error: rust_clippy_action() got unexpected keyword arguments: exit_code_file, forward_clippy_exit_code

//src/rust:binary_with_warning_and_error failed to build

in //tools/lint:linters.bzl%clippy aspect on rust_binary rule //src/rust:binary_with_warning_and_error:
Traceback (most recent call last):
	File "/mnt/ephemeral/output/rules_lint/example/external/aspect_rules_lint~/lint/clippy.bzl", line 84, column
30, in _clippy_aspect_impl
		rust_clippy_action.action(
	File "/mnt/ephemeral/output/rules_lint/example/external/rules_rust~/rust/private/clippy.bzl", line 104,
column 5, in rust_clippy_action
		def rust_clippy_action(ctx, clippy_executable, process_wrapper, crate_info, config, output = None,
success_marker = None, cap_at_warnings = False, extra_clippy_flags = [], error_format = None,
clippy_diagnostics_file = None):
Error: rust_clippy_action() got unexpected keyword arguments: exit_code_file, forward_clippy_exit_code

💡 To reproduce the build failures, run

bazel build //src/rust:ok_binary //src/rust:bad_lib //src/rust:ok_binary_with_bad_noclippy_dep //src/rust:binary_with_warning_and_error

Test (WORKSPACE) (Test)

example

⚠️ Buildkite build #590 failed.

//src/rust:binary_with_warning_and_error failed to build

in //tools/lint:linters.bzl%clippy aspect on rust_binary rule //src/rust:binary_with_warning_and_error:
Traceback (most recent call last):
	File "/mnt/ephemeral/output/rules_lint/example/external/aspect_rules_lint/lint/clippy.bzl", line 84, column
30, in _clippy_aspect_impl
		rust_clippy_action.action(
	File "/mnt/ephemeral/output/rules_lint/example/external/rules_rust/rust/private/clippy.bzl", line 104,
column 5, in rust_clippy_action
		def rust_clippy_action(ctx, clippy_executable, process_wrapper, crate_info, config, output = None,
success_marker = None, cap_at_warnings = False, extra_clippy_flags = [], error_format = None,
clippy_diagnostics_file = None):
Error: rust_clippy_action() got unexpected keyword arguments: exit_code_file, forward_clippy_exit_code

//src/rust:bad_lib failed to build

in //tools/lint:linters.bzl%clippy aspect on rust_library rule //src/rust:bad_lib:
Traceback (most recent call last):
	File "/mnt/ephemeral/output/rules_lint/example/external/aspect_rules_lint/lint/clippy.bzl", line 84, column
30, in _clippy_aspect_impl
		rust_clippy_action.action(
	File "/mnt/ephemeral/output/rules_lint/example/external/rules_rust/rust/private/clippy.bzl", line 104,
column 5, in rust_clippy_action
		def rust_clippy_action(ctx, clippy_executable, process_wrapper, crate_info, config, output = None,
success_marker = None, cap_at_warnings = False, extra_clippy_flags = [], error_format = None,
clippy_diagnostics_file = None):
Error: rust_clippy_action() got unexpected keyword arguments: exit_code_file, forward_clippy_exit_code

//src/rust:ok_binary failed to build

in //tools/lint:linters.bzl%clippy aspect on rust_binary rule //src/rust:ok_binary:
Traceback (most recent call last):
	File "/mnt/ephemeral/output/rules_lint/example/external/aspect_rules_lint/lint/clippy.bzl", line 84, column
30, in _clippy_aspect_impl
		rust_clippy_action.action(
	File "/mnt/ephemeral/output/rules_lint/example/external/rules_rust/rust/private/clippy.bzl", line 104,
column 5, in rust_clippy_action
		def rust_clippy_action(ctx, clippy_executable, process_wrapper, crate_info, config, output = None,
success_marker = None, cap_at_warnings = False, extra_clippy_flags = [], error_format = None,
clippy_diagnostics_file = None):
Error: rust_clippy_action() got unexpected keyword arguments: exit_code_file, forward_clippy_exit_code

//src/rust:ok_binary_with_bad_noclippy_dep failed to build

in //tools/lint:linters.bzl%clippy aspect on rust_binary rule //src/rust:ok_binary_with_bad_noclippy_dep:
Traceback (most recent call last):
	File "/mnt/ephemeral/output/rules_lint/example/external/aspect_rules_lint/lint/clippy.bzl", line 84, column
30, in _clippy_aspect_impl
		rust_clippy_action.action(
	File "/mnt/ephemeral/output/rules_lint/example/external/rules_rust/rust/private/clippy.bzl", line 104,
column 5, in rust_clippy_action
		def rust_clippy_action(ctx, clippy_executable, process_wrapper, crate_info, config, output = None,
success_marker = None, cap_at_warnings = False, extra_clippy_flags = [], error_format = None,
clippy_diagnostics_file = None):
Error: rust_clippy_action() got unexpected keyword arguments: exit_code_file, forward_clippy_exit_code

💡 To reproduce the build failures, run

bazel build //src/rust:binary_with_warning_and_error //src/rust:bad_lib //src/rust:ok_binary //src/rust:ok_binary_with_bad_noclippy_dep

@blorente blorente force-pushed the blorente/clippy-return-code branch from 64386dd to facd4b8 Compare December 12, 2025 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant