forked from lexmag/statix
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
274 additions
and
64 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,157 @@ | ||
# This file contains the configuration for Credo and you are probably reading | ||
# this after creating it with `mix credo.gen.config`. | ||
# | ||
# If you find anything wrong or unclear in this file, please report an | ||
# issue on GitHub: https://github.com/rrrene/credo/issues | ||
# | ||
%{ | ||
# | ||
# You can have as many configs as you like in the `configs:` field. | ||
configs: [ | ||
%{ | ||
# | ||
# Run any exec using `mix credo -C <name>`. If no exec name is given | ||
# "default" is used. | ||
# | ||
name: "default", | ||
# | ||
# These are the files included in the analysis: | ||
files: %{ | ||
# | ||
# You can give explicit globs or simply directories. | ||
# In the latter case `**/*.{ex,exs}` will be used. | ||
# | ||
included: ["lib/", "test/"], | ||
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. | ||
# | ||
requires: [], | ||
# | ||
# If you want to enforce a style guide and need a more traditional linting | ||
# experience, you can change `strict` to `true` below: | ||
# | ||
strict: false, | ||
# | ||
# If you want to use uncolored output by default, you can change `color` | ||
# to `false` below: | ||
# | ||
color: true, | ||
# | ||
# You can customize the parameters of any check by adding a second element | ||
# to the tuple. | ||
# | ||
# To disable a check put `false` as second element: | ||
# | ||
# {Credo.Check.Design.DuplicatedCode, false} | ||
# | ||
checks: [ | ||
# | ||
## Consistency Checks | ||
# | ||
{Credo.Check.Consistency.ExceptionNames, []}, | ||
{Credo.Check.Consistency.LineEndings, []}, | ||
{Credo.Check.Consistency.MultiAliasImportRequireUse, false}, | ||
{Credo.Check.Consistency.ParameterPatternMatching, []}, | ||
{Credo.Check.Consistency.SpaceAroundOperators, false}, | ||
{Credo.Check.Consistency.SpaceInParentheses, false}, | ||
{Credo.Check.Consistency.TabsOrSpaces, []}, | ||
{Credo.Check.Consistency.UnusedVariableNames, false}, | ||
|
||
# | ||
## Design Checks | ||
# | ||
# You can customize the priority of any check | ||
# Priority values are: `low, normal, high, higher` | ||
# | ||
{Credo.Check.Design.AliasUsage, | ||
[priority: :low, if_nested_deeper_than: 4, if_called_more_often_than: 2]}, | ||
{Credo.Check.Design.DuplicatedCode, false}, | ||
{Credo.Check.Design.TagTODO, false}, | ||
{Credo.Check.Design.TagFIXME, false}, | ||
|
||
# | ||
## Readability Checks | ||
# | ||
{Credo.Check.Readability.AliasAs, false}, | ||
{Credo.Check.Readability.AliasOrder, false}, | ||
{Credo.Check.Readability.FunctionNames, []}, | ||
{Credo.Check.Readability.LargeNumbers, []}, | ||
{Credo.Check.Readability.MaxLineLength, false}, | ||
{Credo.Check.Readability.ModuleAttributeNames, []}, | ||
{Credo.Check.Readability.ModuleDoc, []}, | ||
{Credo.Check.Readability.ModuleNames, []}, | ||
{Credo.Check.Readability.MultiAlias, false}, | ||
{Credo.Check.Readability.ParenthesesInCondition, []}, | ||
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []}, | ||
{Credo.Check.Readability.PredicateFunctionNames, false}, | ||
{Credo.Check.Readability.PreferImplicitTry, []}, | ||
{Credo.Check.Readability.RedundantBlankLines, [max_blank_lines: 1]}, | ||
{Credo.Check.Readability.Semicolons, []}, | ||
{Credo.Check.Readability.SinglePipe, false}, | ||
{Credo.Check.Readability.SpaceAfterCommas, false}, | ||
{Credo.Check.Readability.Specs, false}, | ||
{Credo.Check.Readability.StringSigils, []}, | ||
{Credo.Check.Readability.TrailingBlankLine, []}, | ||
{Credo.Check.Readability.TrailingWhiteSpace, []}, | ||
# TODO: enable by default in Credo 1.1 | ||
{Credo.Check.Readability.UnnecessaryAliasExpansion, false}, | ||
{Credo.Check.Readability.VariableNames, []}, | ||
|
||
# | ||
# Controversial and experimental checks (opt-in, just replace `false` with `[]`) | ||
# | ||
|
||
# | ||
## Refactoring Opportunities | ||
# | ||
{Credo.Check.Refactor.ABCSize, false}, | ||
{Credo.Check.Refactor.AppendSingleItem, false}, | ||
{Credo.Check.Refactor.CaseTrivialMatches, false}, | ||
{Credo.Check.Refactor.CondStatements, false}, | ||
{Credo.Check.Refactor.CyclomaticComplexity, [max_complexity: 18]}, | ||
{Credo.Check.Refactor.DoubleBooleanNegation, false}, | ||
{Credo.Check.Refactor.FunctionArity, []}, | ||
{Credo.Check.Refactor.LongQuoteBlocks, false}, | ||
{Credo.Check.Refactor.MapInto, false}, | ||
{Credo.Check.Refactor.MatchInCondition, false}, | ||
{Credo.Check.Refactor.ModuleDependencies, false}, | ||
{Credo.Check.Refactor.NegatedConditionsInUnless, []}, | ||
{Credo.Check.Refactor.NegatedConditionsWithElse, []}, | ||
{Credo.Check.Refactor.Nesting, false}, | ||
{Credo.Check.Refactor.PipeChainStart, false}, | ||
{Credo.Check.Refactor.UnlessWithElse, []}, | ||
{Credo.Check.Refactor.VariableRebinding, false}, | ||
{Credo.Check.Refactor.WithClauses, []}, | ||
|
||
# | ||
## Warnings | ||
# | ||
{Credo.Check.Warning.BoolOperationOnSameValues, []}, | ||
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []}, | ||
{Credo.Check.Warning.IExPry, []}, | ||
{Credo.Check.Warning.IoInspect, []}, | ||
{Credo.Check.Warning.LazyLogging, false}, | ||
{Credo.Check.Warning.MapGetUnsafePass, false}, | ||
{Credo.Check.Warning.OperationOnSameValues, []}, | ||
{Credo.Check.Warning.OperationWithConstantResult, false}, | ||
{Credo.Check.Warning.RaiseInsideRescue, []}, | ||
{Credo.Check.Warning.UnsafeToAtom, false}, | ||
{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, []}, | ||
] | ||
} | ||
] | ||
} |
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,106 @@ | ||
name: Elixir CI | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
env: | ||
MIX_ENV: test | ||
|
||
jobs: | ||
deps: | ||
name: Install Dependencies | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
elixir: [1.11] | ||
otp: [23.3] | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: setup | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
elixir-version: ${{ matrix.elixir }} | ||
otp-version: ${{ matrix.otp }} | ||
- name: Retrieve Cached Dependencies | ||
uses: actions/cache@v2 | ||
id: mix-cache | ||
with: | ||
path: | | ||
deps | ||
_build | ||
priv/plts | ||
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }} | ||
- name: Install deps | ||
if: steps.mix-cache.outputs.cache-hit != 'true' | ||
run: | | ||
mkdir -p priv/plts | ||
mix local.rebar --force | ||
mix local.hex --force | ||
mix deps.get | ||
mix deps.compile | ||
mix dialyzer --plt | ||
analyze: | ||
name: Analysis | ||
needs: deps | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
elixir: [1.11] | ||
otp: [23.3] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup elixir | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
elixir-version: ${{ matrix.elixir }} | ||
otp-version: ${{ matrix.otp }} | ||
- name: Retrieve Cached Dependencies | ||
uses: actions/cache@v2 | ||
id: mix-cache | ||
with: | ||
path: | | ||
deps | ||
_build | ||
priv/plts | ||
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }} | ||
- name: Run Credo | ||
run: mix credo | ||
- name: Run Dialyzer | ||
run: mix dialyzer --no-check --halt-exit-status | ||
|
||
tests: | ||
name: Tests | ||
needs: deps | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
elixir: [1.11] | ||
otp: [23.3] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: erlef/setup-beam@v1 | ||
with: | ||
elixir-version: ${{ matrix.elixir }} | ||
otp-version: ${{ matrix.otp }} | ||
- name: Retrieve Cached Dependencies | ||
uses: actions/cache@v2 | ||
id: mix-cache | ||
with: | ||
path: | | ||
deps | ||
_build | ||
priv/plts | ||
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }} | ||
- name: Run Tests | ||
run: mix test |
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
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