godotengine / godotengine/godot-docs

GDScript style guide: Newlines within arrays/dictionaries/enums

Open
#3,154 1 comment 0 reactions 1 assignee Claimed by @NathanLovato View on GitHub
area:manual discussion enhancement
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

The style guide currently contains many places where they have line breaks:

```
var party = [
"Godot",
"Godette",
"Steve",
]

var character_dir = {
"Name": "Bob",
"Age": 27,
"Job": "Mechanic",
}

enum Tiles {
TILE_BRICK,
TILE_FLOOR,
TILE_SPIKE,
TILE_TELEPORT,
}

enum Element {
EARTH,
WATER,
AIR,
FIRE,
}
```

And many places where they don't:

```
my_array = [4, 5, 6]

enum Tiles {TILE_BRICK, TILE_FLOOR, TILE_SPIKE, TILE_TELEPORT}

enum Jobs {KNIGHT, WIZARD, ROGUE, HEALER, SHAMAN}
```

I've been using the former when I was updating the demo projects earlier, but I noticed the latter when I was reviewing https://github.com/godotengine/godot-demo-projects/pull/405.

I think a style should be chosen for each of arrays/dictionaries/enums, or a guideline should be created for when to use which style (number of items? length of items? total enum length?) and if other styles are ever acceptable, like would this ever be allowed:

```
enum Tiles {
TILE_BRICK, TILE_FLOOR,
TILE_SPIKE, TILE_TELEPORT,
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.