Remove astyle scripts

This commit is contained in:
Daniel Marjamäki 2021-08-07 21:06:14 +02:00
parent 7f358b2bed
commit dc65f9b1a7
4 changed files with 0 additions and 218 deletions

View File

@ -1,20 +0,0 @@
##############################################################
# Documentation is available from #
# http://astyle.sourceforge.net/astyle.html #
##############################################################
### Options ###
--pad-header
--unpad-paren
--suffix=none
--convert-tabs
--attach-inlines
--attach-classes
--attach-namespaces
### Settings ###
--style=kr
--indent=spaces=4
--indent-namespaces
--lineend=linux
--min-conditional-indent=0

View File

@ -1,79 +0,0 @@
#!/bin/bash
# The version check in this script is used to avoid commit battles
# between different developers that use different astyle versions as
# different versions might have different output (this has happened in
# the past).
# If project management wishes to take a newer astyle version into use
# just change this string to match the start of astyle version string.
ASTYLE_VERSION="3.0.1"
ASTYLE="${ASTYLE-astyle}"
DETECTED_VERSION=$("$ASTYLE" --version 2>&1 | awk '{ print $NF; }')
if [ "$DETECTED_VERSION" != "${ASTYLE_VERSION}" ]; then
echo "You should use version: ${ASTYLE_VERSION}"
echo "Detected version: ${DETECTED_VERSION}"
exit 1
fi
RCFILE=.astylerc
#
# Functions to format C/C++ source code
#
function formatCplusplus {
"$ASTYLE" --options=$RCFILE "$1"
}
function formatCplusplusRecursive {
RCFILE=.astylerc
"$ASTYLE" --options=$RCFILE --recursive "$1"
}
#
# Function to format XML files
#
function formatXML {
xmllint --format -o "$1_" "$1"
if cmp -s "$1_" "$1"; then
rm -f "$1_"
echo Unchanged $1
else
mv -f "$1_" "$1"
echo Formatted $1
fi
}
formatCplusplus "cli/*.cpp"
formatCplusplus "cli/*.h"
formatCplusplus "democlient/*.cpp"
formatCplusplus "gui/*.cpp"
formatCplusplus "gui/*.h"
formatCplusplusRecursive "gui/test/*.cpp"
formatCplusplusRecursive "gui/test/*.h"
formatCplusplus "lib/*.cpp"
formatCplusplus "lib/*.h"
formatCplusplus "oss-fuzz/*.cpp"
formatCplusplus "oss-fuzz/*.h"
formatCplusplus "test/*.cpp"
formatCplusplus "test/cfg/*.c"
formatCplusplus "test/cfg/*.cpp"
formatCplusplus "test/*.h"
formatCplusplusRecursive "tools/*.cpp"
formatCplusplusRecursive "tools/*.h"
formatCplusplusRecursive "samples/*.c"
formatCplusplusRecursive "samples/*.cpp"
# format config files
# TODO: use other tool than xmllint? use tabs instead of spaces?
for CFGFILE in cfg/*.cfg
do
formatXML "$CFGFILE"
done
for PLATFORMFILE in platforms/*.xml
do
formatXML "$PLATFORMFILE"
done
formatXML man/cppcheck.1.xml
formatXML cppcheck-errors.rng
formatXML rules/*.xml

View File

@ -1,67 +0,0 @@
@REM Script to run AStyle on the sources
@REM The version check in this script is used to avoid commit battles
@REM between different developers that use different astyle versions as
@REM different versions might have different output (this has happened in
@REM the past).
@REM If project management wishes to take a newer astyle version into use
@REM just change this string to match the start of astyle version string.
@SET ASTYLE_VERSION="Artistic Style Version 3.0.1"
@SET ASTYLE="astyle"
@SET DETECTED_VERSION=""
@FOR /F "tokens=*" %%i IN ('%ASTYLE% --version') DO SET DETECTED_VERSION=%%i
@ECHO %DETECTED_VERSION% | FINDSTR /B /C:%ASTYLE_VERSION% > nul && (
ECHO "%DETECTED_VERSION%" matches %ASTYLE_VERSION%
) || (
ECHO You should use: %ASTYLE_VERSION%
ECHO Detected: "%DETECTED_VERSION%"
GOTO EXIT_ERROR
)
@SET RCFILE=.astylerc
%ASTYLE% --options=%RCFILE% cli/*.cpp
%ASTYLE% --options=%RCFILE% cli/*.h
%ASTYLE% --options=%RCFILE% democlient/*.cpp
%ASTYLE% --options=%RCFILE% gui/*.cpp
%ASTYLE% --options=%RCFILE% gui/*.h
%ASTYLE% --options=%RCFILE% -r gui/test/*.cpp
%ASTYLE% --options=%RCFILE% -r gui/test/*.h
%ASTYLE% --options=%RCFILE% lib/*.cpp
%ASTYLE% --options=%RCFILE% lib/*.h
%ASTYLE% --options=%RCFILE% oss-fuzz/*.cpp
%ASTYLE% --options=%RCFILE% oss-fuzz/*.h
%ASTYLE% --options=%RCFILE% test/*.cpp
%ASTYLE% --options=%RCFILE% test/cfg/*.c
%ASTYLE% --options=%RCFILE% test/cfg/*.cpp
%ASTYLE% --options=%RCFILE% test/*.h
%ASTYLE% --options=%RCFILE% -r tools/*.cpp
%ASTYLE% --options=%RCFILE% -r tools/*.h
%ASTYLE% --options=%RCFILE% -r samples/*.c
%ASTYLE% --options=%RCFILE% -r samples/*.cpp
@REM Format configuration files
@SET XMLLINT=xmllint
WHERE %XMLLINT%
@IF %ERRORLEVEL% NEQ 0 (
ECHO WARNING: %XMLLINT% was not found. Skipping configuration file formatting!
) ELSE (
PUSHD "cfg"
FOR /F "tokens=* delims=" %%f IN ('DIR /B *.cfg') DO @CALL :runxmllint "%%f"
POPD
)
@GOTO :EOF
:EXIT_ERROR
EXIT /B 1
@REM Function that formats one XML file
@REM Argument: %1: XML-File to format
:runxmllint
xmllint --format -o "%~1_" "%~1"
MOVE /Y "%~1_" "%~1"
@GOTO :EOF

View File

@ -1,52 +0,0 @@
import requests
import subprocess
import sys
response = requests.get('https://api.github.com/repos/danmar/cppcheck/pulls/' + sys.argv[1])
if response.status_code == 200:
j = response.json()
login = j['user']['login']
title = j['title']
body = j['body']
branch = j['head']['ref']
sha = j['head']['sha']
subprocess.call('git checkout -b {}-{} master'.format(login, branch).split())
p = subprocess.Popen('git pull --rebase=true https://github.com/{}/cppcheck.git {}'.format(login, branch).split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
comm = p.communicate()
stdout = comm[0].decode(encoding='utf-8', errors='ignore')
stderr = comm[1].decode(encoding='utf-8', errors='ignore')
print(stdout)
print(stderr)
if stdout.find('CONFLICT') > 0 or stderr.find('CONFLICT') > 0:
print('FAIL; There was some conflict when rebasing the changes')
sys.exit(1)
if '-b' in sys.argv:
print('Done.')
sys.exit(1)
p = subprocess.Popen(['git', 'show', '--format=%an <%ae>', sha], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
comm = p.communicate()
author = comm[0].decode(encoding='utf-8', errors='ignore').split('\n')[0]
if login == 'pfultz2':
author = 'Paul Fultz II ' + author[author.find('<'):]
subprocess.call(['./runastyle'])
subprocess.call('git commit -a -m astyle'.split())
subprocess.call('git checkout master'.split())
subprocess.call('git merge --squash {}-{}'.format(login, branch).split())
subprocess.call(['git', 'commit', '-a', '--author='+author, '-m', title + '\n\n' + body])
subprocess.call('git branch -D {}-{}'.format(login, branch).split())
p = subprocess.Popen('git show --format=format:%h'.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
comm = p.communicate()
stdout = comm[0].decode(encoding='utf-8', errors='ignore')
if stdout.find('\n') > 0:
stdout = stdout[:stdout.find('\n')]
print('\nMessage: I merged this with ' + stdout)