-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from pepsico-ecommerce/mf/add-ci-pipeline
Add CI Pipeline and more static analysis
- Loading branch information
Showing
33 changed files
with
253 additions
and
2,600 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[ | ||
## all available options with default values (see `mix check` docs for description) | ||
parallel: true, | ||
skipped: false, | ||
retry: false, | ||
## list of tools (see `mix check` docs for a list of default curated tools) | ||
tools: [ | ||
{:credo, "mix credo -a"}, | ||
{:ex_unit, "mix coveralls"}, | ||
{:audit, "mix deps.audit"}, | ||
] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
%{ | ||
configs: [ | ||
%{ | ||
name: "default", | ||
files: %{ | ||
included: [ | ||
"lib/", | ||
"test/", | ||
], | ||
excluded: [~r"/_build/", ~r"/deps/"] | ||
}, | ||
plugins: [], | ||
requires: [], | ||
strict: true, | ||
parse_timeout: 5000, | ||
color: true, | ||
checks: %{ | ||
enabled: [ | ||
# | ||
## 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, []}, | ||
|
||
# | ||
## Design Checks | ||
# | ||
{Credo.Check.Design.AliasUsage, | ||
[priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]}, | ||
{Credo.Check.Design.TagTODO, [exit_status: 2]}, | ||
{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: 120]}, | ||
{Credo.Check.Readability.ModuleAttributeNames, []}, | ||
{Credo.Check.Readability.ModuleDoc, []}, | ||
{Credo.Check.Readability.ModuleNames, []}, | ||
{Credo.Check.Readability.ParenthesesInCondition, []}, | ||
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []}, | ||
{Credo.Check.Readability.PipeIntoAnonymousFunctions, []}, | ||
{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.UnnecessaryAliasExpansion, []}, | ||
{Credo.Check.Readability.VariableNames, []}, | ||
{Credo.Check.Readability.WithSingleClause, []}, | ||
|
||
# | ||
## Refactoring Opportunities | ||
# | ||
{Credo.Check.Refactor.Apply, []}, | ||
{Credo.Check.Refactor.CondStatements, []}, | ||
{Credo.Check.Refactor.CyclomaticComplexity, []}, | ||
{Credo.Check.Refactor.FunctionArity, []}, | ||
{Credo.Check.Refactor.LongQuoteBlocks, []}, | ||
{Credo.Check.Refactor.MatchInCondition, []}, | ||
{Credo.Check.Refactor.MapJoin, []}, | ||
{Credo.Check.Refactor.NegatedConditionsInUnless, []}, | ||
{Credo.Check.Refactor.NegatedConditionsWithElse, []}, | ||
{Credo.Check.Refactor.Nesting, []}, | ||
{Credo.Check.Refactor.UnlessWithElse, []}, | ||
{Credo.Check.Refactor.WithClauses, []}, | ||
{Credo.Check.Refactor.FilterFilter, []}, | ||
{Credo.Check.Refactor.RejectReject, []}, | ||
{Credo.Check.Refactor.RedundantWithClauseResult, []}, | ||
|
||
# | ||
## Warnings | ||
# | ||
{Credo.Check.Warning.ApplicationConfigInModuleAttribute, []}, | ||
{Credo.Check.Warning.BoolOperationOnSameValues, []}, | ||
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []}, | ||
{Credo.Check.Warning.IExPry, []}, | ||
{Credo.Check.Warning.IoInspect, []}, | ||
{Credo.Check.Warning.OperationOnSameValues, []}, | ||
{Credo.Check.Warning.OperationWithConstantResult, []}, | ||
{Credo.Check.Warning.RaiseInsideRescue, []}, | ||
{Credo.Check.Warning.SpecWithStruct, []}, | ||
{Credo.Check.Warning.WrongTestFileExtension, []}, | ||
{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.UnsafeExec, []} | ||
], | ||
disabled: [ | ||
# | ||
# Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`) | ||
|
||
# | ||
# Controversial and experimental checks (opt-in, just move the check to `:enabled` | ||
# and be sure to use `mix credo --strict` to see low priority checks) | ||
# | ||
{Credo.Check.Consistency.MultiAliasImportRequireUse, []}, | ||
{Credo.Check.Consistency.UnusedVariableNames, []}, | ||
{Credo.Check.Design.DuplicatedCode, []}, | ||
{Credo.Check.Design.SkipTestWithoutComment, []}, | ||
{Credo.Check.Readability.AliasAs, []}, | ||
{Credo.Check.Readability.BlockPipe, []}, | ||
{Credo.Check.Readability.ImplTrue, []}, | ||
{Credo.Check.Readability.MultiAlias, []}, | ||
{Credo.Check.Readability.NestedFunctionCalls, []}, | ||
{Credo.Check.Readability.SeparateAliasRequire, []}, | ||
{Credo.Check.Readability.SingleFunctionToBlockPipe, []}, | ||
{Credo.Check.Readability.SinglePipe, []}, | ||
{Credo.Check.Readability.Specs, []}, | ||
{Credo.Check.Readability.StrictModuleLayout, []}, | ||
{Credo.Check.Readability.WithCustomTaggedTuple, []}, | ||
{Credo.Check.Refactor.ABCSize, []}, | ||
{Credo.Check.Refactor.AppendSingleItem, []}, | ||
{Credo.Check.Refactor.DoubleBooleanNegation, []}, | ||
{Credo.Check.Refactor.FilterReject, []}, | ||
{Credo.Check.Refactor.IoPuts, []}, | ||
{Credo.Check.Refactor.MapMap, []}, | ||
{Credo.Check.Refactor.ModuleDependencies, []}, | ||
{Credo.Check.Refactor.NegatedIsNil, []}, | ||
{Credo.Check.Refactor.PipeChainStart, []}, | ||
{Credo.Check.Refactor.RejectFilter, []}, | ||
{Credo.Check.Refactor.VariableRebinding, []}, | ||
{Credo.Check.Warning.LazyLogging, []}, | ||
{Credo.Check.Warning.LeakyEnvironment, []}, | ||
{Credo.Check.Warning.MapGetUnsafePass, []}, | ||
{Credo.Check.Warning.MixEnv, []}, | ||
{Credo.Check.Warning.UnsafeToAtom, []}, | ||
|
||
# | ||
# CredoContrib checks | ||
# | ||
{CredoContrib.Check.EmptyDocString, []}, | ||
{CredoContrib.Check.EmptyTestBlock, []}, | ||
{CredoContrib.Check.FunctionBlockSyntax, false}, | ||
{CredoContrib.Check.FunctionNameUnderscorePrefix, []}, | ||
{CredoContrib.Check.ModuleAlias, []}, | ||
{CredoContrib.Check.ModuleDirectivesOrder, []}, | ||
{CredoContrib.Check.PublicPrivateFunctionName, []}, | ||
{CredoContrib.Check.SingleFunctionPipe, false}, | ||
] | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: pr-main | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
defaults: | ||
run: | ||
shell: bash | ||
jobs: | ||
test_run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Determine Elixir Version | ||
run: echo "ELIXIR_VERSION=$(grep -h elixir .tool-versions | awk '{ print $2 }' | awk -F - '{print $1}')" >> $GITHUB_ENV | ||
- name: Determine Erlang/OTP Version | ||
run: echo "OTP_VERSION=$(grep -h erlang .tool-versions | awk '{ print $2 }')" >> $GITHUB_ENV | ||
- name: Install Erlang and Elixir | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
otp-version: ${{ env.OTP_VERSION }} | ||
elixir-version: ${{ env.ELIXIR_VERSION }} | ||
- name: Checkout cache | ||
uses: actions/cache@v2 | ||
id: mix-deps-cache | ||
with: | ||
path: | | ||
deps | ||
_build | ||
key: ${{ runner.os }}-elixir-${{ env.ELIXIR_VERSION }}-otp-${{ env.OTP_VERSION }}-env-${{ env.MIX_ENV }}-mix-deps-${{ hashFiles('**/mix.lock') }} | ||
- name: Build Elixir project | ||
if: steps.mix-deps-cache.outputs.cache-hit != 'true' | ||
run: | | ||
mix local.rebar --force | ||
mix local.hex --force | ||
mix deps.get | ||
MIX_ENV=dev mix deps.compile | ||
MIX_ENV=test mix deps.compile | ||
- name: Run mix check | ||
run: mix check --except dialyzer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
erlang 25.0 | ||
elixir 1.13.4-otp-25 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.