All Projects → Scony → Godot Gdscript Toolkit

Scony / Godot Gdscript Toolkit

Licence: mit
Independent set of GDScript tools - parser, linter and formatter

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Godot Gdscript Toolkit

Verible
Verible is a suite of SystemVerilog developer tools, including a parser, style-linter, and formatter.
Stars: ✭ 384 (+79.44%)
Mutual labels:  linter, parser, formatter
Godot card engine
A plugin for Godot to create card based games
Stars: ✭ 160 (-25.23%)
Mutual labels:  godot, godot-engine
Voxel Core
Voxel plugin for the Godot game engine!
Stars: ✭ 148 (-30.84%)
Mutual labels:  godot, godot-engine
Godot Card Game Framework
A framework which comes with prepared scenes and classes and scenes to kickstart your card game, as well as a powerful scripting engine to use to provide full rules enforcement.
Stars: ✭ 210 (-1.87%)
Mutual labels:  godot, godot-engine
Pixelorama
A free & open-source 2D sprite editor, made with the Godot Engine! Available on Windows, Linux, macOS and the Web!
Stars: ✭ 2,535 (+1084.58%)
Mutual labels:  godot, godot-engine
Godot Syntax Themes
Syntax themes for the Godot Engine script editor
Stars: ✭ 140 (-34.58%)
Mutual labels:  godot, godot-engine
Godot Ci
Docker image to export Godot Engine games. Templates for Gitlab CI and GitHub Actions to deploy to GitLab Pages/GitHub Pages/Itch.io.
Stars: ✭ 168 (-21.5%)
Mutual labels:  godot, godot-engine
Gdscript Docs Maker
Create documentation and class references from your Godot GDScript code
Stars: ✭ 121 (-43.46%)
Mutual labels:  godot, godot-engine
Godot Beginner 2d Platformer
Learn to create a 2d platform game with the Godot game engine. This is a beginner programming tutorial.
Stars: ✭ 183 (-14.49%)
Mutual labels:  godot, godot-engine
Godot Kotlin Native
Kotlin bindings for Godot Engine
Stars: ✭ 186 (-13.08%)
Mutual labels:  godot, godot-engine
Godot Kickstarter 2019
Create your Own Games with Godot, the Free Game Engine: sources from the January Kickstarter project from GDQuest
Stars: ✭ 194 (-9.35%)
Mutual labels:  godot, godot-engine
Drstring
DrString finds issues in your Swift docstrings and fixes them for you.
Stars: ✭ 133 (-37.85%)
Mutual labels:  linter, formatter
Pgsgp
Play Games Services plugin for Godot Game Engine 3.2 - Android
Stars: ✭ 130 (-39.25%)
Mutual labels:  godot, godot-engine
Chart Gd
Animated charts for Godot Engine
Stars: ✭ 151 (-29.44%)
Mutual labels:  godot, godot-engine
Godot Ink
Ink integration for Godot Engine.
Stars: ✭ 129 (-39.72%)
Mutual labels:  godot, godot-engine
Poetic
Automatically install and maintain ESLint, Prettier, EditorConfig and Airbnb rules for JavaScript, TypeScript and React.
Stars: ✭ 165 (-22.9%)
Mutual labels:  linter, formatter
Graphql Parser
A graphql query language and schema definition language parser and formatter for rust
Stars: ✭ 203 (-5.14%)
Mutual labels:  parser, formatter
Inkgd
Implementation of inkle's Ink in pure GDScript for Godot, with editor support.
Stars: ✭ 118 (-44.86%)
Mutual labels:  godot, godot-engine
Gamedev4noobs
Olá, sejam bem-vindos ao repositório _gamedev4noobs_ do Estúdio Vaca Roxa. O propósito desse repositório, além de contribuir para o projeto 4noobs, é ensinar o básico do desenvolvimento de jogos para iniciantes. Apresentando boas práticas e insumos para criar games incríveis.
Stars: ✭ 122 (-42.99%)
Mutual labels:  godot, godot-engine
Godot Jigglebones
An addon that brings jigglebones to Godot Engine 3.0.
Stars: ✭ 175 (-18.22%)
Mutual labels:  godot, godot-engine

GDScript Toolkit

License: MIT Code style: black

