lint-rust.mjs 682 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env zx
  2. import 'zx/globals';
  3. import {
  4. cliArguments,
  5. getToolchainArgument,
  6. popArgument,
  7. workingDirectory,
  8. } from '../utils.mjs';
  9. // Configure additional arguments here, e.g.:
  10. // ['--arg1', '--arg2', ...cliArguments()]
  11. const lintArgs = cliArguments();
  12. const fix = popArgument(lintArgs, '--fix');
  13. const toolchain = getToolchainArgument('lint');
  14. const manifestPath = path.join(
  15. workingDirectory,
  16. 'clients',
  17. 'rust',
  18. 'Cargo.toml'
  19. );
  20. // Check the client using Clippy.
  21. if (fix) {
  22. await $`cargo ${toolchain} clippy --manifest-path ${manifestPath} --fix ${lintArgs}`;
  23. } else {
  24. await $`cargo ${toolchain} clippy --manifest-path ${manifestPath} ${lintArgs}`;
  25. }