Skip to content

Commit beec18a

Browse files
committed
first version
0 parents  commit beec18a

File tree

1,037 files changed

+15237
-0
lines changed

Some content is hidden

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

1,037 files changed

+15237
-0
lines changed

Diff for: .credo.exs

+209
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
# This file contains the configuration for Credo and you are probably reading
2+
# this after creating it with `mix credo.gen.config`.
3+
#
4+
# If you find anything wrong or unclear in this file, please report an
5+
# issue on GitHub: https://github.com/rrrene/credo/issues
6+
#
7+
%{
8+
#
9+
# You can have as many configs as you like in the `configs:` field.
10+
configs: [
11+
%{
12+
#
13+
# Run any config using `mix credo -C <name>`. If no config name is given
14+
# "default" is used.
15+
#
16+
name: "default",
17+
#
18+
# These are the files included in the analysis:
19+
files: %{
20+
#
21+
# You can give explicit globs or simply directories.
22+
# In the latter case `**/*.{ex,exs}` will be used.
23+
#
24+
included: [
25+
"lib/live_ui/**/*"
26+
],
27+
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/", ~r"lib/live_ui/assets"]
28+
},
29+
#
30+
# Load and configure plugins here:
31+
#
32+
plugins: [],
33+
#
34+
# If you create your own checks, you must specify the source files for
35+
# them here, so they can be loaded by Credo before running the analysis.
36+
#
37+
requires: [],
38+
#
39+
# If you want to enforce a style guide and need a more traditional linting
40+
# experience, you can change `strict` to `true` below:
41+
#
42+
strict: false,
43+
#
44+
# To modify the timeout for parsing files, change this value:
45+
#
46+
parse_timeout: 5000,
47+
#
48+
# If you want to use uncolored output by default, you can change `color`
49+
# to `false` below:
50+
#
51+
color: true,
52+
#
53+
# You can customize the parameters of any check by adding a second element
54+
# to the tuple.
55+
#
56+
# To disable a check put `false` as second element:
57+
#
58+
# {Credo.Check.Design.DuplicatedCode, false}
59+
#
60+
checks: %{
61+
enabled: [
62+
#
63+
## Consistency Checks
64+
#
65+
{Credo.Check.Consistency.ExceptionNames, []},
66+
{Credo.Check.Consistency.LineEndings, []},
67+
{Credo.Check.Consistency.ParameterPatternMatching, []},
68+
{Credo.Check.Consistency.SpaceAroundOperators, []},
69+
{Credo.Check.Consistency.SpaceInParentheses, []},
70+
{Credo.Check.Consistency.TabsOrSpaces, []},
71+
72+
#
73+
## Design Checks
74+
#
75+
# You can customize the priority of any check
76+
# Priority values are: `low, normal, high, higher`
77+
#
78+
{Credo.Check.Design.AliasUsage,
79+
[priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
80+
{Credo.Check.Design.TagFIXME, []},
81+
# You can also customize the exit_status of each check.
82+
# If you don't want TODO comments to cause `mix credo` to fail, just
83+
# set this value to 0 (zero).
84+
#
85+
{Credo.Check.Design.TagTODO, [exit_status: 2]},
86+
87+
#
88+
## Readability Checks
89+
#
90+
{Credo.Check.Readability.AliasOrder, []},
91+
{Credo.Check.Readability.FunctionNames, []},
92+
{Credo.Check.Readability.LargeNumbers, []},
93+
{Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
94+
{Credo.Check.Readability.ModuleAttributeNames, []},
95+
{Credo.Check.Readability.ModuleDoc, []},
96+
{Credo.Check.Readability.ModuleNames, []},
97+
{Credo.Check.Readability.ParenthesesInCondition, []},
98+
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
99+
{Credo.Check.Readability.PipeIntoAnonymousFunctions, []},
100+
{Credo.Check.Readability.PredicateFunctionNames, []},
101+
{Credo.Check.Readability.PreferImplicitTry, []},
102+
{Credo.Check.Readability.RedundantBlankLines, []},
103+
{Credo.Check.Readability.Semicolons, []},
104+
{Credo.Check.Readability.SpaceAfterCommas, []},
105+
{Credo.Check.Readability.StringSigils, []},
106+
{Credo.Check.Readability.TrailingBlankLine, []},
107+
{Credo.Check.Readability.TrailingWhiteSpace, []},
108+
{Credo.Check.Readability.UnnecessaryAliasExpansion, []},
109+
{Credo.Check.Readability.VariableNames, []},
110+
{Credo.Check.Readability.WithSingleClause, []},
111+
112+
#
113+
## Refactoring Opportunities
114+
#
115+
{Credo.Check.Refactor.Apply, []},
116+
{Credo.Check.Refactor.CondStatements, []},
117+
{Credo.Check.Refactor.CyclomaticComplexity, []},
118+
{Credo.Check.Refactor.FilterCount, []},
119+
{Credo.Check.Refactor.FilterFilter, []},
120+
{Credo.Check.Refactor.FunctionArity, []},
121+
{Credo.Check.Refactor.LongQuoteBlocks, []},
122+
{Credo.Check.Refactor.MapJoin, []},
123+
{Credo.Check.Refactor.MatchInCondition, []},
124+
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
125+
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
126+
{Credo.Check.Refactor.Nesting, []},
127+
{Credo.Check.Refactor.RedundantWithClauseResult, []},
128+
{Credo.Check.Refactor.RejectReject, []},
129+
{Credo.Check.Refactor.UnlessWithElse, []},
130+
{Credo.Check.Refactor.WithClauses, []},
131+
132+
#
133+
## Warnings
134+
#
135+
{Credo.Check.Warning.ApplicationConfigInModuleAttribute, []},
136+
{Credo.Check.Warning.BoolOperationOnSameValues, []},
137+
{Credo.Check.Warning.Dbg, []},
138+
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
139+
{Credo.Check.Warning.IExPry, []},
140+
{Credo.Check.Warning.IoInspect, []},
141+
{Credo.Check.Warning.MissedMetadataKeyInLoggerConfig, []},
142+
{Credo.Check.Warning.OperationOnSameValues, []},
143+
{Credo.Check.Warning.OperationWithConstantResult, []},
144+
{Credo.Check.Warning.RaiseInsideRescue, []},
145+
{Credo.Check.Warning.SpecWithStruct, []},
146+
{Credo.Check.Warning.UnsafeExec, []},
147+
{Credo.Check.Warning.UnusedEnumOperation, []},
148+
{Credo.Check.Warning.UnusedFileOperation, []},
149+
{Credo.Check.Warning.UnusedKeywordOperation, []},
150+
{Credo.Check.Warning.UnusedListOperation, []},
151+
{Credo.Check.Warning.UnusedPathOperation, []},
152+
{Credo.Check.Warning.UnusedRegexOperation, []},
153+
{Credo.Check.Warning.UnusedStringOperation, []},
154+
{Credo.Check.Warning.UnusedTupleOperation, []},
155+
{Credo.Check.Warning.WrongTestFileExtension, []}
156+
],
157+
disabled: [
158+
#
159+
# Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`)
160+
161+
#
162+
# Controversial and experimental checks (opt-in, just move the check to `:enabled`
163+
# and be sure to use `mix credo --strict` to see low priority checks)
164+
#
165+
{Credo.Check.Consistency.MultiAliasImportRequireUse, []},
166+
{Credo.Check.Consistency.UnusedVariableNames, []},
167+
{Credo.Check.Design.DuplicatedCode, []},
168+
{Credo.Check.Design.SkipTestWithoutComment, []},
169+
{Credo.Check.Readability.AliasAs, []},
170+
{Credo.Check.Readability.BlockPipe, []},
171+
{Credo.Check.Readability.ImplTrue, []},
172+
{Credo.Check.Readability.MultiAlias, []},
173+
{Credo.Check.Readability.NestedFunctionCalls, []},
174+
{Credo.Check.Readability.OneArityFunctionInPipe, []},
175+
{Credo.Check.Readability.OnePipePerLine, []},
176+
{Credo.Check.Readability.SeparateAliasRequire, []},
177+
{Credo.Check.Readability.SingleFunctionToBlockPipe, []},
178+
{Credo.Check.Readability.SinglePipe, []},
179+
{Credo.Check.Readability.Specs, []},
180+
{Credo.Check.Readability.StrictModuleLayout, []},
181+
{Credo.Check.Readability.WithCustomTaggedTuple, []},
182+
{Credo.Check.Refactor.ABCSize, []},
183+
{Credo.Check.Refactor.AppendSingleItem, []},
184+
{Credo.Check.Refactor.DoubleBooleanNegation, []},
185+
{Credo.Check.Refactor.FilterReject, []},
186+
{Credo.Check.Refactor.IoPuts, []},
187+
{Credo.Check.Refactor.MapMap, []},
188+
{Credo.Check.Refactor.ModuleDependencies, []},
189+
{Credo.Check.Refactor.NegatedIsNil, []},
190+
{Credo.Check.Refactor.PassAsyncInTestCases, []},
191+
{Credo.Check.Refactor.PipeChainStart, []},
192+
{Credo.Check.Refactor.RejectFilter, []},
193+
{Credo.Check.Refactor.VariableRebinding, []},
194+
{Credo.Check.Warning.LazyLogging, []},
195+
{Credo.Check.Warning.LeakyEnvironment, []},
196+
{Credo.Check.Warning.MapGetUnsafePass, []},
197+
{Credo.Check.Warning.MixEnv, []},
198+
{Credo.Check.Warning.UnsafeToAtom, []}
199+
200+
# {Credo.Check.Refactor.MapInto, []},
201+
202+
#
203+
# Custom checks can be created using `mix credo.gen.check`.
204+
#
205+
]
206+
}
207+
}
208+
]
209+
}

Diff for: .formatter.exs

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
import_deps: [:ecto, :ecto_sql, :phoenix],
3+
subdirectories: ["priv/*/migrations"],
4+
plugins: [Phoenix.LiveView.HTMLFormatter],
5+
inputs: ["*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}", "priv/*/seeds.exs"]
6+
]

Diff for: .gitignore

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover/
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps/
9+
10+
# Where 3rd-party dependencies like ExDoc output generated docs.
11+
/doc/
12+
13+
# Ignore .fetch files in case you like to edit your project deps locally.
14+
/.fetch
15+
16+
# If the VM crashes, it generates a dump, let's ignore it too.
17+
erl_crash.dump
18+
19+
# Also ignore archive artifacts (built via "mix archive.build").
20+
*.ez
21+
22+
# Temporary files, for example, from tests.
23+
/tmp/
24+
25+
# Ignore package tarball (built via "mix hex.build").
26+
live_ui-*.tar
27+
28+
# Ignore assets that are produced by build tools.
29+
/priv/static/assets/
30+
31+
# Ignore uploads.
32+
/priv/static/uploads/
33+
34+
# Ignore digested assets cache.
35+
/priv/static/cache_manifest.json
36+
37+
# In case you use Node.js/npm, you want to ignore these.
38+
npm-debug.log
39+
/assets/node_modules/
40+
41+
# other
42+
TODO.md

Diff for: .iex.exs

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import_if_available(Ecto.Query)
2+
import_if_available(Ecto.Changeset)
3+
4+
Application.put_env(:elixir, :ansi_enabled, true)
5+
6+
timestamp = fn ->
7+
{_date, {hour, minute, _second}} = :calendar.local_time()
8+
9+
[hour, minute]
10+
|> Enum.map(&String.pad_leading(Integer.to_string(&1), 2, "0"))
11+
|> Enum.join(":")
12+
end
13+
14+
IEx.configure(
15+
colors: [
16+
syntax_colors: [
17+
number: :light_yellow,
18+
atom: :light_cyan,
19+
string: :light_black,
20+
boolean: :red,
21+
nil: [:magenta, :bright]
22+
],
23+
ls_directory: :cyan,
24+
ls_device: :yellow,
25+
doc_code: :green,
26+
doc_inline_code: :magenta,
27+
doc_headings: [:cyan, :underline],
28+
doc_title: [:cyan, :bright, :underline]
29+
],
30+
default_prompt:
31+
"#{IO.ANSI.green()}%prefix#{IO.ANSI.reset()}" <>
32+
"[#{IO.ANSI.magenta()}#{timestamp.()}#{IO.ANSI.reset()}" <>
33+
"::#{IO.ANSI.cyan()}%counter#{IO.ANSI.reset()}]>",
34+
alive_prompt:
35+
"#{IO.ANSI.green()}%prefix#{IO.ANSI.reset()}" <>
36+
"(#{IO.ANSI.yellow()}%node#{IO.ANSI.reset()})" <>
37+
"[#{IO.ANSI.magenta()}#{timestamp.()}#{IO.ANSI.reset()}" <>
38+
"::#{IO.ANSI.cyan()}%counter#{IO.ANSI.reset()}]>",
39+
history_size: 50,
40+
inspect: [
41+
pretty: true,
42+
limit: :infinity,
43+
width: 80,
44+
custom_options: [sort_maps: true]
45+
],
46+
width: 80
47+
)
48+
49+
alias LiveUI.Admin.{Company, Contact, Department, Product, Session, User}
50+
alias LiveUI.Member.Contact
51+
alias LiveUI.Accounts.UserToken
52+
alias LiveUI.Repo
53+
54+
# records
55+
company = Repo.get(Company, 1)
56+
department = Repo.get(Department, 1)
57+
user = Repo.get(User, 1)
58+
product = Repo.get(Product, 1)
59+
60+
# protocol
61+
index_view = LiveUI.index_view(user)
62+
show_view = LiveUI.show_view(user)
63+
64+
# config
65+
config = LiveUI.Config.new(LiveUI.Admin.User, User)

Diff for: CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## 0.1.0 (2024-03-03)
4+
5+
First version

Diff for: LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# MIT License (MIT)
2+
3+
Copyright © 2024 Damir Roso
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)