Skip to content
Open
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
23 changes: 23 additions & 0 deletions .config/biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-FileCopyrightText: Elias Mueller
//
// SPDX-License-Identifier: MIT

{
"$schema": "https://biomejs.dev/schemas/2.4.10/schema.json",
"formatter": {
"indentStyle": "space",
"indentWidth": 4,
"lineEnding": "lf",
"lineWidth": 120
},
"javascript": {
"formatter": {
"bracketSpacing": true
}
},
"json": {
"formatter": {
"bracketSpacing": true
}
}
}
4 changes: 4 additions & 0 deletions .config/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# SPDX-FileCopyrightText: Elias Mueller
#
# SPDX-License-Identifier: MIT

# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

Expand Down
73 changes: 73 additions & 0 deletions .config/prek.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# SPDX-FileCopyrightText: Elias Mueller
#
# SPDX-License-Identifier: MIT

# Configuration file for `prek`, a git hook framework written in Rust.
# See https://prek.j178.dev for more information.
#:schema https://www.schemastore.org/prek.json

[[repos]]
repo = "builtin"
hooks = [
{ id = "end-of-file-fixer" },
{ id = "trailing-whitespace" },
]

[[repos]]
repo = "https://github.com/biomejs/pre-commit"
rev = "v2.4.13"
hooks = [
{
id = "biome-check",
name = "format json",
files = '\.(jsonc?)$',
exclude = '\.config/biome\.jsonc',
args = ["--config-path=.config"],
},
]

[[repos]]
repo = "https://github.com/tombi-toml/tombi-pre-commit"
rev = "v0.9.21"
hooks = [
{
id = "tombi-format",
name = "format toml",
exclude = "uv.lock",
args = [
"--offline",
]
},
]

[[repos]]
repo = "https://github.com/google/yamlfmt"
rev = "v0.21.0"
hooks = [
{
id = "yamlfmt",
name = "format yml",
args = ["-conf", ".config/yamlfmt.yaml"],
exclude = ".config/goreleaser.yml"
},
]

[[repos]]
repo = "https://github.com/hukkin/mdformat"
rev = "1.0.0"
hooks = [
{
id = "mdformat",
name = "format md",
exclude = ".github/",
args = ["--number", "--wrap", "keep", "--end-of-line", "lf"],
additional_dependencies = ["mdformat-gfm"]
},
]

[[repos]]
repo = "https://github.com/fsfe/reuse-tool"
rev = "v6.2.0"
hooks = [
{ id = "reuse-lint-file", name = "lint licenses" },
]
14 changes: 14 additions & 0 deletions .config/tombi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-FileCopyrightText: Elias Mueller
#
# SPDX-License-Identifier: MIT

toml-version = "v1.1.0"

[format]
[format.rules]
indent-style = "space"
indent-width = 4
line-ending = "lf"
line-width = 120
string-quote-style = "double"
trailing-comment-alignment = true
8 changes: 8 additions & 0 deletions .config/yamlfmt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SPDX-FileCopyrightText: Elias Mueller
#
# SPDX-License-Identifier: MIT

formatter:
line_ending: lf
retain_line_breaks_single: true
scan_folded_as_literal: true
28 changes: 0 additions & 28 deletions .pre-commit-config.yaml

This file was deleted.

33 changes: 33 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!--
SPDX-FileCopyrightText: Elias Mueller

SPDX-License-Identifier: MIT
-->

# Author

- The author has experience in Java, Kotlin, Python and TypeScript and wants to pick up Go next.

# Documentation

- Update design decisions in the docs/devel folder. Keep it short, reference doc comments if available and applicable.

# Dev Environment

- Use the Justfile to check what tasks are available
- Add common reoccurring tasks to the Justfile

# Coding

- Only document public functions, otherwise: keep comments to a minimum
- Write clean code and use good names
- Adhere to best practices
- Prefer modern idioms and new language features if they improve clarity

# Commiting

- Use conventional commits
- Follow the 50/72 rule
- Describe why it has changed
- Do not list individual files
- Add yourself as co-author
19 changes: 13 additions & 6 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,26 @@ init:
go install github.com/securego/gosec/v2/cmd/gosec@v2.22.10

format:
prek run --all-files
uv run prek --config .config/prek.toml run --all-files
go fmt ./...

update-git-hooks:
uv run prek --config .config/prek.toml auto-update

[group('dev')]
lint:
staticcheck ./...
gosec \
-exclude=G304 \
-quiet ./...

# Build the qmlimportsort binary
@build:
go build -o qmlimportsort ./cmd/qmlimportsort

# Run all tests
[group('dev')]
@test *FLAGS:
go test ./... {{ FLAGS }}
go clean -testcache
go test ./... {{ FLAGS }}

# Build the qmlimportsort binary
[group('build')]
@build:
go build -o qmlimportsort ./cmd/qmlimportsort
14 changes: 8 additions & 6 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@ Download pre-built binaries from the releases page.

## Usage

USAGE:
qmlimportsort [flags] [files...]
```
USAGE:
qmlimportsort [flags] [files...]

FLAGS:
--in-place, -i modify files in-place (only valid with files)
--help, -h show help
--version, -v print the version
FLAGS:
--in-place, -i modify files in-place (only valid with files)
--help, -h show help
--version, -v print the version
```

### Examples

Expand Down
12 changes: 12 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!--
SPDX-FileCopyrightText: Elias Mueller

SPDX-License-Identifier: MIT
-->

# Roadmap

## Refactor

1. **Design the CLI** — ✅ Done. Agreed surface: write-by-default, `--check` / `--stdout` / `--stdin` modes, recursive directory walking, skip dotfiles, atomic writes. Full spec in [docs/devel/CLI.md](docs/devel/CLI.md).
2. **Design the internal API** — ✅ Done. Split into `internal/qml` (pure `Format([]byte)`) and `internal/fs` (I/O shell: walker, atomic writes, stream/file helpers). `main` is a thin dispatcher. Full spec in [docs/devel/INTERNAL_API.md](docs/devel/INTERNAL_API.md).
63 changes: 0 additions & 63 deletions cmd/qmlimportsort/main.go

This file was deleted.

Loading
Loading