Skip to content

Commit 5b3b692

Browse files
committed
Merge branch 'release/0.1.2'
2 parents d35ffbe + 2508ba3 commit 5b3b692

File tree

12 files changed

+257
-102
lines changed

12 files changed

+257
-102
lines changed

.credo.exs

Lines changed: 68 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -51,107 +51,112 @@
5151
#
5252
## Consistency Checks
5353
#
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},
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, []},
6060

6161
#
6262
## Design Checks
6363
#
6464
# You can customize the priority of any check
6565
# Priority values are: `low, normal, high, higher`
6666
#
67-
{Credo.Check.Design.AliasUsage, priority: :low},
67+
{Credo.Check.Design.AliasUsage,
68+
[
69+
priority: :low,
70+
if_nested_deeper_than: 2,
71+
if_called_more_often_than: 0
72+
]},
6873
# For some checks, you can also set other parameters
6974
#
7075
# If you don't want the `setup` and `test` macro calls in ExUnit tests
7176
# or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just
7277
# set the `excluded_macros` parameter to `[:schema, :setup, :test]`.
7378
#
74-
{Credo.Check.Design.DuplicatedCode, excluded_macros: []},
79+
{Credo.Check.Design.DuplicatedCode, [excluded_macros: []]},
7580
# You can also customize the exit_status of each check.
7681
# If you don't want TODO comments to cause `mix credo` to fail, just
7782
# set this value to 0 (zero).
7883
#
79-
{Credo.Check.Design.TagTODO, exit_status: 0},
80-
{Credo.Check.Design.TagFIXME},
84+
{Credo.Check.Design.TagTODO, [exit_status: 0]},
85+
{Credo.Check.Design.TagFIXME, []},
8186

8287
#
8388
## Readability Checks
8489
#
85-
{Credo.Check.Readability.AliasOrder},
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},
90+
{Credo.Check.Readability.AliasOrder, []},
91+
{Credo.Check.Readability.FunctionNames, []},
92+
{Credo.Check.Readability.LargeNumbers, []},
93+
{Credo.Check.Readability.MaxLineLength,
94+
[priority: :low, max_length: 80]},
95+
{Credo.Check.Readability.ModuleAttributeNames, []},
96+
{Credo.Check.Readability.ModuleDoc, []},
97+
{Credo.Check.Readability.ModuleNames, []},
98+
{Credo.Check.Readability.ParenthesesInCondition, []},
99+
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
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.VariableNames, []},
103109

104110
#
105111
## Refactoring Opportunities
106112
#
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.MapInto},
113-
{Credo.Check.Refactor.MatchInCondition},
114-
{Credo.Check.Refactor.NegatedConditionsInUnless},
115-
{Credo.Check.Refactor.NegatedConditionsWithElse},
116-
{Credo.Check.Refactor.Nesting},
113+
{Credo.Check.Refactor.CondStatements, []},
114+
{Credo.Check.Refactor.CyclomaticComplexity, []},
115+
{Credo.Check.Refactor.FunctionArity, []},
116+
{Credo.Check.Refactor.LongQuoteBlocks, []},
117+
{Credo.Check.Refactor.MapInto, []},
118+
{Credo.Check.Refactor.MatchInCondition, []},
119+
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
120+
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
121+
{Credo.Check.Refactor.Nesting, []},
117122
{Credo.Check.Refactor.PipeChainStart,
118-
excluded_argument_types: [:atom, :binary, :fn, :keyword],
119-
excluded_functions: []},
120-
{Credo.Check.Refactor.UnlessWithElse},
123+
[
124+
excluded_argument_types: [:atom, :binary, :fn, :keyword],
125+
excluded_functions: []
126+
]},
127+
{Credo.Check.Refactor.UnlessWithElse, []},
121128

