-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
186 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env zx | ||
import 'zx/globals'; | ||
import { | ||
getToolchainArgument, | ||
parseCliArguments, | ||
partitionArguments, | ||
popArgument, | ||
} from '../helpers/utils.mts'; | ||
|
||
// Extract the crate directory from the command-line arguments. | ||
const { manifestPath, args } = parseCliArguments(); | ||
// Configure additional arguments here, e.g.: | ||
// ['--arg1', '--arg2', ...args] | ||
const formatArgs = args; | ||
|
||
const fix = popArgument(args, '--fix'); | ||
const [cargoArgs, fmtArgs] = partitionArguments(formatArgs, '--'); | ||
const toolchain = getToolchainArgument('format'); | ||
|
||
await $`cargo ${toolchain} fmt --manifest-path ${manifestPath} ${cargoArgs} -- ${fix ? '' : '--check'} ${fmtArgs}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env zx | ||
import 'zx/globals'; | ||
import { | ||
getToolchainArgument, | ||
parseCliArguments, | ||
popArgument, | ||
} from '../helpers/utils.mts'; | ||
|
||
// Extract the crate directory from the command-line arguments. | ||
const { manifestPath, args } = parseCliArguments(); | ||
// Configure additional arguments here, e.g.: | ||
// ['--arg1', '--arg2', ...args] | ||
const clippyArgs = args; | ||
// Note: need to use nightly clippy as frozen-abi proc-macro generates | ||
// a lot of code (frozen-abi is enabled only under nightly due to the | ||
// use of unstable rust feature). Likewise, frozen-abi(-macro) crates' | ||
// unit tests are only compiled under nightly. | ||
const toolchain = getToolchainArgument('lint'); | ||
// Check if the `--fix` argument is present. | ||
const fix = popArgument(clippyArgs, '--fix'); | ||
|
||
await $`cargo ${toolchain} clippy --manifest-path ${manifestPath} ${fix ? '--fix' : ''} ${clippyArgs}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env zx | ||
import 'zx/globals'; | ||
import { getToolchainArgument, parseCliArguments } from '../helpers/utils.mts'; | ||
|
||
// Extract the crate directory from the command-line arguments. | ||
const { manifestPath, args } = parseCliArguments(); | ||
// Configure additional arguments here, e.g.: | ||
// ['--arg1', '--arg2', ...args] | ||
const docArgs = args; | ||
const toolchain = getToolchainArgument('lint'); | ||
|
||
await $`RUSTDOCFLAGS="--cfg docsrs -D warnings" cargo ${toolchain} doc --manifest-path ${manifestPath} --all-features --no-deps ${docArgs}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env zx | ||
import 'zx/globals'; | ||
import { getToolchainArgument, parseCliArguments } from '../helpers/utils.mts'; | ||
|
||
// Extract the crate directory from the command-line arguments. | ||
const { manifestPath, args } = parseCliArguments(); | ||
// Configure additional arguments here, e.g.: | ||
// ['--arg1', '--arg2', ...args] | ||
const featuresArgs = ['--exclude-features', 'frozen-abi', ...args]; | ||
const toolchain = getToolchainArgument('lint'); | ||
|
||
// Check feature powerset. | ||
await $`cargo ${toolchain} hack check --manifest-path ${manifestPath} --feature-powerset --all-targets ${featuresArgs}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Script to lint a crate. | ||
// | ||
// This script runs the following sub-scripts: | ||
// - lint-clippy.mjs | ||
// - lint-docs.mjs | ||
// - lint-features.mjs | ||
|
||
import { cliArguments, workingDirectory } from '../helpers/utils.mts'; | ||
|
||
const scripts = path.join(workingDirectory, 'scripts', 'rust'); | ||
|
||
// clippy | ||
await $`tsx ${path.join(scripts, 'lint-clippy.mjs')} ${cliArguments()}`; | ||
// rustdoc | ||
await $`tsx ${path.join(scripts, 'lint-docs.mjs')} ${cliArguments()}`; | ||
// features | ||
await $`tsx ${path.join(scripts, 'lint-features.mjs')} ${cliArguments()}`; |
Oops, something went wrong.