Skip to content

Commit

Permalink
Merge branch 'release/0.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
ejpcmac committed Feb 8, 2019
2 parents d35ffbe + 2508ba3 commit 5b3b692
Show file tree
Hide file tree
Showing 12 changed files with 257 additions and 102 deletions.
131 changes: 68 additions & 63 deletions .credo.exs
Original file line number Diff line number Diff line change
Expand Up @@ -51,107 +51,112 @@
#
## Consistency Checks
#
{Credo.Check.Consistency.ExceptionNames},
{Credo.Check.Consistency.LineEndings},
{Credo.Check.Consistency.ParameterPatternMatching},
{Credo.Check.Consistency.SpaceAroundOperators},
{Credo.Check.Consistency.SpaceInParentheses},
{Credo.Check.Consistency.TabsOrSpaces},
{Credo.Check.Consistency.ExceptionNames, []},
{Credo.Check.Consistency.LineEndings, []},
{Credo.Check.Consistency.ParameterPatternMatching, []},
{Credo.Check.Consistency.SpaceAroundOperators, []},
{Credo.Check.Consistency.SpaceInParentheses, []},
{Credo.Check.Consistency.TabsOrSpaces, []},

#
## Design Checks
#
# You can customize the priority of any check
# Priority values are: `low, normal, high, higher`
#
{Credo.Check.Design.AliasUsage, priority: :low},
{Credo.Check.Design.AliasUsage,
[
priority: :low,
if_nested_deeper_than: 2,
if_called_more_often_than: 0
]},
# For some checks, you can also set other parameters
#
# If you don't want the `setup` and `test` macro calls in ExUnit tests
# or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just
# set the `excluded_macros` parameter to `[:schema, :setup, :test]`.
#
{Credo.Check.Design.DuplicatedCode, excluded_macros: []},
{Credo.Check.Design.DuplicatedCode, [excluded_macros: []]},
# You can also customize the exit_status of each check.
# If you don't want TODO comments to cause `mix credo` to fail, just
# set this value to 0 (zero).
#
{Credo.Check.Design.TagTODO, exit_status: 0},
{Credo.Check.Design.TagFIXME},
{Credo.Check.Design.TagTODO, [exit_status: 0]},
{Credo.Check.Design.TagFIXME, []},

#
## Readability Checks
#
{Credo.Check.Readability.AliasOrder},
{Credo.Check.Readability.FunctionNames},
{Credo.Check.Readability.LargeNumbers},
{Credo.Check.Readability.MaxLineLength, priority: :low, max_length: 80},
{Credo.Check.Readability.ModuleAttributeNames},
{Credo.Check.Readability.ModuleDoc},
{Credo.Check.Readability.ModuleNames},
{Credo.Check.Readability.ParenthesesOnZeroArityDefs},
{Credo.Check.Readability.ParenthesesInCondition},
{Credo.Check.Readability.PredicateFunctionNames},
{Credo.Check.Readability.PreferImplicitTry},
{Credo.Check.Readability.RedundantBlankLines},
{Credo.Check.Readability.StringSigils},
{Credo.Check.Readability.TrailingBlankLine},
{Credo.Check.Readability.TrailingWhiteSpace},
{Credo.Check.Readability.VariableNames},
{Credo.Check.Readability.Semicolons},
{Credo.Check.Readability.SpaceAfterCommas},
{Credo.Check.Readability.AliasOrder, []},
{Credo.Check.Readability.FunctionNames, []},
{Credo.Check.Readability.LargeNumbers, []},
{Credo.Check.Readability.MaxLineLength,
[priority: :low, max_length: 80]},
{Credo.Check.Readability.ModuleAttributeNames, []},
{Credo.Check.Readability.ModuleDoc, []},
{Credo.Check.Readability.ModuleNames, []},
{Credo.Check.Readability.ParenthesesInCondition, []},
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
{Credo.Check.Readability.PredicateFunctionNames, []},
{Credo.Check.Readability.PreferImplicitTry, []},
{Credo.Check.Readability.RedundantBlankLines, []},
{Credo.Check.Readability.Semicolons, []},
{Credo.Check.Readability.SpaceAfterCommas, []},
{Credo.Check.Readability.StringSigils, []},
{Credo.Check.Readability.TrailingBlankLine, []},
{Credo.Check.Readability.TrailingWhiteSpace, []},
{Credo.Check.Readability.VariableNames, []},