122129
#
123130
## Warnings
124131
#
125-
{Credo.Check.Warning.BoolOperationOnSameValues},
126-
{Credo.Check.Warning.ExpensiveEmptyEnumCheck},
127-
{Credo.Check.Warning.IExPry},
128-
{Credo.Check.Warning.IoInspect},
129-
{Credo.Check.Warning.LazyLogging},
130-
{Credo.Check.Warning.OperationOnSameValues},
131-
{Credo.Check.Warning.OperationWithConstantResult},
132-
{Credo.Check.Warning.UnusedEnumOperation},
133-
{Credo.Check.Warning.UnusedFileOperation},
134-
{Credo.Check.Warning.UnusedKeywordOperation},
135-
{Credo.Check.Warning.UnusedListOperation},
136-
{Credo.Check.Warning.UnusedPathOperation},
137-
{Credo.Check.Warning.UnusedRegexOperation},
138-
{Credo.Check.Warning.UnusedStringOperation},
139-
{Credo.Check.Warning.UnusedTupleOperation},
140-
{Credo.Check.Warning.RaiseInsideRescue},
132+
{Credo.Check.Warning.BoolOperationOnSameValues, []},
133+
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
134+
{Credo.Check.Warning.IExPry, []},
135+
{Credo.Check.Warning.IoInspect, []},
136+
{Credo.Check.Warning.LazyLogging, []},
137+
{Credo.Check.Warning.OperationOnSameValues, []},
138+
{Credo.Check.Warning.OperationWithConstantResult, []},
139+
{Credo.Check.Warning.RaiseInsideRescue, []},
140+
{Credo.Check.Warning.UnusedEnumOperation, []},
141+
{Credo.Check.Warning.UnusedFileOperation, []},
142+
{Credo.Check.Warning.UnusedKeywordOperation, []},
143+
{Credo.Check.Warning.UnusedListOperation, []},
144+
{Credo.Check.Warning.UnusedPathOperation, []},
145+
{Credo.Check.Warning.UnusedRegexOperation, []},
146+
{Credo.Check.Warning.UnusedStringOperation, []},
147+
{Credo.Check.Warning.UnusedTupleOperation, []},
141148

142149
#
143150
# Controversial and experimental checks (opt-in, just remove `, false`)
144151
#
152+
{Credo.Check.Consistency.MultiAliasImportRequireUse, false},
153+
{Credo.Check.Readability.Specs, false},
145154
{Credo.Check.Refactor.ABCSize, false},
146155
{Credo.Check.Refactor.AppendSingleItem, false},
156+
{Credo.Check.Refactor.DoubleBooleanNegation, false},
147157
{Credo.Check.Refactor.VariableRebinding, false},
148158
{Credo.Check.Warning.MapGetUnsafePass, false},
149-
{Credo.Check.Consistency.MultiAliasImportRequireUse, false},
150-
151-
#
152-
# Deprecated checks (these will be deleted after a grace period)
153-
#
154-
{Credo.Check.Readability.Specs, false}
159+
{Credo.Check.Warning.UnsafeToAtom, false}
155160

156161
#
157162
# Custom checks can be created using `mix credo.gen.check`.

.travis.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
language: elixir
2+
elixir:
3+
- 1.5
4+
- 1.6
5+
- 1.7
6+
- 1.8
7+
otp_release:
8+
- 19.3
9+
- 20.3
10+
- 21.2
11+
matrix:
12+
exclude:
13+
- elixir: 1.5
14+
otp_release: 21.2
15+
- elixir: 1.8
16+
otp_release: 19.3
17+
env:
18+
- PLT_DIR=$HOME/.plt
19+
before_script:
20+
- mkdir -p $PLT_DIR
21+
- mix deps.compile
22+
- MIX_ENV=test mix deps.compile
23+
- travis_wait mix dialyzer --plt
24+
script:
25+
- mix compile --force --verbose --warnings-as-errors
26+
- mix test --trace
27+
- mix dialyzer --no-compile --no-check --halt-exit-status
28+
- mix credo
29+
- if [[ "$TRAVIS_ELIXIR_VERSION" == "1.8.1" ]]; then mix format --check-formatted; fi
30+
cache:
31+
directories:
32+
- $PLT_DIR

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## v0.1.2
4+
5+
### New features
6+
7+
* Allow to disable the usage of `stderr`
8+
9+
### Bug fixes
10+
11+
* Accept charlists as input
12+
313
## v0.1.1
414

515
### New features

CONTRIBUTING.md

Lines changed: 61 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
# Contributing to Marcus
22

