mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Remove checkpatch, since it's tuned for C not C++ (#1250)
Co-authored-by: Eldred Habert <eldredhabert0@gmail.com>
This commit is contained in:
@@ -1,88 +0,0 @@
|
|||||||
# Configuration for checkpatch.pl
|
|
||||||
# ===============================
|
|
||||||
|
|
||||||
# Enable more tests
|
|
||||||
--strict
|
|
||||||
|
|
||||||
# Quiet
|
|
||||||
--quiet
|
|
||||||
|
|
||||||
# No per-file summary
|
|
||||||
--no-summary
|
|
||||||
|
|
||||||
# Don't expect the Linux kernel tree
|
|
||||||
--no-tree
|
|
||||||
|
|
||||||
# Show file line, not input line
|
|
||||||
--showfile
|
|
||||||
|
|
||||||
# Don't expect SPDX tag in the first line of a file
|
|
||||||
--ignore SPDX_LICENSE_TAG
|
|
||||||
|
|
||||||
# Don't expect Signed-off-by lines in commit messages
|
|
||||||
--no-signoff
|
|
||||||
|
|
||||||
# List of ignored rules
|
|
||||||
# ---------------------
|
|
||||||
|
|
||||||
# There's no BIT macro
|
|
||||||
--ignore BIT_MACRO
|
|
||||||
|
|
||||||
# Don't complain when bools are used in structs
|
|
||||||
--ignore BOOL_MEMBER
|
|
||||||
|
|
||||||
# Allow CamelCase
|
|
||||||
--ignore CAMELCASE
|
|
||||||
|
|
||||||
# Comparing to NULL explicitly isn't a bad thing
|
|
||||||
--ignore COMPARISON_TO_NULL
|
|
||||||
|
|
||||||
# Causes false positives
|
|
||||||
--ignore COMPLEX_MACRO
|
|
||||||
|
|
||||||
# Don't complain about structs not being const
|
|
||||||
--ignore CONST_STRUCT
|
|
||||||
|
|
||||||
# Don't complain about printing "warning:" without the function name, as warning
|
|
||||||
# printing is relevant to the code being parsed, not RGBDS' code
|
|
||||||
--ignore EMBEDDED_FUNCTION_NAME
|
|
||||||
|
|
||||||
# Do not check the format of commit messages
|
|
||||||
--ignore GIT_COMMIT_ID
|
|
||||||
|
|
||||||
# Do not check for global initializers (this is specific to the kernel)
|
|
||||||
--ignore GLOBAL_INITIALISERS
|
|
||||||
|
|
||||||
# Don't complain about initializing statics (this is specific to the kernel)
|
|
||||||
--ignore INITIALISED_STATIC
|
|
||||||
|
|
||||||
# We don't have a MAINTAINERS file, don't complain about it.
|
|
||||||
--ignore FILE_PATH_CHANGES
|
|
||||||
|
|
||||||
# Writing the continuation on the start of the line can make it clearer
|
|
||||||
--ignore LOGICAL_CONTINUATIONS
|
|
||||||
|
|
||||||
# Don't complain if a line that contains a string is too long. It's better to
|
|
||||||
# have a really long line that can be found with grep.
|
|
||||||
--ignore LONG_LINE_STRING
|
|
||||||
|
|
||||||
# Don't complain when files are modified in 'include/asm'
|
|
||||||
--ignore MODIFIED_INCLUDE_ASM
|
|
||||||
|
|
||||||
# Allow new typedefs
|
|
||||||
--ignore NEW_TYPEDEFS
|
|
||||||
|
|
||||||
# We allow lines ending with parentheses for the usage prints
|
|
||||||
--ignore OPEN_ENDED_LINE
|
|
||||||
|
|
||||||
# Prefer stdint.h types over kernel types
|
|
||||||
--ignore PREFER_KERNEL_TYPES
|
|
||||||
|
|
||||||
# Don't ask to replace sscanf by kstrto
|
|
||||||
--ignore SSCANF_TO_KSTRTO
|
|
||||||
|
|
||||||
# Parentheses can make the code clearer
|
|
||||||
--ignore UNNECESSARY_PARENTHESES
|
|
||||||
|
|
||||||
# We don't have `fallthrough;` */
|
|
||||||
--ignore PREFER_FALLTHROUGH
|
|
||||||
25
.github/workflows/checkpatch.yml
vendored
25
.github/workflows/checkpatch.yml
vendored
@@ -1,25 +0,0 @@
|
|||||||
name: "Code style checking"
|
|
||||||
on: pull_request
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
checkpatch:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Set up repo
|
|
||||||
run: |
|
|
||||||
git clone -b "${{ github.event.pull_request.head.ref }}" "${{ github.event.pull_request.head.repo.clone_url }}" rgbds
|
|
||||||
cd rgbds
|
|
||||||
git remote add upstream "${{ github.event.pull_request.base.repo.clone_url }}"
|
|
||||||
git fetch upstream
|
|
||||||
- name: Set up checkpatch
|
|
||||||
working-directory: rgbds
|
|
||||||
run: |
|
|
||||||
wget 'https://raw.githubusercontent.com/torvalds/linux/master/scripts/checkpatch.pl'
|
|
||||||
chmod +x checkpatch.pl
|
|
||||||
wget 'https://raw.githubusercontent.com/torvalds/linux/master/scripts/const_structs.checkpatch'
|
|
||||||
wget 'https://raw.githubusercontent.com/torvalds/linux/master/scripts/spelling.txt'
|
|
||||||
- name: Checkpatch
|
|
||||||
working-directory: rgbds
|
|
||||||
run: |
|
|
||||||
make checkpatch CHECKPATCH=./checkpatch.pl "BASE_REF=${{ github.event.pull_request.base.sha }}" Q= | tee log
|
|
||||||
if grep -q ERROR: log; then exit 1; else exit 0; fi
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,7 +10,6 @@
|
|||||||
*.gcno
|
*.gcno
|
||||||
*.gcda
|
*.gcda
|
||||||
*.gcov
|
*.gcov
|
||||||
.checkpatch-camelcase.*
|
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
CMakeFiles/
|
CMakeFiles/
|
||||||
cmake_install.cmake
|
cmake_install.cmake
|
||||||
|
|||||||
@@ -74,22 +74,10 @@ copyright and the reference to the MIT License.
|
|||||||
new warning (but it may be possible to remove some warning checks if it makes
|
new warning (but it may be possible to remove some warning checks if it makes
|
||||||
the code much easier).
|
the code much easier).
|
||||||
|
|
||||||
5. Follow the Linux kernel coding style, which can be found in the file
|
5. Format your changes according to ``clang-format``, which will reformat the
|
||||||
``Documentation/process/coding-style.rst`` in the Linux kernel repository.
|
coding style according to our standards defined in ``.clang-format``.
|
||||||
Note that the coding style isn't written in stone, if there is a good reason
|
|
||||||
to deviate from it, it should be fine.
|
|
||||||
|
|
||||||
6. Download the files ``checkpatch.pl``, ``const_structs.checkpatch`` and
|
6. Create a pull request against the branch ``master``.
|
||||||
``spelling.txt`` from the folder ``scripts`` in the Linux kernel repository.
|
|
||||||
|
|
||||||
7. To use ``checkpatch.pl`` you can use ``make checkpatch``, which will check
|
7. Be prepared to get some comments about your code and to modify it. Tip: Use
|
||||||
the coding style of all patches between the current one and the upstream
|
|
||||||
code. By default, the Makefile expects the script (and associate files) to be
|
|
||||||
located in ``../linux/scripts/``, but you can place them anywhere you like as
|
|
||||||
long as you specify it when executing the command:
|
|
||||||
``make checkpatch CHECKPATCH=../path/to/folder``.
|
|
||||||
|
|
||||||
8. Create a pull request against the branch ``master``.
|
|
||||||
|
|
||||||
9. Be prepared to get some comments about your code and to modify it. Tip: Use
|
|
||||||
``git rebase -i origin/master`` to modify chains of commits.
|
``git rebase -i origin/master`` to modify chains of commits.
|
||||||
|
|||||||
28
Makefile
28
Makefile
@@ -3,8 +3,7 @@
|
|||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.SUFFIXES: .cpp .y .o
|
.SUFFIXES: .cpp .y .o
|
||||||
|
|
||||||
.PHONY: all clean install checkcodebase checkpatch checkdiff \
|
.PHONY: all clean install checkdiff develop debug coverage mingw32 mingw64 wine-shim dist
|
||||||
develop debug coverage mingw32 mingw64 wine-shim dist
|
|
||||||
|
|
||||||
# User-defined variables
|
# User-defined variables
|
||||||
|
|
||||||
@@ -15,7 +14,6 @@ mandir := ${PREFIX}/share/man
|
|||||||
STRIP := -s
|
STRIP := -s
|
||||||
BINMODE := 755
|
BINMODE := 755
|
||||||
MANMODE := 644
|
MANMODE := 644
|
||||||
CHECKPATCH := ../linux/scripts/checkpatch.pl
|
|
||||||
|
|
||||||
# Other variables
|
# Other variables
|
||||||
|
|
||||||
@@ -197,30 +195,6 @@ install: all
|
|||||||
$Qinstall -m ${MANMODE} man/rgbds.5 man/rgbasm.5 man/rgblink.5 ${DESTDIR}${mandir}/man5/
|
$Qinstall -m ${MANMODE} man/rgbds.5 man/rgbasm.5 man/rgblink.5 ${DESTDIR}${mandir}/man5/
|
||||||
$Qinstall -m ${MANMODE} man/rgbds.7 man/gbz80.7 ${DESTDIR}${mandir}/man7/
|
$Qinstall -m ${MANMODE} man/rgbds.7 man/gbz80.7 ${DESTDIR}${mandir}/man7/
|
||||||
|
|
||||||
# Target used to check the coding style of the whole codebase.
|
|
||||||
# `extern/` is excluded, as it contains external code that should not be patched
|
|
||||||
# to meet our coding style, so applying upstream patches is easier.
|
|
||||||
# `.y` files aren't checked, unfortunately...
|
|
||||||
|
|
||||||
checkcodebase:
|
|
||||||
$Qfor file in `git ls-files | grep -E '(\.cpp|\.hpp)$$' | grep -Ev '(src|include)/extern/'`; do \
|
|
||||||
${CHECKPATCH} -f "$$file"; \
|
|
||||||
done
|
|
||||||
|
|
||||||
# Target used to check the coding style of the patches from the upstream branch
|
|
||||||
# to the HEAD. Runs checkpatch once for each commit between the current HEAD and
|
|
||||||
# the first common commit between the HEAD and origin/master.
|
|
||||||
# `.y` files aren't checked, unfortunately...
|
|
||||||
|
|
||||||
checkpatch:
|
|
||||||
$QCOMMON_COMMIT=`git merge-base HEAD ${BASE_REF}`; \
|
|
||||||
for commit in `git rev-list $$COMMON_COMMIT..HEAD`; do \
|
|
||||||
echo "[*] Analyzing commit '$$commit'"; \
|
|
||||||
git format-patch --stdout "$$commit~..$$commit" \
|
|
||||||
-- src include '!src/extern' '!include/extern' \
|
|
||||||
| ${CHECKPATCH} - || true; \
|
|
||||||
done
|
|
||||||
|
|
||||||
# Target used to check for suspiciously missing changed files.
|
# Target used to check for suspiciously missing changed files.
|
||||||
|
|
||||||
checkdiff:
|
checkdiff:
|
||||||
|
|||||||
@@ -472,8 +472,6 @@ void patch_CheckAssertions(struct Assertion *assert)
|
|||||||
fatal(assert->patch.src, assert->patch.lineNo, "%s",
|
fatal(assert->patch.src, assert->patch.lineNo, "%s",
|
||||||
assert->message[0] ? assert->message
|
assert->message[0] ? assert->message
|
||||||
: "assert failure");
|
: "assert failure");
|
||||||
// Not reached
|
|
||||||
break; // Here so checkpatch doesn't complain
|
|
||||||
case ASSERT_ERROR:
|
case ASSERT_ERROR:
|
||||||
error(assert->patch.src, assert->patch.lineNo, "%s",
|
error(assert->patch.src, assert->patch.lineNo, "%s",
|
||||||
assert->message[0] ? assert->message
|
assert->message[0] ? assert->message
|
||||||
|
|||||||
Reference in New Issue
Block a user