clippy.mts 728 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env zx
  2. import 'zx/globals';
  3. import {
  4. cliArguments,
  5. getToolchainArgument,
  6. popArgument,
  7. workingDirectory,
  8. } from './setup/shared.mts';
  9. const [folder, ...args] = cliArguments();
  10. const lintArgs = [
  11. '-Zunstable-options',
  12. '--all-targets',
  13. '--all-features',
  14. '--no-deps',
  15. '--',
  16. '--deny=warnings',
  17. ...args,
  18. ];
  19. const fix = popArgument(lintArgs, '--fix');
  20. const toolchain = getToolchainArgument('lint');
  21. const manifestPath = path.join(workingDirectory, folder, 'Cargo.toml');
  22. // Check the client using Clippy.
  23. if (fix) {
  24. await $`cargo ${toolchain} clippy --manifest-path ${manifestPath} --fix ${lintArgs}`;
  25. } else {
  26. await $`cargo ${toolchain} clippy --manifest-path ${manifestPath} ${lintArgs}`;
  27. }