Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README and CONTRIBUTING guidelines #98

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- checkout
- run:
name: Install pytest
command: pip install pytest
command: make install
- run:
name: Test git commits
command: make test
Expand All @@ -36,12 +36,13 @@ jobs:

prettier:
docker:
- image: tmknom/prettier:3.0.0
# See https://hub.docker.com/r/tmknom/prettier/tags for available tags.
- image: tmknom/prettier:3.2.5
steps:
- checkout
- run:
name: Check Prettier
command: prettier --check .
command: prettier --check --parser=markdown .

workflows:
static-analysis:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.python-version
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
*.yml
*.yaml
*.json
.pytest_cache/
.circleci/
.prettierignore
.spelling
makefile
2 changes: 2 additions & 0 deletions .spelling
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ sendgrid
stylelint
vscode
webtest
homebrew
markdownlint

# Terminology
ORM-constructs
Expand Down
112 changes: 64 additions & 48 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,90 +1,106 @@
# Contributing

Markdown code in this repo must pass several static analysis tests, which are
detailed below. Note that you can run:
You're welcome to suggest changes if you spot a broken link or typo. Clone the
repo or use the GitHub UI to make a pull request.

```sh
make ci
```
## Installation

to run these checks before pushing to Github.
Several tests are run on changes in CI. To replicate these tests locally, you'll
need to install some tools. None are essential but they will detect possible
problems before CI does.

## Git commit subjects

Git commit subjects must:

- Be no longer than 70 characters;
- Start with a capital letter;
- Not end with a full stop;

Further, pull request branches should rebase off `main` to incorporate upstream
changes; don't merge `main` into your branch.
### Prettier

These rules are checked using Pytest in CI.
Ensure [Prettier](https://prettier.io/) version 3.2.5 is installed. It can be installed with:

## Formatting
npm install -g [email protected]

All markdown should be formatted with [Prettier](https://prettier.io/) version 3.0.0
This can be installed on your host OS with:
Verify the installed version is correct with:

npm install -g [email protected]
prettier --version

Once installed, ensure your editor runs Prettier on a pre-save hook:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see pre-save hook in the cookie-cutter repo too but my Google-fu must be weak because I can't find this term. Is this another way of phrasing eg. Prettier running locally in your IDE when you save?


- [PyCharm instructions](https://www.jetbrains.com/help/pycharm/prettier.html)
- [VSCode instructions](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
- [Vim instructions](https://prettier.io/docs/en/vim.html)

Prettier conformance is checked in CI and configured via `.prettierrc.yaml` and
`.prettierignore`.
### Docker

## Spelling
Ensure you have Docker installed and [you have an account](https://www.docker.com/get-started/).
Mac users can [install from Homebrew](https://formulae.brew.sh/formula/docker).

Pull requests must pass a spell-check before merge. This is done using the
[`tmaier/markdown-spellcheck`](https://hub.docker.com/r/tmaier/markdown-spellcheck)
Docker image.
### Python tooling

To run the spell-test locally run:
Ensure you have a Python 3.11 virtual environment created for this project and
Python packages have been installed with `make install`.

make spell_check
There are various ways of doing this - here is one that uses `pyenv` and `pyenv-virtualenvwrapper`:

or:
```sh
pyenv local 3.11.4 # Match the version in `.circleci/config.yml`
mkvirtualenv conventions
make install
```

docker run --rm -ti -v $(pwd):/workdir tmaier/markdown-spellcheck:latest \
--report --ignore-numbers --ignore-acronyms "**/*.md"
## Development

Add exceptions to the custom dictionary in `.spelling`.
### Formatting

## Linting
Markdown should be formatted with Prettier using the configuration in
`.prettierrc.yaml`. Verify this with:

Markdown files are linted by
[`markdownlint-cli`](https://github.com/igorshubovych/markdownlint-cli).
```sh
make prettier_check
Copy link
Author

@ioreka ioreka Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get a really long output of [warn]s for this that i am reluctant to fix:
image
Not sure if that's the desired outcome

```

To run the linting locally run:
### Linting

docker run -i --rm -v `pwd`:/work tmknom/markdownlint:0.33.0
Markdown should conform to the Markdownlint rules declared in
`.markdownlint.yaml`. Verify this with:

or, if installed on your host OS, run:
```sh
make markdownlint
```

markdownlint .
### Spelling

or:
Markdown must pass a spell-check. Verify this with:

make markdownlint
```sh
make spell_check
```

Spelling exceptions are held in `.spelling`.

Configuration for the enforced rules is in `.markdownlint.yaml`.
### Commit messages

Many linting issues can be fixed by running:
Git commit subjects must:

markdownlint --fix .
- Be no longer than 70 characters.
- Start with a capital letter.
- Not end with a full stop.

## Preview rendered pages
Further, PR branches should rebase off `main` to incorporate upstream
changes; don't merge `main` into your branch.

These rules are checked using Pytest in CI. Verify conformance with:

```sh
make test
```

### Preview rendered pages

You can use [`grip`](https://github.com/joeyespo/grip) to render Github-flavour
markdown files. Install with:

brew install grip
```sh
brew install grip
```

While working on docs, run a local, auto-reloading server with:

make server
```sh
make server
```
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ the complete set of Kraken Tech coding conventions, you'll need to [apply for a
here][jobs] 😜.

[group]: https://octopusenergy.group/
[jobs]: https://jobs.lever.co/octoenergy?department=Kraken%20Technologies%20%F0%9F%93%88
[jobs]: https://kraken.tech/jobs

Contents:

Expand Down
9 changes: 8 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# Run all checks run in CI.
ci: test markdownlint spell_check prettier_check

test:
pytest -v .circleci/

markdownlint:
markdownlint .
docker run --rm -v $$(pwd):/work tmknom/markdownlint:0.33.0 -- .

spell_check:
docker run --rm -ti -v $$(pwd):/workdir tmaier/markdown-spellcheck:latest --report --ignore-numbers --ignore-acronyms "**/*.md"

prettier_check:
prettier --check --parser=markdown .

install:
pip install pytest==8.3.4

server:
grip