Skip to content

Commit cb98b55

Browse files
committed
HACKING.md: Fixed outdated information
Signed-off-by: Ole Herman Schumacher Elgesem <ole@northern.tech>
1 parent f768b0e commit cb98b55

1 file changed

Lines changed: 47 additions & 51 deletions

File tree

HACKING.md

Lines changed: 47 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,53 @@ This document aims to have relevant information for people contributing to and m
44
It is not necessary for users of the tool to know about these processes.
55
For general user information, see the [README](./README.md).
66

7+
## Code formatting
8+
9+
We use automated code formatters to ensure consistent code style / indentation.
10+
Please format Python code with [black](https://pypi.org/project/black/), and YAML and markdown files with [Prettier](https://prettier.io/).
11+
For simplicity's sake, we don't have a custom configuration, we use the tool's defaults.
12+
13+
If your editor does not do this automatically, you can run these tools from the command line:
14+
15+
```bash
16+
make format
17+
```
18+
19+
## Installing from source:
20+
21+
For developers working on CFEngine CLI, it is recommended to install an editable version of the tool:
22+
23+
```bash
24+
make install
25+
```
26+
27+
Some of the tests require that you have the CLI installed (they run `cfengine` commands).
28+
29+
## Running commands without installing
30+
31+
You can also run commands without installing, using `uv`:
32+
33+
```bash
34+
uv run cfengine format
35+
```
36+
37+
## Running tests
38+
39+
Use the makefile command to run all linting and tests:
40+
41+
```bash
42+
make check
43+
```
44+
45+
Running individual test suites:
46+
47+
```bash
48+
uv run pytest
49+
bash tests/run-lint-tests.sh
50+
bash tests/run-format-tests.sh
51+
bash tests/run-shell-tests.sh
52+
```
53+
754
## Releasing new versions
855

956
Releases are [automated using a GH Action](https://github.com/cfengine/cfengine-cli/blob/main/.github/workflows/pypi-publish.yml)
@@ -79,62 +126,11 @@ Copy the token and paste it into the GitHub Secret named `PYPI_PASSWORD`.
79126
`PYPI_USERNAME` should be there already, you don't have to edit it, it is simply `__token__`.
80127
Don't store the token anywhere else - we generate new tokens if necessary.
81128

82-
## Code formatting
83-
84-
We use automated code formatters to ensure consistent code style / indentation.
85-
Please format Python code with [black](https://pypi.org/project/black/), and YAML and markdown files with [Prettier](https://prettier.io/).
86-
For simplicity's sake, we don't have a custom configuration, we use the tool's defaults.
87-
88-
If your editor does not do this automatically, you can run these tools from the command line:
89-
90-
```bash
91-
black . && prettier . --write
92-
```
93-
94-
## Running commands during development
95-
96-
This project uses `uv`.
97-
This makes it easy to run commands without installing the project, for example:
98-
99-
```bash
100-
uv run cfengine format
101-
```
102-
103-
## Installing from source:
104-
105-
```bash
106-
git fetch --all --tags
107-
pip3 install .
108-
```
109-
110-
## Running tests
111-
112-
Unit tests:
113-
114-
```bash
115-
py.test
116-
```
117-
118-
Shell tests (requires installing first):
119-
120-
```bash
121-
cat tests/shell/*.sh | bash
122-
```
123-
124129
## Not implemented yet / TODOs
125130

126131
- `cfengine run`
127132
- The command could automatically detect that you have CFEngine installed on a remote hub, and run it there instead (using `cf-remote`).
128133
- Handle when `cf-agent` is not installed, help users install.
129134
- Prompt / help users do what they meant (i.e. build and deploy and run).
130-
- `cfengine format`
131-
- Automatically break up and indent method calls, function calls, and nested function calls.
132-
- Smarter placement of comments based on context.
133-
- The command should be able to take a filename as an argument, and also operate using stdin and stdout.
134-
(Receive file content on stdin, file type using command line arg, output formatted file to stdout).
135-
- We can add a shortcut, `cfengine fmt`, since that matches other tools, like `deno`.
136-
- `cfengine lint`
137-
- The command should be able to take a filename as an argument, and also take file content from stdin.
138-
- It would be nice if we refactored `validate_config()` in `cfbs` so it would take a simple dictionary (JSON) instead of a special CFBSConfig object.
139135
- Missing commands:
140136
- `cfengine install` - Install CFEngine packages / binaries (Wrapping `cf-remote install`).

0 commit comments

Comments
 (0)