Skip to content

Commit aa2548c

Browse files
pre-submit formater
1 parent e74c5af commit aa2548c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1627
-1120
lines changed

.clang-format

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
# Based on LLVM style with modifications for your codebase
3+
BasedOnStyle: LLVM
4+
5+
# Basic formatting
6+
IndentWidth: 4
7+
TabWidth: 4
8+
UseTab: Never
9+
ColumnLimit: 120
10+
11+
# Brace wrapping
12+
BreakBeforeBraces: Attach
13+
Cpp11BracedListStyle: true
14+
15+
# Indentation
16+
IndentCaseLabels: true
17+
IndentPPDirectives: BeforeHash
18+
AccessModifierOffset: -2
19+
20+
# Alignment
21+
AlignConsecutiveAssignments: false
22+
AlignConsecutiveDeclarations: false
23+
AlignOperands: true
24+
AlignTrailingComments: true
25+
26+
# Spacing
27+
SpaceAfterCStyleCast: false
28+
SpaceAfterTemplateKeyword: true
29+
SpaceBeforeAssignmentOperators: true
30+
SpaceBeforeCpp11BracedList: false
31+
SpaceBeforeParens: ControlStatements
32+
SpaceInEmptyParentheses: false
33+
SpacesInAngles: false
34+
SpacesInCStyleCastParentheses: false
35+
SpacesInParentheses: false
36+
SpacesInSquareBrackets: false
37+
38+
# Line breaks
39+
AllowShortBlocksOnASingleLine: Empty
40+
AllowShortCaseLabelsOnASingleLine: false
41+
AllowShortFunctionsOnASingleLine: Inline
42+
AllowShortIfStatementsOnASingleLine: Never
43+
AllowShortLoopsOnASingleLine: false
44+
45+
# Includes
46+
SortIncludes: true
47+
IncludeBlocks: Regroup
48+
IncludeCategories:
49+
- Regex: '^<.*\.h>'
50+
Priority: 1
51+
- Regex: '^<.*>'
52+
Priority: 2
53+
- Regex: '.*'
54+
Priority: 3
55+
56+
# Pointers and references
57+
DerivePointerAlignment: false
58+
PointerAlignment: Left
59+
60+
# Comments (preserve your existing comment style)
61+
ReflowComments: false
62+
63+
# Constructor initializers
64+
BreakConstructorInitializers: BeforeColon
65+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
66+
ConstructorInitializerIndentWidth: 4
67+
68+
# Template arguments
69+
AlwaysBreakTemplateDeclarations: Yes
70+
71+
# Namespace
72+
NamespaceIndentation: All

.github/workflows/PyPI-build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
python -m pip install cibuildwheel
2828
python -m cibuildwheel --output-dir wheelhouse
2929
env:
30-
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-* cp313-*"
30+
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-* cp313-*"
3131
CIBW_SKIP: "*-win32* *_i686* *musllinux*"
3232
CIBW_ARCHS_WINDOWS: "AMD64 ARM64"
3333
CIBW_ARCHS_MACOS: "x86_64 arm64"
@@ -47,7 +47,7 @@ jobs:
4747
needs: build_wheels
4848
runs-on: ubuntu-latest
4949
if: startsWith(github.ref, 'refs/tags/v')
50-
50+
5151
steps:
5252
- uses: actions/checkout@v4
5353

