summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo van Kemenade <hugovk@users.noreply.github.com>2023-05-08 14:03:52 (GMT)
committerGitHub <noreply@github.com>2023-05-08 14:03:52 (GMT)
commitd513ddee94a05783b98f2b55f8fc0a4efbb9be82 (patch)
tree23c9f711d1d14a8b37fd1c7e923a66b4919c48ad
parent1f5679540ca4aa5c0eae06d3a2d5eda34b47e041 (diff)
downloadcpython-d513ddee94a05783b98f2b55f8fc0a4efbb9be82.zip
cpython-d513ddee94a05783b98f2b55f8fc0a4efbb9be82.tar.gz
cpython-d513ddee94a05783b98f2b55f8fc0a4efbb9be82.tar.bz2
Trim trailing whitespace and test on CI (#104275)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
-rw-r--r--.github/CODEOWNERS3
-rw-r--r--.github/workflows/lint.yml22
-rw-r--r--.pre-commit-config.yaml7
-rw-r--r--Modules/_blake2/blake2module.h2
-rw-r--r--Modules/_blake2/impl/blake2b-round.h4
-rw-r--r--Modules/_blake2/impl/blake2s-load-xop.h2
-rw-r--r--Modules/_blake2/impl/blake2s-round.h2
-rw-r--r--Modules/_ctypes/_ctypes_test.c2
-rw-r--r--Modules/_testcapi/immortal.c2
-rw-r--r--Modules/termios.c4
-rw-r--r--Parser/tokenizer.c2
-rw-r--r--Tools/msi/bundle/bootstrap/pch.h2
-rw-r--r--Tools/msi/bundle/bootstrap/resource.h2
13 files changed, 44 insertions, 12 deletions
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 3422ef8..d40519e 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -7,6 +7,9 @@
# GitHub
.github/** @ezio-melotti @hugovk
+# pre-commit
+.pre-commit-config.yaml @hugovk @AlexWaygood
+
# Build system
configure* @erlend-aasland @corona10
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 0000000..4481ea8
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,22 @@
+name: Lint
+
+on: [push, pull_request, workflow_dispatch]
+
+permissions:
+ contents: read
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
+ cancel-in-progress: true
+
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+
+ steps:
+ - uses: actions/checkout@v3
+ - uses: actions/setup-python@v4
+ with:
+ python-version: "3.x"
+ - uses: pre-commit/action@v3.0.0
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..808622f
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,7 @@
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.4.0
+ hooks:
+ - id: check-yaml
+ - id: trailing-whitespace
+ types_or: [c, python, rst]
diff --git a/Modules/_blake2/blake2module.h b/Modules/_blake2/blake2module.h
index aa8f281..c8144ec 100644
--- a/Modules/_blake2/blake2module.h
+++ b/Modules/_blake2/blake2module.h
@@ -38,6 +38,6 @@
#endif // HAVE_LIBB2
// for secure_zero_memory(), store32(), store48(), and store64()
-#include "impl/blake2-impl.h"
+#include "impl/blake2-impl.h"
#endif // Py_BLAKE2MODULE_H
diff --git a/Modules/_blake2/impl/blake2b-round.h b/Modules/_blake2/impl/blake2b-round.h
index cebc225..5b452c4 100644
--- a/Modules/_blake2/impl/blake2b-round.h
+++ b/Modules/_blake2/impl/blake2b-round.h
@@ -62,7 +62,7 @@
\
row2l = _mm_roti_epi64(row2l, -24); \
row2h = _mm_roti_epi64(row2h, -24); \
-
+
#define G2(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h,b0,b1) \
row1l = _mm_add_epi64(_mm_add_epi64(row1l, b0), row2l); \
row1h = _mm_add_epi64(_mm_add_epi64(row1h, b1), row2h); \
@@ -81,7 +81,7 @@
\
row2l = _mm_roti_epi64(row2l, -63); \
row2h = _mm_roti_epi64(row2h, -63); \
-
+
#if defined(HAVE_SSSE3)
#define DIAGONALIZE(row1l,row2l,row3l,row4l,row1h,row2h,row3h,row4h) \
t0 = _mm_alignr_epi8(row2h, row2l, 8); \
diff --git a/Modules/_blake2/impl/blake2s-load-xop.h b/Modules/_blake2/impl/blake2s-load-xop.h
index ac591a7..14d9e7f 100644
--- a/Modules/_blake2/impl/blake2s-load-xop.h
+++ b/Modules/_blake2/impl/blake2s-load-xop.h
@@ -166,7 +166,7 @@ buf = _mm_perm_epi8(t1, m3, _mm_set_epi32(TOB(3),TOB(2),TOB(1),TOB(7)) );
#define LOAD_MSG_8_3(buf) \
t0 = _mm_perm_epi8(m0, m2, _mm_set_epi32(TOB(6),TOB(1),TOB(0),TOB(0)) ); \
buf = _mm_perm_epi8(t0, m3, _mm_set_epi32(TOB(3),TOB(2),TOB(5),TOB(4)) ); \
-
+
#define LOAD_MSG_8_4(buf) \
buf = _mm_perm_epi8(m0, m1, _mm_set_epi32(TOB(5),TOB(4),TOB(7),TOB(2)) );
diff --git a/Modules/_blake2/impl/blake2s-round.h b/Modules/_blake2/impl/blake2s-round.h
index 1e2f2b7..3af4be3 100644
--- a/Modules/_blake2/impl/blake2s-round.h
+++ b/Modules/_blake2/impl/blake2s-round.h
@@ -86,6 +86,6 @@
LOAD_MSG_ ##r ##_4(buf4); \
G2(row1,row2,row3,row4,buf4); \
UNDIAGONALIZE(row1,row2,row3,row4); \
-
+
#endif
diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c
index ce652b3..ddfb2c8 100644
--- a/Modules/_ctypes/_ctypes_test.c
+++ b/Modules/_ctypes/_ctypes_test.c
@@ -1036,7 +1036,7 @@ EXPORT (HRESULT) KeepObject(IUnknown *punk)
#ifdef MS_WIN32
-// i38748: c stub for testing stack corruption
+// i38748: c stub for testing stack corruption
// When executing a Python callback with a long and a long long
typedef long(__stdcall *_test_i38748_funcType)(long, long long);
diff --git a/Modules/_testcapi/immortal.c b/Modules/_testcapi/immortal.c
index 10e1733..9f81389 100644
--- a/Modules/_testcapi/immortal.c
+++ b/Modules/_testcapi/immortal.c
@@ -1,6 +1,6 @@
#include "parts.h"
-int verify_immortality(PyObject *object)
+int verify_immortality(PyObject *object)
{
assert(_Py_IsImmortal(object));
Py_ssize_t old_count = Py_REFCNT(object);
diff --git a/Modules/termios.c b/Modules/termios.c
index 169a36f..6dc8200 100644
--- a/Modules/termios.c
+++ b/Modules/termios.c
@@ -85,7 +85,7 @@ termios_tcgetattr_impl(PyObject *module, int fd)
int r;
Py_BEGIN_ALLOW_THREADS
- r = tcgetattr(fd, &mode);
+ r = tcgetattr(fd, &mode);
Py_END_ALLOW_THREADS
if (r == -1) {
return PyErr_SetFromErrno(state->TermiosError);
@@ -372,7 +372,7 @@ termios_tcgetwinsize_impl(PyObject *module, int fd)
#if defined(TIOCGWINSZ)
termiosmodulestate *state = PyModule_GetState(module);
struct winsize w;
- int r;
+ int r;
Py_BEGIN_ALLOW_THREADS
r = ioctl(fd, TIOCGWINSZ, &w);
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 52d0d9a..91ffaba 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -48,7 +48,7 @@ static inline tokenizer_mode* TOK_GET_MODE(struct tok_state* tok) {
}
static inline tokenizer_mode* TOK_NEXT_MODE(struct tok_state* tok) {
assert(tok->tok_mode_stack_index >= 0);
- assert(tok->tok_mode_stack_index + 1 < MAXFSTRINGLEVEL);
+ assert(tok->tok_mode_stack_index + 1 < MAXFSTRINGLEVEL);
return &(tok->tok_mode_stack[++tok->tok_mode_stack_index]);
}
#else
diff --git a/Tools/msi/bundle/bootstrap/pch.h b/Tools/msi/bundle/bootstrap/pch.h
index b0aa511..6d0974b 100644
--- a/Tools/msi/bundle/bootstrap/pch.h
+++ b/Tools/msi/bundle/bootstrap/pch.h
@@ -5,7 +5,7 @@
// The license and further copyright text can be found in the file
// LICENSE.TXT at the root directory of the distribution.
// </copyright>
-//
+//
// <summary>
// Precompiled header for standard bootstrapper application.
// </summary>
diff --git a/Tools/msi/bundle/bootstrap/resource.h b/Tools/msi/bundle/bootstrap/resource.h
index 53c03c3..d951e65 100644
--- a/Tools/msi/bundle/bootstrap/resource.h
+++ b/Tools/msi/bundle/bootstrap/resource.h
@@ -14,7 +14,7 @@
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102