Skip to content

Commit

Permalink
Configure linters for C++, MD and Shell
Browse files Browse the repository at this point in the history
  • Loading branch information
neatudarius committed Jun 25, 2024
1 parent 3d2eb09 commit e6ae8a7
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"MD013": false
}
2 changes: 2 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# shellcheck
disable=SC2038
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SPDX-License-Identifier: 2.0 license with LLVM exceptions
This repository implements `std::optional` extensions targeting C++26. The `Beman.Optional26` library aims to evaluate the stability, the usability, and the performance of these proposed changes before they are officially adopted by WG21 into the C++ Working Draft. Additionally, it allows developers to use these new features before they are implemented in major standard library compilers.

**Implements**:

* [Give *std::optional* Range Support (P3168R1)](https://wg21.link/P3168R1)
* [`std::optional<T&>` (P2988R5)](https://wg21.link/P2988R5)

Expand All @@ -16,7 +17,6 @@ Source, documentation and associated papers are licensed with the Apache 2.0 lic

// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception


## Examples

Full runable examples can be found in `examples/` - please check [./examples/README.md](./examples/README.md).
Expand Down Expand Up @@ -91,11 +91,12 @@ This project is mainly tested on `Ubuntu 22.04` and `Ubuntu 24.04`, but it shoul

Build-time dependencies:

- `cmake`
- `ninja`, `make`, or another CMake-supported build system
- CMake defaults to "Unix Makefiles" on POSIX systems
* `cmake`
* `ninja`, `make`, or another CMake-supported build system
* CMake defaults to "Unix Makefiles" on POSIX systems

Example of installation on `Ubuntu 24.04`:

```shell
# Install tools:
apt-get install -y cmake make ninja-build
Expand All @@ -108,7 +109,7 @@ apt-get install \

### Instructions

Full set of supported toolchains can be found in [.github/workflows/ci.yml](#.github/workflows/ci.yml).
Full set of supported toolchains can be found in [.github/workflows/ci.yml](.github/workflows/ci.yml).

#### Basic Build

Expand Down Expand Up @@ -168,14 +169,15 @@ The makefile will use your system compiler, `c++`, if no toolchain name is provi
## Papers

Latest revision(s) of the papers can be built / found at:

* [give-std-optional-range-support](https://github.com/neatudarius/give-std-optional-range-support/) for `Give *std::optional* Range Support (P3168)`
* issue: [#1831](https://github.com/cplusplus/papers/issues/1831)
* issue: [#1831](https://github.com/cplusplus/papers/issues/1831)
* LEWG:
* Reviewed in Tokyo 2024.
* Forwarded by LEWG April electronic poll to LWG.
* LWG:
* To be reviewed in Saint Louis 2024.
* [./papers/P2988/README.md](./papers/P2988/README.md) for `std::optional<T&> (P2988)`.
* issue: [#1661](https://github.com/cplusplus/papers/issues/1661)
* LEWG:
* Reviewed in Tokyo 2024.
* issue: [#1661](https://github.com/cplusplus/papers/issues/1661)
* LEWG:
* Reviewed in Tokyo 2024.
3 changes: 2 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ List of usage examples for `Beman.Optional26`.
Check [sample](sample.cpp) for basic `Beman.Optional26` library usage.

Build and run instructions:

```shell
# build
$ cmake --workflow --preset gcc-14
Expand All @@ -29,10 +30,10 @@ std_vs_beman: .value() matches?: yes
## Range Support (P3168R1)

Range support added in [*Give std::optional Range Support* (P3168R1)](https://wg21.link/P3168R1) examples:

* [./range_loop.cpp](./range_loop.cpp)
* [./pythagorean_triples.cpp](./pythagorean_triples.cpp)


Build and run instructions:

```shell
Expand Down
26 changes: 26 additions & 0 deletions scripts/lint-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# Lint all files in the project.
# Expected to be run from the root of the project.
# Expected tools to be installed on the system.
# Usage: ./scripts/lint-all.sh

set -e
set -x

# Lint all C++ files in the project.
find include/ examples/ src/ -name "*.h" -o -name "*.cpp" | xargs clang-format -i -style=file || echo "clang-format failed."
echo "All C++ files were linted."

# Lint all scripts in the project.
find scripts/ -name "*.sh" | xargs shellcheck || echo "shellcheck failed."
echo "All scripts files were linted."

# TODO: Lint all CMake files in the project.
# echo "All CMake files were linted."

# Lint all Markdown files in the project.
find README.md examples/ -name "*.md" | xargs markdownlint -f || echo "markdownlint failed."
echo "All Markdown files were linted."
2 changes: 1 addition & 1 deletion scripts/test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
set -e
set -x

# rm -rf .build
rm -rf .build

cmake --workflow --preset gcc-14 &> /dev/null && echo "passed" || echo "gcc-14 test failed."
cmake --workflow --preset gcc-13 &> /dev/null && echo "passed" || echo "gcc-13 test failed."
Expand Down

0 comments on commit e6ae8a7

Please sign in to comment.