summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorAaron Franke <arnfranke@yahoo.com>2020-07-13 01:53:54 -0400
committerAaron Franke <arnfranke@yahoo.com>2020-07-13 14:14:11 -0400
commit16f7b464b689fe2ed00c5ff2949df030eed61238 (patch)
tree78a3fa651a5cf84420a9dd73cc961fe504963f71 /misc
parent99864393525a8a61afc4de384650930ef8d3c70f (diff)
Remove Travis CI style checks and unnecessary scripts
Diffstat (limited to 'misc')
-rwxr-xr-xmisc/scripts/fix_headers.py102
-rwxr-xr-xmisc/scripts/fix_style.sh78
-rwxr-xr-xmisc/travis/black-format.sh48
-rwxr-xr-xmisc/travis/clang-format.sh48
4 files changed, 0 insertions, 276 deletions
diff --git a/misc/scripts/fix_headers.py b/misc/scripts/fix_headers.py
deleted file mode 100755
index 7af97eec4b..0000000000
--- a/misc/scripts/fix_headers.py
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-header = """\
-/*************************************************************************/
-/* $filename */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-"""
-
-files = open("files", "r")
-
-fname = files.readline()
-
-while fname != "":
-
- # Handle replacing $filename with actual filename and keep alignment
- fsingle = fname.strip()
- if fsingle.find("/") != -1:
- fsingle = fsingle[fsingle.rfind("/") + 1 :]
- rep_fl = "$filename"
- rep_fi = fsingle
- len_fl = len(rep_fl)
- len_fi = len(rep_fi)
- # Pad with spaces to keep alignment
- if len_fi < len_fl:
- for x in range(len_fl - len_fi):
- rep_fi += " "
- elif len_fl < len_fi:
- for x in range(len_fi - len_fl):
- rep_fl += " "
- if header.find(rep_fl) != -1:
- text = header.replace(rep_fl, rep_fi)
- else:
- text = header.replace("$filename", fsingle)
- text += "\n"
-
- # We now have the proper header, so we want to ignore the one in the original file
- # and potentially empty lines and badly formatted lines, while keeping comments that
- # come after the header, and then keep everything non-header unchanged.
- # To do so, we skip empty lines that may be at the top in a first pass.
- # In a second pass, we skip all consecutive comment lines starting with "/*",
- # then we can append the rest (step 2).
-
- fileread = open(fname.strip(), "r")
- line = fileread.readline()
- header_done = False
-
- while line.strip() == "": # Skip empty lines at the top
- line = fileread.readline()
-
- if line.find("/**********") == -1: # Godot header starts this way
- # Maybe starting with a non-Godot comment, abort header magic
- header_done = True
-
- while not header_done: # Handle header now
- if line.find("/*") != 0: # No more starting with a comment
- header_done = True
- if line.strip() != "":
- text += line
- line = fileread.readline()
-
- while line != "": # Dump everything until EOF
- text += line
- line = fileread.readline()
-
- fileread.close()
-
- # Write
- filewrite = open(fname.strip(), "w")
- filewrite.write(text)
- filewrite.close()
-
- # Next file
- fname = files.readline()
-
-files.close()
diff --git a/misc/scripts/fix_style.sh b/misc/scripts/fix_style.sh
deleted file mode 100755
index 2eee61a459..0000000000
--- a/misc/scripts/fix_style.sh
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/env bash
-
-# Command line arguments
-run_black=false
-run_clang_format=false
-run_fix_headers=false
-usage="Invalid argument. Usage:\n$0 <option>\n\t--black|-b\n\t--clang-format|-c\n\t--headers|-h\n\t--all|-a"
-
-if [ -z "$1" ]; then
- echo -e $usage
- exit 0
-fi
-
-while [ $# -gt 0 ]; do
- case "$1" in
- --black|-b)
- run_black=true
- ;;
- --clang-format|-c)
- run_clang_format=true
- ;;
- --headers|-h)
- run_fix_headers=true
- ;;
- --all|-a)
- run_black=true
- run_clang_format=true
- run_fix_headers=true
- ;;
- *)
- echo -e $usage
- exit 0
- esac
- shift
-done
-
-echo "Removing generated files, some have binary data and make clang-format freeze."
-find -name "*.gen.*" -delete
-
-# Apply black
-if $run_black; then
- echo -e "Formatting Python files..."
- PY_FILES=$(find \( -path "./.git" \
- -o -path "./thirdparty" \
- \) -prune \
- -o \( -name "SConstruct" \
- -o -name "SCsub" \
- -o -name "*.py" \
- \) -print)
- black -l 120 $PY_FILES
-fi
-
-# Apply clang-format
-if $run_clang_format; then
- # Sync list with pre-commit hook
- FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m .mm .inc .java .glsl"
-
- for extension in ${FILE_EXTS}; do
- echo -e "Formatting ${extension} files..."
- find \( -path "./.git" \
- -o -path "./thirdparty" \
- -o -path "./platform/android/java/lib/src/com/google" \
- \) -prune \
- -o -name "*${extension}" \
- -exec clang-format -i {} \;
- done
-fi
-
-# Add missing copyright headers
-if $run_fix_headers; then
- echo "Fixing copyright headers in Godot code files..."
- find \( -path "./.git" -o -path "./thirdparty" \) -prune \
- -o -regex '.*\.\(c\|h\|cpp\|hpp\|cc\|hh\|cxx\|m\|mm\|java\)' \
- > tmp-files
- cat tmp-files | grep -v ".git\|thirdparty\|theme_data.h\|platform/android/java/lib/src/com/google\|platform/android/java/lib/src/org/godotengine/godot/input/InputManager" > files
- python misc/scripts/fix_headers.py
- rm -f tmp-files files
-fi
diff --git a/misc/travis/black-format.sh b/misc/travis/black-format.sh
deleted file mode 100755
index 75b153f6bb..0000000000
--- a/misc/travis/black-format.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-
-BLACK=black
-BLACK_OPTIONS="-l 120"
-
-if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
- # Travis only clones the PR branch and uses its HEAD commit as detached HEAD,
- # so it's problematic when we want an exact commit range for format checks.
- # We fetch upstream to ensure that we have the proper references to resolve.
- # Ideally we would use $TRAVIS_COMMIT_RANGE but it doesn't play well with PR
- # updates, as it only includes changes since the previous state of the PR.
- if [ -z "$(git remote | grep upstream)" ]; then
- git remote add upstream https://github.com/godotengine/godot \
- --no-tags -f -t $TRAVIS_BRANCH
- fi
- RANGE="upstream/$TRAVIS_BRANCH HEAD"
-else
- # Test only the last commit, since $TRAVIS_COMMIT_RANGE wouldn't support
- # force pushes.
- RANGE=HEAD
-fi
-
-FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/| grep -E "(SConstruct|SCsub|\.py)$")
-echo "Checking files:\n$FILES"
-
-# create a random filename to store our generated patch
-prefix="static-check-black"
-suffix="$(date +%s)"
-patch="/tmp/$prefix-$suffix.patch"
-
-for file in $FILES; do
- "$BLACK" "$BLACK_OPTIONS" --diff "$file" | \
- sed -e "1s|--- |--- a/|" -e "2s|+++ |+++ b/|" >> "$patch"
-done
-
-# if no patch has been generated all is ok, clean up the file stub and exit
-if [ ! -s "$patch" ] ; then
- printf "Files in this commit comply with the black formatting rules.\n"
- rm -f "$patch"
- exit 0
-fi
-
-# a patch has been created, notify the user and exit
-printf "\n*** The following differences were found between the code to commit "
-printf "and the black formatting rules:\n\n"
-pygmentize -l diff "$patch"
-printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
-exit 1
diff --git a/misc/travis/clang-format.sh b/misc/travis/clang-format.sh
deleted file mode 100755
index c917744ece..0000000000
--- a/misc/travis/clang-format.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-
-CLANG_FORMAT=clang-format-8
-
-if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
- # Travis only clones the PR branch and uses its HEAD commit as detached HEAD,
- # so it's problematic when we want an exact commit range for format checks.
- # We fetch upstream to ensure that we have the proper references to resolve.
- # Ideally we would use $TRAVIS_COMMIT_RANGE but it doesn't play well with PR
- # updates, as it only includes changes since the previous state of the PR.
- if [ -z "$(git remote | grep upstream)" ]; then
- git remote add upstream https://github.com/godotengine/godot \
- --no-tags -f -t $TRAVIS_BRANCH
- fi
- RANGE="upstream/$TRAVIS_BRANCH HEAD"
-else
- # Test only the last commit, since $TRAVIS_COMMIT_RANGE wouldn't support
- # force pushes.
- RANGE=HEAD
-fi
-
-FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/ | grep -v platform/android/java/lib/src/com/ | grep -E "\.(c|h|cpp|hpp|cc|hh|cxx|m|mm|inc|java|glsl)$")
-echo "Checking files:\n$FILES"
-
-# create a random filename to store our generated patch
-prefix="static-check-clang-format"
-suffix="$(date +%s)"
-patch="/tmp/$prefix-$suffix.patch"
-
-for file in $FILES; do
- "$CLANG_FORMAT" -style=file "$file" | \
- diff -u "$file" - | \
- sed -e "1s|--- |--- a/|" -e "2s|+++ -|+++ b/$file|" >> "$patch"
-done
-
-# if no patch has been generated all is ok, clean up the file stub and exit
-if [ ! -s "$patch" ] ; then
- printf "Files in this commit comply with the clang-format rules.\n"
- rm -f "$patch"
- exit 0
-fi
-
-# a patch has been created, notify the user and exit
-printf "\n*** The following differences were found between the code to commit "
-printf "and the clang-format rules:\n\n"
-pygmentize -l diff "$patch"
-printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
-exit 1