From dc65f9b1a7e5906fd3c9ed6b96a4d6db5d299e22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 7 Aug 2021 21:06:14 +0200 Subject: [PATCH] Remove astyle scripts --- .astylerc | 20 ------------- runastyle | 79 --------------------------------------------------- runastyle.bat | 67 ------------------------------------------- tools/pr.py | 52 --------------------------------- 4 files changed, 218 deletions(-) delete mode 100755 .astylerc delete mode 100755 runastyle delete mode 100644 runastyle.bat delete mode 100644 tools/pr.py diff --git a/.astylerc b/.astylerc deleted file mode 100755 index 450a57322..000000000 --- a/.astylerc +++ /dev/null @@ -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 diff --git a/runastyle b/runastyle deleted file mode 100755 index 7a270e6ba..000000000 --- a/runastyle +++ /dev/null @@ -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 diff --git a/runastyle.bat b/runastyle.bat deleted file mode 100644 index 0d64d026e..000000000 --- a/runastyle.bat +++ /dev/null @@ -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 diff --git a/tools/pr.py b/tools/pr.py deleted file mode 100644 index 62b88809d..000000000 --- a/tools/pr.py +++ /dev/null @@ -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) - - -