Skip to content

Commit 972bb36

Browse files
committed
Merge branch 'release/0.1.0'
2 parents 6d774a4 + ffcbb22 commit 972bb36

Some content is hidden

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

41 files changed

+4107
-31
lines changed

.credo.exs

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
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 exec using `mix credo -C <name>`. If no exec 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: ["lib/", "test/"],
25+
excluded: [~r"/_build/", ~r"/deps/"]
26+
},
27+
#
28+
# If you create your own checks, you must specify the source files for
29+
# them here, so they can be loaded by Credo before running the analysis.
30+
#
31+
requires: [],
32+
#
33+
# If you want to enforce a style guide and need a more traditional linting
34+
# experience, you can change `strict` to `true` below:
35+
#
36+
strict: true,
37+
#
38+
# If you want to use uncolored output by default, you can change `color`
39+
# to `false` below:
40+
#
41+
color: true,
42+
#
43+
# You can customize the parameters of any check by adding a second element
44+
# to the tuple.
45+
#
46+
# To disable a check put `false` as second element:
47+
#
48+
# {Credo.Check.Design.DuplicatedCode, false}
49+
#
50+
checks: [
51+
#
52+
## Consistency Checks
53+
#
54+
{Credo.Check.Consistency.ExceptionNames},
55+
{Credo.Check.Consistency.LineEndings},
56+
{Credo.Check.Consistency.ParameterPatternMatching},
57+
{Credo.Check.Consistency.SpaceAroundOperators},
58+
{Credo.Check.Consistency.SpaceInParentheses},
59+
{Credo.Check.Consistency.TabsOrSpaces},
60+
61+
#
62+
## Design Checks
63+
#
64+
# You can customize the priority of any check
65+
# Priority values are: `low, normal, high, higher`
66+
#
67+
{Credo.Check.Design.AliasUsage, priority: :low},
68+
# For some checks, you can also set other parameters
69+
#
70+
# If you don't want the `setup` and `test` macro calls in ExUnit tests
71+
# or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just
72+
# set the `excluded_macros` parameter to `[:schema, :setup, :test]`.
73+
#
74+
{Credo.Check.Design.DuplicatedCode, excluded_macros: []},
75+
76+
# You can also customize the exit_status of each check.
77+
# If you don't want TODO comments to cause `mix credo` to fail, just
78+
# set this value to 0 (zero).
79+
#
80+
{Credo.Check.Design.TagTODO, exit_status: 0},
81+
{Credo.Check.Design.TagFIXME},
82+
83+
#
84+
## Readability Checks
85+
#
86+
{Credo.Check.Readability.FunctionNames},
87+
{Credo.Check.Readability.LargeNumbers},
88+
{Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 80},
89+
{Credo.Check.Readability.ModuleAttributeNames},
90+
{Credo.Check.Readability.ModuleDoc},
91+
{Credo.Check.Readability.ModuleNames},
92+
{Credo.Check.Readability.ParenthesesOnZeroArityDefs},
93+
{Credo.Check.Readability.ParenthesesInCondition},
94+
{Credo.Check.Readability.PredicateFunctionNames},
95+
{Credo.Check.Readability.PreferImplicitTry},
96+
{Credo.Check.Readability.RedundantBlankLines},
97+
{Credo.Check.Readability.StringSigils},
98+
{Credo.Check.Readability.TrailingBlankLine},
99+
{Credo.Check.Readability.TrailingWhiteSpace},
100+
{Credo.Check.Readability.VariableNames},
101+
{Credo.Check.Readability.Semicolons},
102+
{Credo.Check.Readability.SpaceAfterCommas},
103+
104+
#
105+
## Refactoring Opportunities
106+
#
107+
{Credo.Check.Refactor.DoubleBooleanNegation, false},
108+
{Credo.Check.Refactor.CondStatements},
109+
{Credo.Check.Refactor.CyclomaticComplexity},
110+
{Credo.Check.Refactor.FunctionArity},
111+
{Credo.Check.Refactor.LongQuoteBlocks},
112+
{Credo.Check.Refactor.MatchInCondition},
113+
{Credo.Check.Refactor.NegatedConditionsInUnless},
114+
{Credo.Check.Refactor.NegatedConditionsWithElse},
115+
{Credo.Check.Refactor.Nesting},
116+
{Credo.Check.Refactor.PipeChainStart},
117+
{Credo.Check.Refactor.UnlessWithElse},
118+
119+
#
120+
## Warnings
121+
#
122+
{Credo.Check.Warning.BoolOperationOnSameValues},
123+
{Credo.Check.Warning.ExpensiveEmptyEnumCheck},
124+
{Credo.Check.Warning.IExPry},
125+
{Credo.Check.Warning.IoInspect},
126+
{Credo.Check.Warning.LazyLogging},
127+
{Credo.Check.Warning.OperationOnSameValues},
128+
{Credo.Check.Warning.OperationWithConstantResult},
129+
{Credo.Check.Warning.UnusedEnumOperation},
130+
{Credo.Check.Warning.UnusedFileOperation},
131+
{Credo.Check.Warning.UnusedKeywordOperation},
132+
{Credo.Check.Warning.UnusedListOperation},
133+
{Credo.Check.Warning.UnusedPathOperation},
134+
{Credo.Check.Warning.UnusedRegexOperation},
135+
{Credo.Check.Warning.UnusedStringOperation},
136+
{Credo.Check.Warning.UnusedTupleOperation},
137+
{Credo.Check.Warning.RaiseInsideRescue},
138+
139+
#
140+
# Controversial and experimental checks (opt-in, just remove `, false`)
141+
#
142+
{Credo.Check.Refactor.ABCSize, false},
143+
{Credo.Check.Refactor.AppendSingleItem, false},
144+
{Credo.Check.Refactor.VariableRebinding, false},
145+
{Credo.Check.Warning.MapGetUnsafePass, false},
146+
{Credo.Check.Consistency.MultiAliasImportRequireUse, false},
147+
148+
#
149+
# Deprecated checks (these will be deleted after a grace period)
150+
#
151+
{Credo.Check.Readability.Specs, false},
152+
{Credo.Check.Warning.NameRedeclarationByAssignment, false},
153+
{Credo.Check.Warning.NameRedeclarationByCase, false},
154+
{Credo.Check.Warning.NameRedeclarationByDef, false},
155+
{Credo.Check.Warning.NameRedeclarationByFn, false}
156+
157+
#
158+
# Custom checks can be created using `mix credo.gen.check`.
159+
#
160+
]
161+
}
162+
]
163+
}

