Skip to content

Commit

Permalink
add setup instructions to starting template
Browse files Browse the repository at this point in the history
  • Loading branch information
shawntabrizi committed Aug 3, 2024
1 parent ea7ccc3 commit f22cee7
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 5 deletions.
4 changes: 2 additions & 2 deletions steps/0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ Or access the template directly here:

[https://github.com/shawntabrizi/substrate-collectables-workshop/releases/tag/starting-template](https://github.com/shawntabrizi/substrate-collectables-workshop/releases/tag/starting-template)

We will go over the starting template in detail throughout this section, but don't be afraid to peek around yourself.
The starting template includes a `README` with instructions to setup your working environment. Follow those instructions.

Make sure you are able to run the following checks on this initial template without warnings or errors:
Make sure you are able to run the following checks on this starting template without warnings or errors:

```bash
cargo +nightly fmt
Expand Down
60 changes: 57 additions & 3 deletions steps/2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,68 @@

This is the starting template for: https://github.com/shawntabrizi/substrate-collectables-workshop

## Setup

Follow [these installation instructions](https://docs.substrate.io/install/) to set up your development environment to work with the `polkadot-sdk`.

### test

To check that your code compiles successfully at each step, you can run:

```bash
cargo test
```

You should run this now to make sure this starting template is compiling successfully for you.

At the beginning and end of every step, you should be able to run `cargo test` without warning or errors. If you have either, you should learn from them and fix them!

### rustfmt

To keep your code clean and easy to read, we use a tool called [`rustfmt`](https://github.com/rust-lang/rustfmt). To access all the latest features of `rustfmt` we specifically use the `nightly` toolchain.

To install `rustfmt` for `nightly`:

```bash
rustup component add rustfmt --toolchain nightly
```

To configure the behavior of `rustfmt`, we have included a `rustfmt.toml` file.

Try running:

```bash
cargo +nightly fmt
```

You shouldn't see any changes this time around, but as you write more code, you will be able to see `cargo +nightly fmt` make everything look pretty, consistent, and easy to read.

> We recommend you run `cargo +nightly fmt` after every step!
### clippy

[Clippy](https://github.com/rust-lang/rust-clippy) is a collection of lints to catch common mistakes and improve your Rust code. We also use the `nightly` toolchain here to gain access to the latest features.

To install `clippy` for `nightly`:

```bash
rustup component add clippy
```

Try running:

```bash
cargo +nightly clippy
```

Again, you shouldn't see any errors here, but as you write code for this tutorial, `clippy` can be used to help improve the quality of your code.

## Cheat Sheet

You should be able to run all 3 of these commands at the end of every step without any errors or warnings.
You should run these 3 commands at the end of every step without any errors or warnings.

```bash
cargo +nightly fmt
cargo +nightly clippy
cargo test
```

I recommend you do this to ensure that you code is always compiles, is well formatted, and all that.

0 comments on commit f22cee7

Please sign in to comment.