This project provides a set of tools for daily work with GDScript. At the moment it provides:

  • A parser that produces a parse tree for debugging and educational purposes.
  • A linter that performs a static analysis according to some predefined configuration.
  • A formatter that formats the code according to some predefined rules.

Installation

To install this project you need python3 and pip.

Use this command in your terminal to install from this git repository:

pip3 install gdtoolkit

Linting with gdlint

To run a linter you need to perform installation first. Once done, you can run e.g.:

$ gdlint misc/MarkovianPCG.gd

Which outputs messages like:

misc/MarkovianPCG.gd:96: Error: Function argument name "aOrigin" is not valid (function-argument-name)
misc/MarkovianPCG.gd:96: Error: Function argument name "aPos" is not valid (function-argument-name)

To tweak the default check settings, you can dump the default config to a file:

$ gdlint -d
$ cat gdlintrc
class-load-variable-name: (([A-Z][a-z0-9]*)+|_?[a-z][a-z0-9]*(_[a-z0-9]+)*)
class-name: ([A-Z][a-z0-9]*)+
class-variable-name: _?[a-z][a-z0-9]*(_[a-z0-9]+)*
constant-name: '[A-Z][A-Z0-9]*(_[A-Z0-9]+)*'
disable: []
enum-element-name: '[A-Z][A-Z0-9]*(_[A-Z0-9]+)*'
enum-name: ([A-Z][a-z0-9]*)+
function-argument-name: _?[a-z][a-z0-9]*(_[a-z0-9]+)*
function-arguments-number: 10
function-preload-variable-name: ([A-Z][a-z0-9]*)+
function-name: (_on_([A-Z][a-z0-9]*)+(_[a-z0-9]+)*|_?[a-z][a-z0-9]*(_[a-z0-9]+)*)
function-variable-name: '[a-z][a-z0-9]*(_[a-z0-9]+)*'
load-constant-name: (([A-Z][a-z0-9]*)+|[A-Z][A-Z0-9]*(_[A-Z0-9]+)*)
loop-variable-name: _?[a-z][a-z0-9]*(_[a-z0-9]+)*
signal-name: '[a-z][a-z0-9]*(_[a-z0-9]+)*'
sub-class-name: _?([A-Z][a-z0-9]*)+

Once the dump is performed, you can modify the gdlintrc file and optionally rename it to .gdlintrc. From now on, linter will use this config file to override the default config.

Formatting with gdformat

Formatting may lead to data loss, so it's highly recommended to use it along with Version Control System (VCS) e.g. git

gdformat is the uncompromising GDScript code formatter. The only configurable thing is max line length allowed (--line-length). The rest will be taken care of by gdformat in a one, consistent way.

To run a formatter you need to perform installation first. Once done, given a test.gd file:

class X:
	var x=[1,2,{'a':1}]
	var y=[1,2,3,]     # trailing comma
	func foo(a:int,b,c=[1,2,3]):
		if a in c and \
		   b > 100:
			print('foo')
func bar():
	print('bar')

when you run gdformat test.gd, the test.gd file will be reformatted as follows:

class X:
	var x = [1, 2, {'a': 1}]
	var y = [
		1,
		2,
		3,
	]  # trailing comma

	func foo(a: int, b, c = [1, 2, 3]):
		if a in c and b > 100:
			print('foo')


func bar():
	print('bar')

If the program formats your files successfully, it will return the exit code 0. Non-zero code will be returned otherwise.

Parsing with gdparse

To parse a file, use the gdparse program:

gdparse tests/valid-gd-scripts/recursive_tool.gd -p

The parser outputs a tree that represents your code's structure:

start
  class_def
    X
    class_body
      tool_stmt
      signal_stmt	sss
  class_def
    Y
    class_body
      tool_stmt
      signal_stmt	sss
  tool_stmt

If the program parses your file sucessfully, it will return the exit code 0.

Running tests

To run tests you need tox, a tool to automate testing in Python.

Install it with:

pip3 install tox

To invoke entire test suite, in the godot-gdscript-toolkit project directory, run:

tox

You can run only selected test cases:

tox -e py3 -- -k lint

For manual testing, you can consider installing package in editable mode:

pip3 install -e .
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].