Skip to content

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
ejpcmac committed May 31, 2020
2 parents febf2e4 + 0d26601 commit d952918
Show file tree
Hide file tree
Showing 12 changed files with 524 additions and 80 deletions.
24 changes: 24 additions & 0 deletions .check.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Check if the version used by the runner is currently the last supported
# version, that is: the version used in the Nix shell on development machines.
last_supported_version? =
System.version()
|> Version.parse!()
|> Version.match?("~> 1.10.0")

[
skipped: false,
tools: [
{:compiler, "mix compile --force --verbose --warnings-as-errors"},
{:ex_unit, "mix test --trace"},

# Run the formatter and ex_doc only for the last supported version. This
# avoids errors in CI when the formatting changes or ex_doc is not
# compatible with an old Elixir version.
{:formatter, last_supported_version?},
{:ex_doc, last_supported_version?},

# Check for unused dependencies in the mix.lock.
{:unused_deps, "mix deps.unlock --check-unused",
enabled: last_supported_version?}
]
]
65 changes: 48 additions & 17 deletions .credo.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
configs: [
%{
#
# Run any exec using `mix credo -C <name>`. If no exec name is given
# Run any config using `mix credo -C <name>`. If no config name is given
# "default" is used.
#
name: "default",
Expand All @@ -21,10 +21,23 @@
# You can give explicit globs or simply directories.
# In the latter case `**/*.{ex,exs}` will be used.
#
included: ["lib/", "src/", "test/", "web/", "apps/"],
included: [
"lib/",
"src/",
"test/",
"web/",
"apps/*/lib/",
"apps/*/src/",
"apps/*/test/",
"apps/*/web/"
],
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
},
#
# Load and configure plugins here:
#
plugins: [],
#
# If you create your own checks, you must specify the source files for
# them here, so they can be loaded by Credo before running the analysis.
#
Expand All @@ -35,6 +48,10 @@
#
strict: true,
#
# To modify the timeout for parsing files, change this value:
#
parse_timeout: 5000,
#
# If you want to use uncolored output by default, you can change `color`
# to `false` below:
#
Expand Down Expand Up @@ -70,13 +87,6 @@
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: []]},
# 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).
Expand Down Expand Up @@ -105,6 +115,7 @@
{Credo.Check.Readability.StringSigils, []},
{Credo.Check.Readability.TrailingBlankLine, []},
{Credo.Check.Readability.TrailingWhiteSpace, []},
{Credo.Check.Readability.UnnecessaryAliasExpansion, []},
{Credo.Check.Readability.VariableNames, []},

#
Expand All @@ -114,16 +125,13 @@
{Credo.Check.Refactor.CyclomaticComplexity, []},
{Credo.Check.Refactor.FunctionArity, []},
{Credo.Check.Refactor.LongQuoteBlocks, []},
{Credo.Check.Refactor.MapInto, false},
{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, []},
{Credo.Check.Refactor.WithClauses, []},

#
## Warnings
Expand All @@ -132,6 +140,8 @@
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
{Credo.Check.Warning.IExPry, []},
{Credo.Check.Warning.IoInspect, []},
{Credo.Check.Warning.LazyLogging, false},
{Credo.Check.Warning.MixEnv, false},
{Credo.Check.Warning.OperationOnSameValues, []},
{Credo.Check.Warning.OperationWithConstantResult, []},
{Credo.Check.Warning.RaiseInsideRescue, []},
Expand All @@ -143,18 +153,39 @@
{Credo.Check.Warning.UnusedRegexOperation, []},
{Credo.Check.Warning.UnusedStringOperation, []},
{Credo.Check.Warning.UnusedTupleOperation, []},
{Credo.Check.Warning.UnsafeExec, []},

#
# Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`)

#
# Controversial and experimental checks (opt-in, just remove `, false`)
# Controversial and experimental checks (opt-in, just replace `false` with `[]`)
#
{Credo.Check.Readability.StrictModuleLayout, false},
{Credo.Check.Consistency.MultiAliasImportRequireUse, false},
{Credo.Check.Consistency.UnusedVariableNames, false},
# 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.Readability.AliasAs, false},
{Credo.Check.Readability.MultiAlias, false},
{Credo.Check.Readability.Specs, false},
{Credo.Check.Readability.SinglePipe, false},
{Credo.Check.Readability.WithCustomTaggedTuple, false},
{Credo.Check.Refactor.ABCSize, false},
{Credo.Check.Refactor.AppendSingleItem, false},
{Credo.Check.Refactor.DoubleBooleanNegation, false},
{Credo.Check.Refactor.MapInto, false},
{Credo.Check.Refactor.ModuleDependencies, false},
{Credo.Check.Refactor.NegatedIsNil, false},
{Credo.Check.Refactor.PipeChainStart,
[
excluded_argument_types: [:atom, :binary, :fn, :keyword],
excluded_functions: []
]},
{Credo.Check.Refactor.VariableRebinding, false},
{Credo.Check.Warning.LazyLogging, false},
{Credo.Check.Warning.LeakyEnvironment, false},
{Credo.Check.Warning.MapGetUnsafePass, false},
{Credo.Check.Warning.UnsafeToAtom, false}

Expand Down
3 changes: 2 additions & 1 deletion .formatter.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"{mix,.iex,.formatter,.credo}.exs",
"{config,lib,rel,test}/**/*.{ex,exs}"
],
line_length: 80
line_length: 80,
import_deps: [:typed_struct, :lens]
]
30 changes: 14 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
language: elixir
elixir:
- 1.6
- 1.7
- 1.8
otp_release:
- 19.3
- 20.3
- 21.2
matrix:
exclude:
include:
- elixir: 1.6
otp_release: 20.3
- elixir: 1.7
otp_release: 22.3
- elixir: 1.8
otp_release: 19.3
otp_release: 22.3
- elixir: 1.9
otp_release: 22.3
- elixir: 1.10
otp_release: 22.3
- elixir: 1.10
otp_release: 23.0
env:
- PLT_DIR=$HOME/.plt
before_script:
Expand All @@ -19,11 +21,7 @@ before_script:
- 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
- mix check
cache:
directories:
- $PLT_DIR
- $PLT_DIR
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 0.1.0-dev
All notable changes to this project will be documented in this file.

* Initial version
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic
Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.0] - 2020-05-31

### Added

* Generate lens functions for each field in the typed struct
* Optionally generate private lens functions
* Optionally prefix or postfix the generated function names

[0.1.0]: https://github.com/ejpcmac/typed_struct_lens/releases/tag/v0.1.0
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) 2019 Jean-Philippe Cugnet
Copyright (c) 2020 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
Loading

0 comments on commit d952918

Please sign in to comment.