#
## Refactoring Opportunities
#
{Credo.Check.Refactor.DoubleBooleanNegation, false},
{Credo.Check.Refactor.CondStatements},
{Credo.Check.Refactor.CyclomaticComplexity},
{Credo.Check.Refactor.FunctionArity},
{Credo.Check.Refactor.LongQuoteBlocks},
{Credo.Check.Refactor.MapInto},
{Credo.Check.Refactor.MatchInCondition},
{Credo.Check.Refactor.NegatedConditionsInUnless},
{Credo.Check.Refactor.NegatedConditionsWithElse},
{Credo.Check.Refactor.Nesting},
{Credo.Check.Refactor.CondStatements, []},
{Credo.Check.Refactor.CyclomaticComplexity, []},
{Credo.Check.Refactor.FunctionArity, []},
{Credo.Check.Refactor.LongQuoteBlocks, []},
{Credo.Check.Refactor.MapInto, []},
{Credo.Check.Refactor.MatchInCondition, []},
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
{Credo.Check.Refactor.Nesting, []},
{Credo.Check.Refactor.PipeChainStart,
excluded_argument_types: [:atom, :binary, :fn, :keyword],
excluded_functions: []},
{Credo.Check.Refactor.UnlessWithElse},
[
excluded_argument_types: [:atom, :binary, :fn, :keyword],
excluded_functions: []
]},
{Credo.Check.Refactor.UnlessWithElse, []},

#
## Warnings
#
{Credo.Check.Warning.BoolOperationOnSameValues},
{Credo.Check.Warning.ExpensiveEmptyEnumCheck},
{Credo.Check.Warning.IExPry},
{Credo.Check.Warning.IoInspect},
{Credo.Check.Warning.LazyLogging},
{Credo.Check.Warning.OperationOnSameValues},
{Credo.Check.Warning.OperationWithConstantResult},
{Credo.Check.Warning.UnusedEnumOperation},
{Credo.Check.Warning.UnusedFileOperation},
{Credo.Check.Warning.UnusedKeywordOperation},
{Credo.Check.Warning.UnusedListOperation},
{Credo.Check.Warning.UnusedPathOperation},
{Credo.Check.Warning.UnusedRegexOperation},
{Credo.Check.Warning.UnusedStringOperation},
{Credo.Check.Warning.UnusedTupleOperation},
{Credo.Check.Warning.RaiseInsideRescue},
{Credo.Check.Warning.BoolOperationOnSameValues, []},
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
{Credo.Check.Warning.IExPry, []},
{Credo.Check.Warning.IoInspect, []},
{Credo.Check.Warning.LazyLogging, []},
{Credo.Check.Warning.OperationOnSameValues, []},
{Credo.Check.Warning.OperationWithConstantResult, []},
{Credo.Check.Warning.RaiseInsideRescue, []},
{Credo.Check.Warning.UnusedEnumOperation, []},
{Credo.Check.Warning.UnusedFileOperation, []},
{Credo.Check.Warning.UnusedKeywordOperation, []},
{Credo.Check.Warning.UnusedListOperation, []},
{Credo.Check.Warning.UnusedPathOperation, []},
{Credo.Check.Warning.UnusedRegexOperation, []},
{Credo.Check.Warning.UnusedStringOperation, []},
{Credo.Check.Warning.UnusedTupleOperation, []},

#
# Controversial and experimental checks (opt-in, just remove `, false`)
#
{Credo.Check.Consistency.MultiAliasImportRequireUse, false},
{Credo.Check.Readability.Specs, false},
{Credo.Check.Refactor.ABCSize, false},
{Credo.Check.Refactor.AppendSingleItem, false},
{Credo.Check.Refactor.DoubleBooleanNegation, false},
{Credo.Check.Refactor.VariableRebinding, false},
{Credo.Check.Warning.MapGetUnsafePass, false},
{Credo.Check.Consistency.MultiAliasImportRequireUse, false},

#
# Deprecated checks (these will be deleted after a grace period)
#
{Credo.Check.Readability.Specs, false}
{Credo.Check.Warning.UnsafeToAtom, false}