3-
This project uses [git-flow](https://github.com/petervanderdoes/gitflow-avh).
4-
The `master` branch is reserved to releases: the development process occurs on
5-
`develop` and feature branches. **Please never commit to master.**
3+
Marcus is written in [Elixir](https://elixir-lang.org).
4+
5+
For branching management, this project uses
6+
[git-flow](https://github.com/petervanderdoes/gitflow-avh). The `master` branch
7+
is reserved for releases: the development process occurs on `develop` and
8+
feature branches. **Please never commit to master.**
9+
10+
You can easily set up a development environment featuring all the dependencies,
11+
including Elixir and `git-flow`, by using [Nix](https://nixos.org/nix/). This is
12+
detailed below.
613

714
## Setup
815

@@ -19,30 +26,71 @@ The `master` branch is reserved to releases: the development process occurs on
1926

2027
$ git remote add upstream https://github.com/ejpcmac/marcus.git
2128

22-
4. Setup `git-flow`:
29+
4. Checkout to `develop`:
30+
31+
$ git checkout develop
32+
33+
### Development environment (without Nix)
34+
35+
Install an Elixir environment, and optionally install `git-flow`.
36+
37+
### Development environment (with Nix)
38+
39+
1. Install Nix by running the script and following the instructions:
40+
41+
$ curl https://nixos.org/nix/install | sh
42+
43+
2. Optionally install [direnv](https://github.com/direnv/direnv) to
44+
automatically setup the environment when you enter the project directory:
45+
46+
$ nix-env -i direnv
47+
48+
In this case, you also need to add to your `~/.<shell>rc`:
49+
50+
```sh
51+
eval "$(direnv hook <shell>)"
52+
```
53+
54+
*Make sure to replace `<shell>` by your shell, namely `bash`, `zsh`, …*
55+
56+
3. In the project directory, if you **did not** install direnv, start a Nix
57+
shell:
58+
59+
$ cd marcus
60+
$ nix-shell
61+
62+
If you opted to use direnv, please allow the `.envrc` instead of running a
63+
Nix shell manually:
64+
65+
$ cd marcus
66+
$ direnv allow
67+
68+
In this case, direnv will automatically update your environment to behave
69+
like a Nix shell whenever you enter the project directory.
2370

24-
$ ./.gitsetup
71+
### Git-flow
2572

26-
You should now be on `develop`.
73+
If you want to use `git-flow` and use the standard project configuration, please
74+
run:
2775

28-
### Development environment
76+
$ ./.gitsetup
2977

30-
1. Install an Elixir environment.
78+
### Building the project
3179

32-
2. Fetch the project dependencies and build the project:
80+
1. Fetch the project dependencies and build the project:
3381

3482
$ cd marcus
3583
$ mix do deps.get, compile
3684

37-
3. Launch the tests:
85+
2. Launch the tests:
3886

3987
$ mix test
4088

4189
All the tests should pass.
4290

4391
## Workflow
4492

45-
To make a change, please follow this workflow:
93+
To make a change, please use this workflow:
4694

4795
1. Checkout to `develop` and apply the last upstream changes (use rebase, not
4896
merge!):
@@ -51,7 +99,7 @@ To make a change, please follow this workflow:
5199
$ git fetch --all --prune
52100
$ git rebase upstream/develop
53101

54-
2. Create a new branch with an explicit name:
102+
2. For a tiny patch, create a new branch with an explicit name:
55103

56104
$ git checkout -b <my_branch>
57105

@@ -109,4 +157,4 @@ Please format your code with `mix format` or your editor and follow
109157
[this style guide](https://github.com/christopheradams/elixir_style_guide).
110158

111159
All contributed code must be documented and functions must have typespecs. In
112-
general, take your inspiration in the existing code.
160+
general, take your inspiration from the existing code.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2018 Jean-Philippe Cugnet
3+
Copyright (c) 2018-2019 Jean-Philippe Cugnet
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Marcus
22

3+
[![Build Status](https://travis-ci.com/ejpcmac/marcus.svg?branch=develop)](https://travis-ci.com/ejpcmac/marcus)
34
[![hex.pm version](http://img.shields.io/hexpm/v/marcus.svg?style=flat)](https://hex.pm/packages/marcus)
45

56
Marcus is a library for writing interactive CLIs in Elixir.
@@ -55,7 +56,7 @@ choose("Make a choice:", item1: "Item 1", item2: "Item 2")
5556
To use Marcus in your project, add this to your Mix dependencies:
5657

5758
```elixir
58-
{:marcus, "~> 0.1.1"}
59+
{:marcus, "~> 0.1.2"}
5960
```
6061

6162
## [Contributing](CONTRIBUTING.md)
@@ -65,6 +66,6 @@ Before contributing to this project, please read the
6566

6667
## License
6768

68-
Copyright © 2018 Jean-Philippe Cugnet
69+
Copyright © 2018-2019 Jean-Philippe Cugnet
6970

7071
This project is licensed under the [MIT license](LICENSE).

config/config.exs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ use Mix.Config
66
# values for your application for 3rd-party users, it should be done in your
77
# "mix.exs" file.
88

9-
if Mix.env() == :dev do
9+
if Mix.env() == :test do
1010
# Clear the console before each test run
1111
config :mix_test_watch, clear: true
1212
end
1313

1414
# # Import environment specific config. This must remain at the bottom of this
1515
# # file so it overrides the configuration defined above.
16-
# import_config "#{Mix.env()}.exs"
16+
# unless Mix.env() == :docs do
17+
# import_config "#{Mix.env()}.exs"
18+
# end

0 commit comments

Comments
 (0)