-
Notifications
You must be signed in to change notification settings - Fork 6
Enhancements #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Krapaince
wants to merge
13
commits into
master
Choose a base branch
from
enhancement
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Enhancements #9
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
4aad2ef
fix: clear Elixir's compiler v1.20 warnings
Krapaince 6cd1723
feat(format): make macro usable without parens
Krapaince 9ce9f10
feat: add when clause support for macros
Krapaince 248416f
test: add transition error handling tests
Krapaince c2fc0ce
ci: replace travis CI by github workflow
Krapaince bf2789c
refactor!: replace @doc by @{transition,bypass}_doc attribute
Krapaince 3b14d20
chore: bump exdoc from 0.38.4 to 0.40.3
Krapaince f6d5e87
fix: detect out states from transition with multiple function heads c…
Krapaince ba5a879
docs: improve existing doc, add types and enrich typespecs.
Krapaince f6d12cd
docs: improve README.md
Krapaince 2f792fc
feat: add sigil_FSM and its formatter plugin
Krapaince 80d49df
feat: add options with_{action_name_macros,action_names_guard}
Krapaince 908ef56
chore: bump exfsm version to 1.0.0
Krapaince File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,8 @@ | ||
| export_locals_without_parens = [defbypass: 2, deftrans: 2] | ||
|
|
||
| [ | ||
| inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] | ||
| plugins: [ExFSM.FormatterPlugin], | ||
| inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"], | ||
| locals_without_parens: export_locals_without_parens, | ||
| export: [locals_without_parens: export_locals_without_parens] | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| push: | ||
| branches: | ||
| - master | ||
|
|
||
| jobs: | ||
| mix-test: | ||
| runs-on: ubuntu-22.04 | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - elixir: "1.15" | ||
| otp: "25" | ||
| - elixir: "1.17" | ||
| otp: "27" | ||
| - elixir: "1.18" | ||
| otp: "27" | ||
| - elixir: "1.19" | ||
| otp: "28" | ||
| lint: lint | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| - uses: erlef/setup-beam@v1 | ||
| with: | ||
| otp-version: ${{matrix.otp}} | ||
| elixir-version: ${{matrix.elixir}} | ||
|
|
||
| - uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| deps | ||
| _build | ||
| key: deps-${{ runner.os }}-${{matrix.otp}}-${{matrix.elixir}}-${{ hashFiles('**/mix.lock') }} | ||
| restore-keys: deps-${{ runner.os }}-${{matrix.otp}}-${{matrix.elixir}} | ||
|
|
||
| - run: mix deps.get | ||
|
|
||
| - run: mix format --check-formatted | ||
| if: ${{ matrix.lint }} | ||
|
|
||
| - run: mix deps.unlock --check-unused | ||
| if: ${{ matrix.lint }} | ||
|
|
||
| - run: mix deps.compile | ||
|
|
||
| - run: mix compile --warnings-as-errors | ||
| if: ${{ matrix.lint }} | ||
|
|
||
| - run: mix test |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Changelog | ||
|
|
||
| All notable changes to this project will be documented in this file. | ||
|
|
||
| The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), | ||
| and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
|
||
| ## 1.0.0 - 2026/07/27 | ||
|
|
||
| ### Added | ||
|
|
||
| - Macros `deftrans` and `defbypass` are now usable without parenthesis when | ||
| importing the dependency in your `.formatter.exs` file. | ||
| - Macros `deftrans` and `defbypass` now supports `when` clause. | ||
| - Sigil `ExFSM.sigil_FSM/2` and its formatter plugin `ExFSM.FormatterPlugin`. | ||
| - `use ExFSM` now accepts the options `:with_action_name_macros` and | ||
| `:with_action_names_guard`. | ||
|
|
||
| ### Fixed | ||
|
|
||
| - Detect output states from transition with multiple function heads correctly | ||
| which fixes the returned output state of the `fsm/0` function. | ||
|
|
||
| ### Changed | ||
|
|
||
| - **BREAKING**: the reserved Elixir `@doc` attribute used to add documentation | ||
| transitions and bypasses was removed as it emitted warnings when used on | ||
| a transition or bypasss with several heads. Instead use the `@transition_doc` | ||
| for transition and the `@bypass_doc` for bypasses. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| defmodule ExFSM.Dummy.FSM.Instance do | ||
| @moduledoc false | ||
|
|
||
| @type t :: %__MODULE__{ | ||
| type: atom(), | ||
| state: atom() | ||
| } | ||
|
|
||
| @behaviour Access | ||
|
|
||
| defstruct type: nil, state: nil | ||
|
|
||
| @impl Access | ||
| defdelegate fetch(obj, key), to: Map | ||
|
|
||
| @impl Access | ||
| defdelegate get_and_update(data, key, function), to: Map | ||
|
|
||
| @impl Access | ||
| defdelegate pop(data, key), to: Map | ||
| end | ||
|
|
||
| defimpl ExFSM.Machine.State, for: ExFSM.Dummy.FSM.Instance do | ||
| def state_name(instance), do: instance.state | ||
| def set_state_name(instance, state_name), do: Map.put(instance, :state, state_name) | ||
| def handlers(_state), do: [ExFSM.Dummy.FSM] | ||
| end | ||
|
|
||
| defmodule ExFSM.Dummy.FSM do | ||
| @moduledoc false | ||
|
|
||
| use ExFSM | ||
|
|
||
| ~FSM""" | ||
| opened -- close -> closed | ||
| closed -- open -> opened | ||
| """ | ||
|
|
||
| deftrans opened({:close, _}, state), do: {:next_state, :closed, state} | ||
| deftrans closed({:open, _}, state), do: {:next_state, :opened, state} | ||
| end |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.