#
# Custom checks can be created using `mix credo.gen.check`.
Expand Down
32 changes: 32 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
language: elixir
elixir:
- 1.5
- 1.6
- 1.7
- 1.8
otp_release:
- 19.3
- 20.3
- 21.2
matrix:
exclude:
- elixir: 1.5
otp_release: 21.2
- elixir: 1.8
otp_release: 19.3
env:
- PLT_DIR=$HOME/.plt
before_script:
- mkdir -p $PLT_DIR
- mix deps.compile
- MIX_ENV=test mix deps.compile
- travis_wait mix dialyzer --plt
script:
- mix compile --force --verbose --warnings-as-errors
- mix test --trace
- mix dialyzer --no-compile --no-check --halt-exit-status
- mix credo
- if [[ "$TRAVIS_ELIXIR_VERSION" == "1.8.1" ]]; then mix format --check-formatted; fi
cache:
directories:
- $PLT_DIR
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## v0.1.2

### New features

* Allow to disable the usage of `stderr`

### Bug fixes

* Accept charlists as input

## v0.1.1

### New features
Expand Down
74 changes: 61 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# Contributing to Marcus

This project uses [git-flow](https://github.com/petervanderdoes/gitflow-avh).
The `master` branch is reserved to releases: the development process occurs on
`develop` and feature branches. **Please never commit to master.**
Marcus is written in [Elixir](https://elixir-lang.org).

For branching management, this project uses
[git-flow](https://github.com/petervanderdoes/gitflow-avh). The `master` branch
is reserved for releases: the development process occurs on `develop` and
feature branches. **Please never commit to master.**

You can easily set up a development environment featuring all the dependencies,
including Elixir and `git-flow`, by using [Nix](https://nixos.org/nix/). This is
detailed below.

## Setup

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

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

4. Setup `git-flow`:
4. Checkout to `develop`:

$ git checkout develop

### Development environment (without Nix)

Install an Elixir environment, and optionally install `git-flow`.

### Development environment (with Nix)

1. Install Nix by running the script and following the instructions:

$ curl https://nixos.org/nix/install | sh

2. Optionally install [direnv](https://github.com/direnv/direnv) to
automatically setup the environment when you enter the project directory:

$ nix-env -i direnv

In this case, you also need to add to your `~/.<shell>rc`:

```sh
eval "$(direnv hook <shell>)"
```

*Make sure to replace `<shell>` by your shell, namely `bash`, `zsh`, …*

3. In the project directory, if you **did not** install direnv, start a Nix
shell:

$ cd marcus
$ nix-shell

If you opted to use direnv, please allow the `.envrc` instead of running a
Nix shell manually:

$ cd marcus
$ direnv allow

In this case, direnv will automatically update your environment to behave
like a Nix shell whenever you enter the project directory.

$ ./.gitsetup
### Git-flow

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

### Development environment
$ ./.gitsetup

1. Install an Elixir environment.
### Building the project

2. Fetch the project dependencies and build the project:
1. Fetch the project dependencies and build the project:

$ cd marcus
$ mix do deps.get, compile

3. Launch the tests:
2. Launch the tests:

$ mix test

All the tests should pass.

## Workflow

To make a change, please follow this workflow:
To make a change, please use this workflow:

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

2. Create a new branch with an explicit name:
2. For a tiny patch, create a new branch with an explicit name:

$ git checkout -b <my_branch>

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

All contributed code must be documented and functions must have typespecs. In
general, take your inspiration in the existing code.
general, take your inspiration from the existing code.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Jean-Philippe Cugnet
Copyright (c) 2018-2019 Jean-Philippe Cugnet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Marcus

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

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

```elixir
{:marcus, "~> 0.1.1"}
{:marcus, "~> 0.1.2"}
```

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

## License

Copyright © 2018 Jean-Philippe Cugnet
Copyright © 2018-2019 Jean-Philippe Cugnet

This project is licensed under the [MIT license](LICENSE).
6 changes: 4 additions & 2 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ use Mix.Config
# values for your application for 3rd-party users, it should be done in your
# "mix.exs" file.

if Mix.env() == :dev do
if Mix.env() == :test do
# Clear the console before each test run
config :mix_test_watch, clear: true
end

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

0 comments on commit 5b3b692

Please sign in to comment.