Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pre-commit hooks to replace the file_format.sh script #89233

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
1 change: 0 additions & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,3 @@ CheckOptions:
- key: readability-braces-around-statements.ShortStatementLines
value: '0'
...

1 change: 0 additions & 1 deletion .github/actions/godot-api-dump/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ runs:
with:
name: 'godot-api-dump'
path: './godot-api/*'

4 changes: 0 additions & 4 deletions .github/workflows/static_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ jobs:
- name: Style checks via pre-commit
uses: pre-commit/[email protected]

- name: File formatting checks (file_format.sh)
run: |
bash ./misc/scripts/file_format.sh changed.txt

- name: Header guards formatting checks (header_guards.sh)
run: |
bash ./misc/scripts/header_guards.sh changed.txt
Expand Down
37 changes: 30 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
# Globally exclude files which shouldn't be modified by any pre-commit hooks.
exclude: |
(?x)^(
.*\.patch| # Expected to contain trailing whitespace
modules/gdscript/tests/scripts/.*| # Expected to contain trailing whitespace
.*\.pot|
.*\.po|
thirdparty/.*| # Third-party files
platform/android/java/lib/src/com/google.*| # Third-party files
.*-so_wrap\..* # Generated code
)

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-json

- id: check-yaml
exclude: .clang-format

- id: check-executables-have-shebangs
- id: check-symlinks
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: forbid-submodules
- id: mixed-line-ending

- id: trailing-whitespace
exclude: tests/data/line_endings_cr.test.txt

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6
hooks:
Expand All @@ -8,9 +38,6 @@ repos:
exclude: |
(?x)^(
tests/python_build.*|
.*thirdparty.*|
.*platform/android/java/lib/src/com.*|
.*-so_wrap.*
)

- repo: https://github.com/psf/black-pre-commit-mirror
Expand All @@ -19,7 +46,6 @@ repos:
- id: black
files: (\.py$|SConstruct|SCsub)
types_or: [text]
exclude: .*thirdparty.*
args:
- --line-length=120

