Skip to content

Commit

Permalink
style: add prettier (#874)
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii authored Aug 29, 2023
1 parent 674ba4b commit c8359e5
Show file tree
Hide file tree
Showing 16 changed files with 720 additions and 730 deletions.
63 changes: 31 additions & 32 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
Language: Cpp
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
Expand All @@ -20,17 +20,17 @@ AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
# SplitEmptyFunctionBody: true
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Attach
Expand All @@ -40,34 +40,34 @@ BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 88
CommentPragmas: '^ IWYU pragma:'
ColumnLimit: 88
CommentPragmas: "^ IWYU pragma:"
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
DisableFormat: false
# ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
ForEachMacros: [foreach, Q_FOREACH, BOOST_FOREACH]
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '$'
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|isl|json)/)'
Priority: 3
- Regex: ".*"
Priority: 1
IncludeIsMainRegex: "$"
IndentCaseLabels: false
IndentWidth: 4
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
Expand All @@ -81,20 +81,19 @@ PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Never
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
...
Standard: Cpp11
TabWidth: 4
UseTab: Never
18 changes: 9 additions & 9 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FormatStyle: file

Checks: '
modernize-*,
-modernize-use-trailing-return-type,
-modernize-avoid-c-arrays,
llvm-namespace-comment,
readability-container-size-empty,
google-readability-casting,
'
Checks: "
modernize-*,
-modernize-use-trailing-return-type,
-modernize-avoid-c-arrays,
llvm-namespace-comment,
readability-container-size-empty,
google-readability-casting,
"

HeaderFilterRegex: 'bh_python/.*hpp'
HeaderFilterRegex: "bh_python/.*hpp"
8 changes: 4 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ git submodule update --init --depth 10

## Setting up a development environment


### Nox

The fastest way to start with development is to use nox. If you don't have nox,
Expand Down Expand Up @@ -75,6 +74,7 @@ deactivate

Now, you can run notebooks using your system JupyterLab, and it will list
the environment as available!

</details>

To rebuild, rerun `pip install -ve .` from the environment, if the commit has
Expand All @@ -91,7 +91,7 @@ help installing the latest CMake version, [visit this
page](https://cliutils.gitlab.io/modern-cmake/chapters/intro/installing.html);
one option is to use pip to install CMake.

> Note: Since setuptools uses a subdirectory called `build`, it is *slightly*
> Note: Since setuptools uses a subdirectory called `build`, it is _slightly_
> better to avoid making your CMake directory `build` as well. Also, you will
> often have multiple CMake directories (`build-release`, `build-debug`, etc.),
> so avoiding the descriptive name `build` is not a bad idea.
Expand All @@ -102,7 +102,7 @@ You have three options for running code in python:
pytest`, and not others, like `pytest`
2. Add the build directory to your PYTHONPATH environment variable
3. Set `CMAKE_INSTALL_PREFIX` to your site-packages and install (recommended
for virtual environments).
for virtual environments).

Here is the recommendation for a CMake install:

Expand Down Expand Up @@ -199,7 +199,7 @@ pre-commit autoupdate
> Pre-commit uses docker to ensure a consistent run of clang-format. If you do
> not want to install/run Docker, you should use `SKIP=docker-clang-format`
> when running pre-commit, and instead run `clang-format -style=file -i
> <files>` yourself.
<files>` yourself.
## Clang-Tidy

Expand Down
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Add 'needs changelog` label to any change to code files as long as the `CHANGELOG` hasn't changed
needs changelog:
- all: ['!docs/CHANGELOG.md']
- all: ["!docs/CHANGELOG.md"]
78 changes: 39 additions & 39 deletions .github/workflows/emscripten.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on:
workflow_dispatch:
pull_request:
branches:
- master
- develop
- master
- develop
release:
types:
- published
- published

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -19,48 +19,48 @@ jobs:
name: Pyodide wheel
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install pyodide-build
run: pip install pyodide-build==0.23.4
- name: Install pyodide-build
run: pip install pyodide-build==0.23.4

- name: Compute emsdk version
id: compute-emsdk-version
run: |
# Prepare xbuild environment (side-effect)
pyodide config list
# Save EMSDK version
EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version)
echo "emsdk-version=$EMSCRIPTEN_VERSION" >> $GITHUB_OUTPUT
- name: Compute emsdk version
id: compute-emsdk-version
run: |
# Prepare xbuild environment (side-effect)
pyodide config list
# Save EMSDK version
EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version)
echo "emsdk-version=$EMSCRIPTEN_VERSION" >> $GITHUB_OUTPUT
- uses: mymindstorm/setup-emsdk@v12
with:
version: ${{ steps.compute-emsdk-version.outputs.emsdk-version }}
actions-cache-folder: emsdk-cache
- uses: mymindstorm/setup-emsdk@v12
with:
version: ${{ steps.compute-emsdk-version.outputs.emsdk-version }}
actions-cache-folder: emsdk-cache

- name: Build
run: CFLAGS=-fexceptions LDFLAGS=-fexceptions pyodide build
- name: Build
run: CFLAGS=-fexceptions LDFLAGS=-fexceptions pyodide build

- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Set up Pyodide virtual environment
run: |
pyodide venv .venv-pyodide
.venv-pyodide/bin/pip install $(echo -n dist/*.whl)[test]
- name: Set up Pyodide virtual environment
run: |
pyodide venv .venv-pyodide
.venv-pyodide/bin/pip install $(echo -n dist/*.whl)[test]
- name: Test
run: .venv-pyodide/bin/pytest
- name: Test
run: .venv-pyodide/bin/pytest

- name: Upload wheels
uses: actions/upload-artifact@v3
with:
path: dist/*.whl
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
path: dist/*.whl
40 changes: 20 additions & 20 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@ on:
workflow_dispatch:
pull_request:
paths:
- 'examples/*.py'
- 'notebooks/*.ipynb'
- "examples/*.py"
- "notebooks/*.ipynb"
push:
branches:
- master
- master

jobs:
examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Pre-install NumPy
run: python -m pip install -r dev-requirements.txt nbconvert ipykernel
- name: Install kernel
run: python -m ipykernel install --user --name boost-hist
- name: Build
run: python -m pip install .[examples]
- name: Examples
run: for f in examples/*.py; do python "$f"; done
- name: Notebooks
run: jupyter nbconvert --execute --ExecutePreprocessor.timeout=90 --inplace notebooks/*.ipynb
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Pre-install NumPy
run: python -m pip install -r dev-requirements.txt nbconvert ipykernel
- name: Install kernel
run: python -m ipykernel install --user --name boost-hist
- name: Build
run: python -m pip install .[examples]
- name: Examples
run: for f in examples/*.py; do python "$f"; done
- name: Notebooks
run: jupyter nbconvert --execute --ExecutePreprocessor.timeout=90 --inplace notebooks/*.ipynb
10 changes: 5 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: "Pull Request Labeler"
on:
- pull_request_target
- pull_request_target

jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@main
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
sync-labels: true
- uses: actions/labeler@main
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
sync-labels: true
Loading

0 comments on commit c8359e5

Please sign in to comment.