@@ -76,4 +76,4 @@ jobs:
7676
with:
7777
package_dir: dist
7878
user: __token__
79-
password: ${{ secrets.PYPI_API_TOKEN }}
79+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/docs.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@ on:
1515
jobs:
1616
build_and_deploy:
1717
runs-on: ubuntu-latest
18-
18+
1919
steps:
2020
- name: Checkout repository
2121
uses: actions/checkout@v3
2222
with:
2323
fetch-depth: 0
24-
24+
2525
- name: Setup Python
2626
uses: actions/setup-python@v4
2727
with:
2828
python-version: '3.9'
29-
29+
3030
- name: Install Doxygen
3131
run: |
3232
sudo apt-get update
3333
sudo apt-get install -y doxygen graphviz
34-
34+
3535
- name: Install Python dependencies
3636
run: |
3737
python -m pip install --upgrade pip
@@ -42,64 +42,64 @@ jobs:
4242
cd docs
4343
chmod +x build_docs.sh
4444
./build_docs.sh
45-
45+
4646
- name: Deploy to GitHub Pages
4747
uses: peaceiris/actions-gh-pages@v3
4848
with:
4949
personal_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
5050
publish_dir: ./docs/build/html
5151
destination_dir: docs
52-
52+
5353
- name: Create Wiki Content
5454
run: |
5555
# Install pandoc for HTML to Markdown conversion
5656
sudo apt-get install -y pandoc
57-
57+
5858
# Create a directory for wiki content
5959
mkdir -p wiki_content
60-
60+
6161
# Copy Home.md with proper formatting
6262
cat > wiki_content/Home.md << 'EOL'
6363
# VegasAfterglow Documentation
64-
64+
6565
Welcome to the VegasAfterglow documentation wiki.
66-
66+
6767
## Documentation
68-
68+
6969
The complete documentation is published to GitHub Pages. Please visit:
70-
70+
7171
**[Full Documentation Site](https://yihanwangastro.github.io/VegasAfterglow/docs/)**
72-
72+
7373
## Quick Links
74-
74+
7575
* [C++ API Reference](https://yihanwangastro.github.io/VegasAfterglow/docs/cpp_api.html)
7676
* [Python API Reference](https://yihanwangastro.github.io/VegasAfterglow/docs/python_api.html)
7777
* [Installation Guide](https://yihanwangastro.github.io/VegasAfterglow/docs/installation.html)
7878
* [Quick Start Guide](https://yihanwangastro.github.io/VegasAfterglow/docs/quickstart.html)
7979
* [Examples](https://yihanwangastro.github.io/VegasAfterglow/docs/examples.html)
8080
* [Contributing Guide](https://yihanwangastro.github.io/VegasAfterglow/docs/contributing.html)
81-
81+
8282
## Building Documentation Locally
83-
83+
8484
To build the documentation locally, please refer to the [docs/README.md](https://github.com/YihanWangAstro/VegasAfterglow/blob/main/docs/README.md) file in the main repository.
8585
EOL
86-
86+
8787
# Create sidebar navigation
8888
cat > wiki_content/_Sidebar.md << 'EOL'
8989
## VegasAfterglow
90-
90+
9191
* [Home](Home)
9292
* [Documentation Site](https://yihanwangastro.github.io/VegasAfterglow/docs/)
9393
EOL
94-
94+
9595
# Create footer
9696
cat > wiki_content/_Footer.md << 'EOL'
9797
---
9898
Documentation generated automatically from the [VegasAfterglow repository](https://github.com/YihanWangAstro/VegasAfterglow).
9999
EOL
100-
100+
101101
- name: Push to Wiki
102102
uses: Andrew-Chen-Wang/github-wiki-action@v4
103103
with:
104104
path: wiki_content
105-
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
105+
token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**/*.txt
2+
**/*.csv
3+
**/*.dat
4+
**/*.out
5+
**/*.log
6+
**/*.err
7+
**/*.warn
8+
**/*.a
9+
**/*.so
10+
**/*.npy
11+
**/*.npz
12+
**/.DS_Store
13+
**/*.pyc
14+
15+
external/
16+
projects/
17+
build/
18+
.vscode/
19+
.idea/
20+
.DS_Store
21+
vegasglow.so.dSYM/
22+
!CMakeLists.txt
23+
24+
docs/build/
25+
docs/doxygen/

.pre-commit-config.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
repos:
2+
# Python formatting
3+
- repo: https://github.com/psf/black
4+
rev: 23.12.1
5+
hooks:
6+
- id: black
7+
language_version: python3
8+
files: ^VegasAfterglow/.*\.py$
9+
10+
# Python import sorting
11+
- repo: https://github.com/pycqa/isort
12+
rev: 5.13.2
13+
hooks:
14+
- id: isort
15+
args: ["--profile", "black"]
16+
files: ^VegasAfterglow/.*\.py$
17+
18+
# Python linting
19+
- repo: https://github.com/pycqa/flake8
20+
rev: 7.0.0
21+
hooks:
22+
- id: flake8
23+
args: ["--max-line-length=88", "--extend-ignore=E203,W503"]
24+
files: ^VegasAfterglow/.*\.py$
25+
26+
# C++ formatting
27+
- repo: https://github.com/pre-commit/mirrors-clang-format
28+
rev: v17.0.6
29+
hooks:
30+
- id: clang-format
31+
files: \.(cpp|hpp|c|h|cc|cxx)$
32+
exclude: ^external/.*
33+
34+
# General file cleanup
35+
- repo: https://github.com/pre-commit/pre-commit-hooks
36+
rev: v4.5.0
37+
hooks:
38+
- id: trailing-whitespace
39+
exclude: ^external/.*
40+
- id: end-of-file-fixer
41+
exclude: ^external/.*
42+
- id: check-yaml
43+
- id: check-toml
44+
- id: check-merge-conflict
45+
- id: check-added-large-files
46+
args: ['--maxkb=1000']
47+
48+
# Check for common issues
49+
- repo: https://github.com/pre-commit/pre-commit-hooks
50+
rev: v4.5.0
51+
hooks:
52+
- id: check-case-conflict
53+
- id: mixed-line-ending
54+
args: ['--fix=lf']
55+
exclude: ^external/.*

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5454
- **StepPowerLawJet**: New jet model with parameters `(theta_c, E_iso_c, Gamma0_c, E_iso_w, Gamma0_w, k_e, k_g)`
5555
- **Wind Medium**: Extended with optional `n_ism` and `n_0` parameters for stratified medium modeling: `Wind(A_star, n_ism=0, n_0=inf)`
5656
- **Medium Class**: Simplified from `Medium(rho, mass)` to `Medium(rho)` - removed separate mass parameter
57-
- **Model Methods**:
57+
- **Model Methods**:
5858
- Removed `specific_flux_sorted_series()` method
5959
- Added `specific_flux_series_with_expo(t, nu, expo_time, num_points=10)` for exposure time averaging
6060
- Changed `details(t_obs)` to `details(t_min, t_max)` interface
@@ -340,4 +340,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
340340
---
341341

342342
For detailed information about each release, see the individual version sections above.
343-
For the latest updates and development progress, visit our [GitHub repository](https://github.com/YihanWangAstro/VegasAfterglow).
343+
For the latest updates and development progress, visit our [GitHub repository](https://github.com/YihanWangAstro/VegasAfterglow).

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ if(NOT CMAKE_BUILD_TYPE)
4343
endif()
4444

4545
# Install the module into the Python package directory
46-
install(TARGETS VegasAfterglowC DESTINATION VegasAfterglow)
46+
install(TARGETS VegasAfterglowC DESTINATION VegasAfterglow)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2626
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2727
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2828
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ info:
5454
@echo "Platform: $(PLATFORM)"
5555
@echo "Compiler: $(CXX)"
5656
@echo "CXXFLAGS: $(CXXFLAGS)"
57-
@echo "LDFLAGS: $(LDFLAGS)"
57+
@echo "LDFLAGS: $(LDFLAGS)"

0 commit comments

Comments
 (0)