Expand All @@ -40,9 +66,6 @@ repos:
exclude: |
(?x)^(
tests/python_build.*|
.*thirdparty.*|
.*platform/android/java/lib/src/com.*|
.*-so_wrap.*|
platform/android/java/lib/src/org/godotengine/godot/gl/GLSurfaceView.*|
platform/android/java/lib/src/org/godotengine/godot/gl/EGLLogWrapper.*|
platform/android/java/lib/src/org/godotengine/godot/utils/ProcessPhoenix.*
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/GDExtensionManager.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<return type="int" enum="GDExtensionManager.LoadStatus" />
<param index="0" name="path" type="String" />
<description>
Reloads the extension at the given file path. The [param path] needs to point to a valid [GDExtension], otherwise this method may return either [constant LOAD_STATUS_NOT_LOADED] or [constant LOAD_STATUS_FAILED].
Reloads the extension at the given file path. The [param path] needs to point to a valid [GDExtension], otherwise this method may return either [constant LOAD_STATUS_NOT_LOADED] or [constant LOAD_STATUS_FAILED].
[b]Note:[/b] You can only reload extensions in the editor. In release builds, this method always fails and returns [constant LOAD_STATUS_FAILED].
</description>
</method>
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/Node.xml
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@
[b]Note:[/b] When changing the name, the following characters will be replaced with an underscore: ([code].[/code] [code]:[/code] [code]@[/code] [code]/[/code] [code]"[/code] [code]%[/code]). In particular, the [code]@[/code] character is reserved for auto-generated names. See also [method String.validate_node_name].
</member>
<member name="owner" type="Node" setter="set_owner" getter="get_owner">
The owner of this node. The owner must be an ancestor of this node. When packing the owner node in a [PackedScene], all the nodes it owns are also saved with it.
The owner of this node. The owner must be an ancestor of this node. When packing the owner node in a [PackedScene], all the nodes it owns are also saved with it.
[b]Note:[/b] In the editor, nodes not owned by the scene root are usually not displayed in the Scene dock, and will [b]not[/b] be saved. To prevent this, remember to set the owner after calling [method add_child]. See also (see [member unique_name_in_owner])
</member>
<member name="process_mode" type="int" setter="set_process_mode" getter="get_process_mode" enum="Node.ProcessMode" default="0">
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/Time.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
<method name="get_time_zone_from_system" qualifiers="const">
<return type="Dictionary" />
<description>
Returns the current time zone as a dictionary of keys: [code]bias[/code] and [code]name[/code].
Returns the current time zone as a dictionary of keys: [code]bias[/code] and [code]name[/code].
- [code]bias[/code] is the offset from UTC in minutes, since not all time zones are multiples of an hour from UTC.
- [code]name[/code] is the localized name of the time zone, according to the OS locale settings of the current user.
</description>
Expand Down
2 changes: 1 addition & 1 deletion editor/icons/FolderCreate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion editor/icons/Parallax2D.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion editor/icons/TileMapLayer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion gles3_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ def build_gles3_header(
fd.write("\t}\n\n")

fd.write("};\n\n")
fd.write("#endif\n\n")
fd.write("#endif\n")
fd.close()


Expand Down
1 change: 0 additions & 1 deletion misc/dist/ios_xcode/godot_ios/en.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/* Localized versions of Info.plist keys */

1 change: 0 additions & 1 deletion misc/error_suppressions/tsan.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ deadlock:tests/core/templates/test_command_queue.h
deadlock:modules/text_server_adv/text_server_adv.cpp
deadlock:modules/text_server_fb/text_server_fb.cpp
race:modules/navigation/nav_map.cpp

2 changes: 1 addition & 1 deletion misc/msvs/props.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
<ItemGroup Condition="%%CONDITION%%">
%%EXTRA_ITEMS%%
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion misc/msvs/vcxproj.filters.template
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
</Project>
<!-- CHECKSUM
%%HASH%%
-->
-->
2 changes: 1 addition & 1 deletion misc/msvs/vcxproj.template
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
89 changes: 0 additions & 89 deletions misc/scripts/file_format.sh

This file was deleted.

2 changes: 1 addition & 1 deletion modules/enet/doc_classes/ENetConnection.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
<param index="1" name="destination_port" type="int" />
<param index="2" name="packet" type="PackedByteArray" />
<description>
Sends a [param packet] toward a destination from the address and port currently bound by this ENetConnection instance.
Sends a [param packet] toward a destination from the address and port currently bound by this ENetConnection instance.
This is useful as it serves to establish entries in NAT routing tables on all devices between this bound instance and the public facing internet, allowing a prospective client's connection packets to be routed backward through the NAT device(s) between the public internet and this host.
This requires forward knowledge of a prospective client's address and communication port as seen by the public internet - after any NAT devices have handled their connection request. This information can be obtained by a [url=https://en.wikipedia.org/wiki/STUN]STUN[/url] service, and must be handed off to your host by an entity that is not the prospective client. This will never work for a client behind a Symmetric NAT due to the nature of the Symmetric NAT routing algorithm, as their IP and Port cannot be known beforehand.
</description>
Expand Down
2 changes: 1 addition & 1 deletion modules/gdscript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@ There are many other classes in the GDScript module. Here is a brief overview of
- The [virtual machine](gdscript_vm.cpp) is essentially defined as calling `GDScriptFunction::call()`.
- Editor-related functions can be found in parts of `GDScriptLanguage`, originally declared in [`gdscript.h`](gdscript.h) but defined in [`gdscript_editor.cpp`](gdscript_editor.cpp). Code highlighting can be found in [`GDScriptSyntaxHighlighter`](editor/gdscript_highlighter.h).
- GDScript decompilation is found in [`gdscript_disassembler.cpp`](gdscript_disassembler.h), defined as `GDScriptFunction::disassemble()`.
- Documentation generation from GDScript comments in [`GDScriptDocGen`](editor/gdscript_docgen.h)
- Documentation generation from GDScript comments in [`GDScriptDocGen`](editor/gdscript_docgen.h)
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<GodotTargetPlatform Condition=" '$(GodotTargetPlatform)' == '' and $(RuntimeIdentifier.StartsWith('osx')) ">macos</GodotTargetPlatform>
<GodotTargetPlatform Condition=" '$(GodotTargetPlatform)' == '' and $(RuntimeIdentifier.StartsWith('win')) ">windows</GodotTargetPlatform>
</PropertyGroup>

<!-- Auto-detect the target Godot platform if it was not specified and there's no runtime identifier information. -->
<PropertyGroup Condition=" '$(GodotTargetPlatform)' == '' ">
<GodotTargetPlatform Condition=" '$([MSBuild]::IsOsPlatform(Linux))' ">linuxbsd</GodotTargetPlatform>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
<XCodePath Condition=" '$(XCodePath)' == '' ">/Applications/Xcode.app/Contents/Developer</XCodePath>
<XCodePath>$([MSBuild]::EnsureTrailingSlash('$(XCodePath)'))</XCodePath>
</PropertyGroup>

<Target Name="PrepareBeforeIlcCompile"
BeforeTargets="IlcCompile">

<Copy SourceFiles="%(ResolvedRuntimePack.PackageDirectory)/runtimes/$(RuntimeIdentifier)/native/icudt.dat" DestinationFolder="$(PublishDir)"/>

<!-- We need to find the path to Xcode so we can set manual linker args to the correct SDKs
Expand All @@ -29,9 +29,9 @@
<XCodePath>$(XcodeSelect)</XCodePath>
<XCodePath>$([MSBuild]::EnsureTrailingSlash('$(XCodePath)'))</XCodePath>
</PropertyGroup>

<Message Importance="normal" Text="Found XCode at $(XcodeSelect)" Condition=" '$(FindXCode)' == 'true' "/>

<ItemGroup>
<LinkerArg Include="-mios-simulator-version-min=12.0 -isysroot %22$(XCodePath)Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk%22"
Condition=" $(RuntimeIdentifier.Contains('simulator')) "/>
Expand All @@ -54,5 +54,5 @@
</ItemGroup>
<Copy SourceFiles="@(SymbolFiles)" DestinationFolder="$(PublishDir)$(TargetName).framework.dSYM"/>
</Target>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

public partial class ClassPartialModifier : Node
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

public class {|GD0001:ClassPartialModifier|} : Node
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// This works because it inherits from GodotObject.
[GlobalClass]
public partial class CustomGlobalClass1 : GodotObject
public partial class CustomGlobalClass1 : GodotObject
{

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// This works because it inherits from GodotObject and it doesn't have any generic type parameter.
[GlobalClass]
public partial class CustomGlobalClass : GodotObject
public partial class CustomGlobalClass : GodotObject
{

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public void MethodCallsError()
// This raises a GD0301 diagnostic error: object is not Variant (and Method<T> requires a variant generic type).
Method<{|GD0301:object|}>();
}

public void MethodCallsOk()
{
// All these calls are valid because they are Variant types.
Expand Down Expand Up @@ -69,7 +69,7 @@ public void MethodCallsOk()
public void Method<[MustBeVariant] T>()
{
}

public void MustBeVariantClasses()
{
new ClassWithGenericVariant<bool>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,3 @@ class GodotProjectManager : GodotEditor() {
// Nothing to do here.. we have yet to select a project to load.
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -1955,4 +1955,3 @@ public void releaseEglContextLocked(GLThread thread) {
private int mEGLContextClientVersion;
private boolean mPreserveEGLContextOnPause;
}

1 change: 0 additions & 1 deletion platform/android/java/scripts/publish-root.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ nexusPublishing {
}
}
}

Loading
Loading