Skip to content

Commit 1780ccc

Browse files
authored
nfc : add formatter check and apply initial format (#185)
1 parent a183b91 commit 1780ccc

File tree

10 files changed

+1052
-648
lines changed

10 files changed

+1052
-648
lines changed

.JuliaFormatter.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
always_for_in = true
2+
import_to_using = false
3+
align_pair_arrow = true
4+
align_assignment = true
5+
align_conditional = true
6+
always_use_return = false
7+
conditional_to_if = false
8+
whitespace_in_kwargs = true
9+
remove_extra_newlines = true
10+
whitespace_ops_in_indices = true
11+
long_to_short_function_def = true
12+
short_to_long_function_def = false
13+
annotate_untyped_fields_with_any = false

.github/workflows/format-check.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: format
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
- 'release-'
8+
tags: '*'
9+
pull_request:
10+
11+
jobs:
12+
check:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: julia-actions/setup-julia@latest
16+
with:
17+
version: '1'
18+
- uses: actions/checkout@v3
19+
- name: Install JuliaFormatter and format
20+
run: |
21+
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
22+
julia -e 'using JuliaFormatter; format(["src", "test"], verbose=true)'
23+
- name: Format check
24+
run: |
25+
julia -e '
26+
out = Cmd(`git diff --name-only`) |> read |> String
27+
if out == ""
28+
exit(0)
29+
else
30+
@error "Some files have not been formatted !!!"
31+
write(stdout, out)
32+
exit(1)
33+
end
34+
'

0 commit comments

Comments
 (0)