Skip to content

Commit

Permalink
Use a better example in the README
Browse files Browse the repository at this point in the history
  • Loading branch information
stepchowfun committed Mar 13, 2024
1 parent ad41989 commit 4f5df3f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
- uses: actions/checkout@v3
- run: |
# Make Bash not silently ignore errors.
set -euo pipefail
set -euxo pipefail
# Install the appropriate version of Rust.
rustup toolchain install 1.76.0 # [ref:rust_1.76.0]
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ Tagref works with any programming language, and it respects your `.gitignore` fi

## What is it?

Tagref allows you to annotate your code with *tags* (in comments) which can be *referenced* from other parts of the codebase. For example, you might have a tag like this:
Tagref allows you to annotate your code with *tags* (in comments) which can be *referenced* from other parts of the codebase. For example, the following function has an important postcondition which is labeled with a tag:

```python
# [tag:cities_nonempty] There should be at least one city here.
cities = ['San Francisco', 'Tokyo']
# [tag:polynomial_nonzero] This function never returns zero.
def polynomial(x):
return x ** 2 + 1
```

Elsewhere, suppose you're writing some code which depends on that fact. You can make that clear by referencing the tag:
Elsewhere (possibly in a different file), suppose you're writing some code which depends on that fact. You can make that clear by referencing the tag:

```python
first_city = cities[0] # This is safe due to [ref:cities_nonempty].
def inverse_polynomial(x):
return 1 / polynomial(x) # This is safe due to [ref:polynomial_nonzero].
```

To help you manage these tags and references, Tagref checks the following:
Expand Down

0 comments on commit 4f5df3f

Please sign in to comment.