Skip to content

Commit 3ae8c94

Browse files
committed
propogate lint infrastructure
1 parent b6a2d24 commit 3ae8c94

File tree

5 files changed

+105
-27
lines changed

5 files changed

+105
-27
lines changed

.github/workflows/pre-commit.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Lint Check (pre-commit)
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
pre-commit:
9+
runs-on: ubuntu-latest
10+
name: pre-commit
11+
permissions:
12+
contents: read
13+
checks: write
14+
issues: write
15+
pull-requests: write
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: 3.13
25+
26+
- name: Get Changed Files
27+
id: changed-files
28+
uses: tj-actions/changed-files@v45
29+
30+
# See:
31+
# https://github.com/tj-actions/changed-files?tab=readme-ov-file#using-local-git-directory-
32+
- uses: pre-commit/[email protected]
33+
with:
34+
extra_args: --files ${{ steps.changed-files.outputs.all_changed_files }}
35+
continue-on-error: true
36+
37+
- name: suggester / pre-commit
38+
if: ${{ github.event_name == 'pull_request' }}
39+
uses: reviewdog/action-suggester@v1
40+
with:
41+
tool_name: pre-commit
42+
level: warning
43+
reviewdog_flags: "-fail-level=error"

.pre-commit-config.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v5.0.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
12+
# Clang-format for C++
13+
# This brings in a portable version of clang-format.
14+
# See also: https://github.com/ssciwr/clang-format-wheel
15+
- repo: https://github.com/pre-commit/mirrors-clang-format
16+
rev: v18.1.8
17+
hooks:
18+
- id: clang-format
19+
types_or: [c++, c]
20+
21+
# CMake linting and formatting
22+
- repo: https://github.com/BlankSpruce/gersemi
23+
rev: 0.15.1
24+
hooks:
25+
- id: gersemi
26+
name: CMake linting
27+
28+
# Markdown linting
29+
# Config file: .markdownlint.yaml
30+
- repo: https://github.com/igorshubovych/markdownlint-cli
31+
rev: v0.42.0
32+
hooks:
33+
- id: markdownlint

CMakeLists.txt

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,39 @@ cmake_minimum_required(VERSION 3.23)
88
option(BUILD_TESTING "Build tests" ON)
99

1010
project(
11-
beman.inplace_vector
12-
VERSION 1.0.0
13-
DESCRIPTION
14-
"A dynamically-resizable vector with fixed capacity and embedded storage"
15-
LANGUAGES CXX)
11+
beman.inplace_vector
12+
VERSION 1.0.0
13+
DESCRIPTION
14+
"A dynamically-resizable vector with fixed capacity and embedded storage"
15+
LANGUAGES CXX
16+
)
1617

1718
add_library(beman.inplace_vector INTERFACE)
1819
target_include_directories(
19-
beman.inplace_vector
20-
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
21-
$<INSTALL_INTERFACE:include>)
20+
beman.inplace_vector
21+
INTERFACE
22+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
23+
$<INSTALL_INTERFACE:include>
24+
)
2225

2326
# Install the InplaceVector library to the appropriate destination
2427
install(
25-
TARGETS beman.inplace_vector
26-
EXPORT ${TARGETS_EXPORT_NAME}
27-
DESTINATION ${CMAKE_INSTALL_LIBDIR})
28+
TARGETS beman.inplace_vector
29+
EXPORT ${TARGETS_EXPORT_NAME}
30+
DESTINATION
31+
${CMAKE_INSTALL_LIBDIR}
32+
)
2833

2934
# Install the header files to the appropriate destination
3035
install(
31-
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
32-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}
33-
FILES_MATCHING
34-
PATTERN
36+
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
37+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}
38+
FILES_MATCHING
39+
PATTERN
3540
"${CMAKE_CURRENT_SOURCE_DIR}/include/beman/inplace_vector/inplace_vector.hpp"
3641
)
3742

3843
if(BUILD_TESTING)
39-
include(CTest)
40-
add_subdirectory(src/beman/inplace_vector/tests)
44+
include(CTest)
45+
add_subdirectory(src/beman/inplace_vector/tests)
4146
endif()

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
# beman.inplace\_vector: A dynamically-resizable vector with fixed capacity and embedded storage
2-
31
<!--
42
SPDX-License-Identifier: <SPDX License Expression>
53
-->
4+
5+
# beman.inplace\_vector
6+
7+
A dynamically-resizable vector with fixed capacity and embedded storage

src/beman/inplace_vector/tests/CMakeLists.txt

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@
44
# cmake-format: on
55

66
# Tests
7-
add_executable(
8-
beman.inplace_vector.test inplace_vector.test.cpp)
7+
add_executable(beman.inplace_vector.test inplace_vector.test.cpp)
98

10-
target_link_libraries(beman.inplace_vector.test PRIVATE
11-
beman.inplace_vector)
9+
target_link_libraries(beman.inplace_vector.test PRIVATE beman.inplace_vector)
1210

13-
add_test(
14-
NAME beman.inplace_vector.test
15-
COMMAND beman.inplace_vector.test
16-
)
11+
add_test(NAME beman.inplace_vector.test COMMAND beman.inplace_vector.test)

0 commit comments

Comments
 (0)