Skip to content

Commit a91aef1

Browse files
authored
Merge pull request #985 from JuliaEditorSupport/py/links
Some tidying up
2 parents 7889c84 + 7daed4d commit a91aef1

23 files changed

Lines changed: 104 additions & 59 deletions

.github/workflows/PreCommit.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# This workflow runs pre-commit on the JuliaFormatter repo itself, i.e.,
2+
# checks that this repo is formatted.
13
name: Pre-Commit
24

35
# needed to allow julia-actions/cache to delete old caches that it has created
@@ -20,15 +22,20 @@ jobs:
2022

2123
steps:
2224
- uses: actions/checkout@v6
25+
26+
# Note: Pkg App support only in >= 1.12
2327
- uses: julia-actions/setup-julia@v3
28+
2429
- uses: julia-actions/cache@v3
2530

26-
- run: mkdir -p "${HOME}/.julia/environments/apps"
2731
- name: Install local JuliaFormatter as Pkg app
2832
run: julia --project -e 'using Pkg; Pkg.instantiate(); Pkg.Apps.develop(; path=pwd())'
2933

30-
- uses: astral-sh/setup-uv@v8.1.0
31-
- run: uv tool install pre-commit
32-
- run: |
34+
- uses: actions/setup-python@v6
35+
with:
36+
python-version: '3.x'
37+
38+
- name: Run pre-commit hooks
39+
run: |
3340
export PATH=$PATH:${HOME}/.julia/bin/
34-
pre-commit run --all-files --show-diff-on-failure --color always
41+
pipx run pre-commit run --all-files --show-diff-on-failure --color always
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This workflow tests that the pre-commit hook works as expected.
2+
name: PreCommitHooks
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
branches:
8+
- 'master'
9+
pull_request:
10+
branches:
11+
- 'master'
12+
13+
jobs:
14+
pre-commit:
15+
name: julia-formatter hook
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v6
20+
with:
21+
persist-credentials: false
22+
23+
- uses: julia-actions/setup-julia@v3
24+
with:
25+
version: '1'
26+
27+
- name: Install checked out JuliaFormatter in global env
28+
run: |
29+
julia -e 'using Pkg; Pkg.add(; path=".")'
30+
31+
- uses: actions/setup-python@v6
32+
with:
33+
python-version: '3.x'
34+
35+
- name: Test pre-commit hook
36+
working-directory: .github/workflows/pre-commit
37+
run: |
38+
# Run pre-commit hook, check that it fails.
39+
# pre-commit try-repo will fail if the hook makes changes
40+
pipx run pre-commit try-repo ../../../ julia-formatter --files main.jl --verbose && exit 1
41+
42+
# Check that the file was changed.
43+
git diff --exit-code main.jl && exit 1
44+
45+
# Check that running the hook again succeeds.
46+
pipx run pre-commit try-repo ../../../ julia-formatter --files main.jl --verbose
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function f(x )
2+
return x+1
3+
end

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ repos:
1010
always_run: false
1111
types: [file]
1212
files: \.(jl|[jq]?md)$
13-
exclude: '^test/'
13+
exclude: '^(test/|\.github/)'
1414
language: "system"
1515
- repo: meta
1616
hooks:
1717
- id: check-hooks-apply
18-
- id: check-useless-excludes
18+
- id: check-useless-excludes

.pre-commit-hooks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
- id: julia-formatter
22
name: "Julia Formatter"
3-
entry: "jlfmt --inplace"
3+
entry: "julia -e 'import JuliaFormatter: format; format(ARGS)'"
44
pass_filenames: true
55
always_run: false
66
types: [file]

HELP.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "JuliaFormatter"
22
uuid = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
3-
version = "3.0"
4-
authors = ["Dominique Luna <dluna132@gmail.com>"]
3+
version = "2.3.0"
4+
authors = ["Dominique Luna <dluna132@gmail.com> and contributors"]
55

66
[deps]
77
CommonMark = "a80b9123-70ca-4bc0-993e-6e3bcb318db6"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ julia> format_file("foo.jl")
3434
julia> format_text(str)
3535
```
3636

37-
Check out [the docs](https://domluna.github.io/JuliaFormatter.jl/stable/) for further description of the formatter and its options.
37+
Check out [the docs](https://juliaeditorsupport.github.io/JuliaFormatter.jl/stable/) for further description of the formatter and its options.
3838

3939
## Command Line Tool
4040

docs/make.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ makedocs(;
2121
warnonly = true,
2222
)
2323

24-
deploydocs(; repo = "github.com/domluna/JuliaFormatter.jl.git", push_preview = true)
24+
deploydocs(;
25+
repo = "github.com/JuliaEditorSupport/JuliaFormatter.jl.git",
26+
push_preview = true,
27+
)

docs/src/custom_alignment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Custom Alignment
22

3-
> Solution for [issue 179](https://github.com/domluna/JuliaFormatter.jl/issues/179)
3+
> Solution for [issue 179](https://github.com/JuliaEditorSupport/JuliaFormatter.jl/issues/179)
44
55
Custom alignment is determined by a whitespace heuristic:
66

0 commit comments

Comments
 (0)