Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
style = "blue"
indent = 4
margin = 100
always_for_in = "nothing"
whitespace_typedefs = true
whitespace_ops_in_indices = true
remove_extra_newlines = false
import_to_using = false
pipe_to_function_call = false
short_to_long_function_def = false
always_use_return = false
whitespace_in_kwargs = false
annotate_untyped_fields_with_any = false
format_docstrings = false
align_struct_field = true
align_assignment = true
align_conditional = true
align_pair_arrow = true
conditional_to_if = false
normalize_line_endings = "auto"
align_matrix = false
join_lines_based_on_source = true
trailing_comma = true
indent_submodule = true
ignore = [".git"]
34 changes: 34 additions & 0 deletions .github/workflows/format-julia.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Format: Julia"
on:
push:
branches:
- main
paths:
- "**.jl"
- ".JuliaFormatter.toml"
- ".github/workflows/format-julia.yaml"
# Note: no path filtering when running on PRs, since the formatter
# is a required check, and therefore needs to always run.
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
- labeled

env:
CI: true

jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/julia-format@v4
with:
# Version compat for JuliaFormatter.jl (default: '1')
# E.g. set to '1.0.54' if you need to use JuliaFormatter.jl v1.0.54
version: '1'
# GitHub PR label that enabled formatting suggestions.
# Leave this unset or empty to show suggestions for all PRs.
suggestion-label: 'format-suggest'
52 changes: 29 additions & 23 deletions bin/structure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,28 @@ import InteractiveUtils, Markdown, TextWrap

# Rather than generating the file directly, we'll write the output to a buffer
# first, so that we wouldn't end up with a partial file if there is some error.
buffer = let buffer = IOBuffer(write=true)
write(buffer, """
# Internal State Machine
buffer = let buffer = IOBuffer(; write=true)
write(
buffer,
"""
# Internal State Machine

The authentication control flow is implemented as the following state machine, starting from the `NeedAuthentication`
state (or `NoAuthentication` if `force=true` is passed to `authenticate`), and finishing in either `Success` or `Failure`.
The authentication control flow is implemented as the following state machine, starting from the `NeedAuthentication`
state (or `NoAuthentication` if `force=true` is passed to `authenticate`), and finishing in either `Success` or `Failure`.

```mermaid
---
title: PkgAuthentication state machine diagram
---
```mermaid
---
title: PkgAuthentication state machine diagram
---

stateDiagram-v2
stateDiagram-v2

[*] --> NeedAuthentication
[*] --> NoAuthentication
""")
[*] --> NeedAuthentication
[*] --> NoAuthentication
""",
)

all_targets = Dict{String,Vector{String}}()
all_targets = Dict{String, Vector{String}}()
ignore_errors = (
PkgAuthentication.Failure, PkgAuthentication.Success
)
Expand All @@ -34,7 +37,7 @@ buffer = let buffer = IOBuffer(write=true)
end
end
choice_index = 0
for state in sort(InteractiveUtils.subtypes(PkgAuthentication.State), by=string)
for state in sort(InteractiveUtils.subtypes(PkgAuthentication.State); by=string)
println(buffer)
state_str = string(nameof(state))
# Generate the connecting arrows between the states
Expand Down Expand Up @@ -64,8 +67,8 @@ buffer = let buffer = IOBuffer(write=true)
docstr_text = docstr.meta[:results][1].text[1]
println(buffer, " note left of $(state_str)")
TextWrap.print_wrapped(
buffer, docstr_text, width=65,
initial_indent = 8, subsequent_indent = 8,
buffer, docstr_text; width=65,
initial_indent=8, subsequent_indent=8,
)
println(buffer)
println(buffer, " end note")
Expand All @@ -76,13 +79,16 @@ buffer = let buffer = IOBuffer(write=true)
end
end

write(buffer, """
Success --> [*]
Failure --> [*]
```
write(
buffer,
"""
Success --> [*]
Failure --> [*]
```

> **Note** This file is automatically generated by the `bin/structure.jl` script.
""")
> **Note** This file is automatically generated by the `bin/structure.jl` script.
""",
)

take!(buffer)
end
Expand Down
Loading
Loading