Merge pull request #103 from limbonaut/pre-commit

Add pre-commit configuration
This commit is contained in:
Serhii Snitsaruk 2024-05-03 01:31:25 +02:00 committed by GitHub
commit 5e961ec6fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 63 additions and 35 deletions

24
.pre-commit-config.yaml Normal file
View File

@ -0,0 +1,24 @@
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6
hooks:
- id: clang-format
files: \.(c|h|cpp|hpp|cc|cxx|m|mm|inc|java|glsl)$
types_or: [text]
exclude: |
(?x)^(
tests/python_build.*|
.*thirdparty.*|
.*platform/android/java/lib/src/com.*|
.*-so_wrap.*
)
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.2.0
hooks:
- id: black
files: (\.py$|SConstruct|SCsub)
types_or: [text]
exclude: .*thirdparty.*
args:
- --line-length=120

2
SCsub
View File

@ -5,7 +5,7 @@ Import("env_modules")
module_env = env.Clone()
module_env.Append(CPPDEFINES = ['LIMBOAI_MODULE'])
module_env.Append(CPPDEFINES=["LIMBOAI_MODULE"])
module_env.add_source_files(env.modules_sources, "*.cpp")
module_env.add_source_files(env.modules_sources, "blackboard/*.cpp")

View File

@ -6,19 +6,19 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = 'LimboAI'
copyright = '2021-present Serhii Snitsaruk and the LimboAI contributors'
author = 'Serhii Snitsaruk and the LimboAI contributors'
release = '1.0'
project = "LimboAI"
copyright = "2021-present Serhii Snitsaruk and the LimboAI contributors"
author = "Serhii Snitsaruk and the LimboAI contributors"
release = "1.0"
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = ['sphinx_rtd_dark_mode', 'sphinx_copybutton']
extensions = ["sphinx_rtd_dark_mode", "sphinx_copybutton"]
master_doc = 'index'
templates_path = ['_templates']
exclude_patterns = ['_build']
master_doc = "index"
templates_path = ["_templates"]
exclude_patterns = ["_build"]
# -- Markdown configuration (sphinx_markdown_builder).
# markdown_anchor_sections = True
@ -33,12 +33,11 @@ default_dark_mode = False
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
html_logo = "logo.png"
html_theme_options = {
'logo_only': True,
'display_version': True,
"logo_only": True,
"display_version": True,
"collapse_navigation": True,
}

View File

@ -14,22 +14,22 @@ env = SConscript("godot-cpp/SConstruct")
# tweak this if you want to use different folders, or more folders, to store your source code in.
env.Append(CPPPATH=["limboai/"])
env.Append(CPPDEFINES = ['LIMBOAI_GDEXTENSION'])
env.Append(CPPDEFINES=["LIMBOAI_GDEXTENSION"])
sources = Glob("limboai/*.cpp")
sources += (Glob("limboai/blackboard/*.cpp"))
sources += (Glob("limboai/blackboard/bb_param/*.cpp"))
sources += (Glob("limboai/bt/*.cpp"))
sources += (Glob("limboai/bt/tasks/*.cpp"))
sources += (Glob("limboai/bt/tasks/blackboard/*.cpp"))
sources += (Glob("limboai/bt/tasks/composites/*.cpp"))
sources += (Glob("limboai/bt/tasks/decorators/*.cpp"))
sources += (Glob("limboai/bt/tasks/scene/*.cpp"))
sources += (Glob("limboai/bt/tasks/utility/*.cpp"))
sources += (Glob("limboai/gdextension/*.cpp"))
sources += (Glob("limboai/editor/debugger/*.cpp"))
sources += (Glob("limboai/editor/*.cpp"))
sources += (Glob("limboai/hsm/*.cpp"))
sources += (Glob("limboai/util/*.cpp"))
sources += Glob("limboai/blackboard/*.cpp")
sources += Glob("limboai/blackboard/bb_param/*.cpp")
sources += Glob("limboai/bt/*.cpp")
sources += Glob("limboai/bt/tasks/*.cpp")
sources += Glob("limboai/bt/tasks/blackboard/*.cpp")
sources += Glob("limboai/bt/tasks/composites/*.cpp")
sources += Glob("limboai/bt/tasks/decorators/*.cpp")
sources += Glob("limboai/bt/tasks/scene/*.cpp")
sources += Glob("limboai/bt/tasks/utility/*.cpp")
sources += Glob("limboai/gdextension/*.cpp")
sources += Glob("limboai/editor/debugger/*.cpp")
sources += Glob("limboai/editor/*.cpp")
sources += Glob("limboai/hsm/*.cpp")
sources += Glob("limboai/util/*.cpp")
if env["platform"] == "macos":

View File

@ -31,18 +31,23 @@ def get_script_dir():
def main():
silent = False
try:
opts, args = getopt.getopt(sys.argv[1:],
"s", ["silent"])
opts, args = getopt.getopt(sys.argv[1:], "s", ["silent"])
except getopt.GetoptError as e:
print('%s: %s!\n' % (os.path.basename(__file__), e.msg,))
print(
"%s: %s!\n"
% (
os.path.basename(__file__),
e.msg,
)
)
usage()
sys.exit(2)
for opt, arg in opts:
if opt in ('-h', '--help'):
if opt in ("-h", "--help"):
usage()
sys.exit(0)
elif opt in ('-s','--silent'):
elif opt in ("-s", "--silent"):
silent = True
config_dir = get_script_dir()
@ -66,7 +71,7 @@ def main():
icon_files.sort()
for icon_file in icon_files:
content += os.path.splitext(icon_file)[0] + " = \"res://addons/limboai/icons/" + icon_file + "\"\n"
content += os.path.splitext(icon_file)[0] + ' = "res://addons/limboai/icons/' + icon_file + '"\n'
f = open(config_path, "w")
f.write(content)