.dialyzer_ignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
:0: Unknown function mnesia:change_table_copy_type/3
2+
:0: Unknown function mnesia:clear_table/1
3+
:0: Unknown function mnesia:create_table/2
4+
:0: Unknown function mnesia:delete_object/3
5+
:0: Unknown function mnesia:delete_table/1
6+
:0: Unknown function mnesia:index_match_object/4
7+
:0: Unknown function mnesia:read/2
8+
:0: Unknown function mnesia:select/2
9+
:0: Unknown function mnesia:start/0
10+
:0: Unknown function mnesia:table_info/2
11+
:0: Unknown function mnesia:transaction/1
12+
:0: Unknown function mnesia:write/3
13+
:0: Unknown function 'Elixir.Mix':env/0
14+
:0: Unknown function 'Elixir.Mix':shell/0
15+
lib/mix/tasks/expected.mnesia.setup.ex:1: Callback info about the 'Elixir.Mix.Task' behaviour is not available
16+
lib/mix/tasks/expected.mnesia.clear.ex:1: Callback info about the 'Elixir.Mix.Task' behaviour is not available
17+
lib/mix/tasks/expected.mnesia.drop.ex:1: Callback info about the 'Elixir.Mix.Task' behaviour is not available

.formatter.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[
2+
inputs: ["{mix,.formatter,.credo}.exs", "{config,lib,test}/**/*.{ex,exs}"],
3+
line_length: 80
4+
]

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# Elixir LS artifacts.
5+
/.elixir_ls/
6+
7+
# If you run "mix test --cover", coverage assets end up here.
8+
/cover/
9+
10+
# The directory Mix downloads your dependencies sources to.
11+
/deps/
12+
13+
# Where 3rd-party dependencies like ExDoc output generated docs.
14+
/doc/
15+
16+
# Ignore .fetch files in case you like to edit your project deps locally.
17+
/.fetch
18+
19+
# If the VM crashes, it generates a dump, let's ignore it too.
20+
erl_crash.dump
21+
22+
# Also ignore archive artifacts (built via "mix archive.build").
23+
*.ez
24+
25+
# Mnesia database
26+
/Mnesia.*

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
3+
## v0.1.0
4+
5+
* Login store specification
6+
* `:mnesia` login store with helpers to create, clear an drop the table
7+
* Plugs to register logins, authenticate and logout
8+
* API to manage logins
9+
* Old login cleaner

CONTRIBUTING.md

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,18 @@ The `master` branch is reserved to releases: the development process occurs on
2525

2626
### Development environment
2727

28-
1. Install:
28+
1. Install an Elixir environment.
2929

30-
* [asdf](https://github.com/asdf-vm/asdf)
31-
32-
33-
2. Install Erlang and Elixir plugins for asdf:
34-
35-
$ asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git
36-
$ asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
37-
38-
3. In the project repository, install the build toolchain:
30+
2. Fetch the project dependencies and build the project:
3931

4032
$ cd expected
41-
$ asdf install
42-
43-
4. Fetch the project dependencies and build the project:
44-
4533
$ mix do deps.get, compile
4634

47-
5. Launch the tests:
35+
3. Launch the tests:
4836

49-
$ mix test --stale
37+
$ mix test
5038

51-
All tests should pass.
39+
All the tests should pass.
5240

5341
## Workflow
5442

@@ -65,7 +53,8 @@ To make a change, please follow this workflow:
6553

6654
$ git checkout -b <my_branch>
6755

68-
3. Work on your feature (don’t forget to write some tests, TDD is good ;-)):
56+
3. Work on your feature (don’t forget to write tests; you can check your
57+
coverage with `mix coveralls.html` and open `cover/excoveralls.html`):
6958

7059
# Some work
7160
$ git commit -am "My first change"
@@ -97,3 +86,8 @@ To make a change, please follow this workflow:
9786

9887
7. If it’s all good, open a pull request to merge your branch into the `develop`
9988
branch on the main repository.
89+
90+
## Coding style
91+
92+
Please format your code with `mix format` or your editor and follow
93+
[this style guide](https://github.com/christopheradams/elixir_style_guide).

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Jean-Philippe Cugnet
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)