Skip to content

Commit 4d87aaa

Browse files
authored
Merge pull request #2 from aaronfranke/formatting
Add formatting script for GitHub Actions and add GitHub metadata
2 parents dfe6a06 + ee465ce commit 4d87aaa

File tree

7 files changed

+106
-2
lines changed

7 files changed

+106
-2
lines changed

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
patreon: godotengine
2+
custom: https://godotengine.org/donate
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Bug Report
3+
about: Report a bug with the extension.
4+
title: ''
5+
labels: bug
6+
assignees: neikeq
7+
8+
---
9+
10+
<!--
11+
Please search existing issues for potential duplicates before filing yours:
12+
https://github.com/godotengine/godot-csharp-visualstudio/issues?q=is%3Aissue
13+
14+
Only submit an issue if it is reproducible with the latest stable Godot version.
15+
-->
16+
17+
**OS/device including version:**
18+
<!-- Specify GPU model and drivers if graphics-related. -->
19+
20+
21+
**Issue description:**
22+
<!-- What happened, what was expected, and what went wrong. -->
23+
24+
25+
**Screenshots of issue:**
26+
<!--
27+
This section is optional.
28+
Drag in an image, or post an image with a link in the form of:
29+
![Alt Text Here](https://pbs.twimg.com/media/DW5AJnZVAAM1805?format=jpg)
30+
-->
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: Feature / Enhancement Request
3+
about: Adding new features or improving existing ones.
4+
title: ''
5+
labels: enhancement
6+
assignees: neikeq
7+
8+
---
9+
10+
<!--
11+
Please search existing issues for potential duplicates before filing yours:
12+
https://github.com/godotengine/godot-csharp-visualstudio/issues?q=is%3Aissue
13+
-->

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Continuous integration
2+
on: [push, pull_request]
3+
4+
jobs:
5+
build:
6+
runs-on: ubuntu-20.04
7+
steps:
8+
- name: Checkout
9+
uses: actions/checkout@v2
10+
11+
- name: Lint extension
12+
run: |
13+
sudo apt-get update -qq
14+
sudo apt-get install -qq dos2unix recode
15+
bash ./format.sh

GodotAddinVS.sln.DotSettings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
<s:Boolean x:Key="/Default/UserDictionary/Words/=clsid/@EntryIndexedValue">True</s:Boolean>
55
<s:Boolean x:Key="/Default/UserDictionary/Words/=Guids/@EntryIndexedValue">True</s:Boolean>
66
<s:Boolean x:Key="/Default/UserDictionary/Words/=Inferrer/@EntryIndexedValue">True</s:Boolean>
7-
<s:Boolean x:Key="/Default/UserDictionary/Words/=pbstr/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
7+
<s:Boolean x:Key="/Default/UserDictionary/Words/=pbstr/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

GodotCompletionProviders.Test/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@
2929
<package id="xunit.core" version="2.1.0" targetFramework="net45" />
3030
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" />
3131
<package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" />
32-
</packages>
32+
</packages>

format.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
3+
set -uo pipefail
4+
IFS=$'\n\t'
5+
6+
# Loops through all text files tracked by Git.
7+
git grep -zIl '' |
8+
while IFS= read -rd '' f; do
9+
# Exclude csproj and hdr files.
10+
if [[ "$f" == *"csproj" ]]; then
11+
continue
12+
elif [[ "$f" == *"hdr" ]]; then
13+
continue
14+
fi
15+
# Ensures that files are UTF-8 formatted.
16+
recode UTF-8 "$f" 2> /dev/null
17+
# Ensures that files have LF line endings.
18+
dos2unix "$f" 2> /dev/null
19+
# Ensures that files do not contain a BOM.
20+
sed -i '1s/^\xEF\xBB\xBF//' "$f"
21+
# Ensures that files end with newline characters.
22+
tail -c1 < "$f" | read -r _ || echo >> "$f";
23+
# Remove trailing space characters.
24+
sed -z -i 's/\x20\x0A/\x0A/g' "$f"
25+
done
26+
27+
git diff > patch.patch
28+
FILESIZE="$(stat -c%s patch.patch)"
29+
MAXSIZE=5
30+
31+
# If no patch has been generated all is OK, clean up, and exit.
32+
if (( FILESIZE < MAXSIZE )); then
33+
printf "Files in this commit comply with the formatting rules.\n"
34+
rm -f patch.patch
35+
exit 0
36+
fi
37+
38+
# A patch has been created, notify the user, clean up, and exit.
39+
printf "\n*** The following differences were found between the code "
40+
printf "and the formatting rules:\n\n"
41+
cat patch.patch
42+
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
43+
rm -f patch.patch
44+
exit 1

0 commit comments

Comments
 (0)