forked from duffelhq/paginator
-
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.
chore: setup common-config-elixir (#1)
- Loading branch information
Showing
33 changed files
with
841 additions
and
451 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,194 @@ | ||
# This file is synced with stordco/common-config-elixir. Any changes will be overwritten. | ||
|
||
# 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 config using `mix credo -C <name>`. If no config 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/", "priv/", "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: 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: | ||
# | ||
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: [ | ||
# | ||
## Database Migration Checks | ||
# | ||
{ExcellentMigrations.CredoCheck.MigrationsSafety, []}, | ||
|
||
# | ||
## Consistency Checks | ||
# | ||
{Credo.Check.Consistency.ExceptionNames, []}, | ||
{Credo.Check.Consistency.LineEndings, []}, | ||
{Credo.Check.Consistency.MultiAliasImportRequireUse, []}, | ||
{Credo.Check.Consistency.ParameterPatternMatching, []}, | ||
{Credo.Check.Consistency.SpaceAroundOperators, []}, | ||
{Credo.Check.Consistency.SpaceInParentheses, []}, | ||
{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: 2, if_called_more_often_than: 2]}, | ||
{Credo.Check.Design.DuplicatedCode, false}, | ||
# 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: 2]}, | ||
{Credo.Check.Design.TagFIXME, []}, | ||
|
||
# | ||
## Readability Checks | ||
# | ||
{Credo.Check.Readability.AliasAs, false}, | ||
{Credo.Check.Readability.AliasOrder, []}, | ||
{Credo.Check.Readability.BlockPipe, []}, | ||
{Credo.Check.Readability.FunctionNames, []}, | ||
{Credo.Check.Readability.ImplTrue, []}, | ||
{Credo.Check.Readability.LargeNumbers, [trailing_digits: 2]}, | ||
{Credo.Check.Readability.MaxLineLength, false}, | ||
{Credo.Check.Readability.ModuleAttributeNames, []}, | ||
{Credo.Check.Readability.ModuleDoc, false}, | ||
{Credo.Check.Readability.ModuleNames, []}, | ||
{Credo.Check.Readability.MultiAlias, false}, | ||
{Credo.Check.Readability.NestedFunctionCalls, []}, | ||
{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.SeparateAliasRequire, []}, | ||
{Credo.Check.Readability.SinglePipe, []}, | ||
{Credo.Check.Readability.SpaceAfterCommas, []}, | ||
{Credo.Check.Readability.Specs, false}, | ||
{Credo.Check.Readability.StrictModuleLayout, | ||
[ | ||
order: | ||
~w(moduledoc behaviour use import require alias module_attribute defstruct callback macrocallback optional_callback)a, | ||
ignore: [:type] | ||
]}, | ||
{Credo.Check.Readability.StringSigils, []}, | ||
{Credo.Check.Readability.TrailingBlankLine, []}, | ||
{Credo.Check.Readability.TrailingWhiteSpace, []}, | ||
{Credo.Check.Readability.UnnecessaryAliasExpansion, []}, | ||
{Credo.Check.Readability.VariableNames, []}, | ||
{Credo.Check.Readability.WithCustomTaggedTuple, []}, | ||
|
||
# | ||
## Refactoring Opportunities | ||
# | ||
{Credo.Check.Refactor.ABCSize, false}, | ||
{Credo.Check.Refactor.AppendSingleItem, []}, | ||
{Credo.Check.Refactor.CondStatements, []}, | ||
{Credo.Check.Refactor.CyclomaticComplexity, []}, | ||
{Credo.Check.Refactor.DoubleBooleanNegation, []}, | ||
{Credo.Check.Refactor.FunctionArity, []}, | ||
{Credo.Check.Refactor.LongQuoteBlocks, []}, | ||
# {Credo.Check.Refactor.MapInto, []}, | ||
{Credo.Check.Refactor.MatchInCondition, []}, | ||
{Credo.Check.Refactor.ModuleDependencies, false}, | ||
{Credo.Check.Refactor.NegatedConditionsInUnless, []}, | ||
{Credo.Check.Refactor.NegatedConditionsWithElse, []}, | ||
{Credo.Check.Refactor.NegatedIsNil, []}, | ||
{Credo.Check.Refactor.Nesting, []}, | ||
{Credo.Check.Refactor.PipeChainStart, []}, | ||
{Credo.Check.Refactor.UnlessWithElse, []}, | ||
{Credo.Check.Refactor.VariableRebinding, false}, | ||
{Credo.Check.Refactor.WithClauses, []}, | ||
|
||
# | ||
## Warnings | ||
# | ||
{Credo.Check.Warning.ApplicationConfigInModuleAttribute, []}, | ||
{Credo.Check.Warning.BoolOperationOnSameValues, []}, | ||
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []}, | ||
{Credo.Check.Warning.IExPry, []}, | ||
{Credo.Check.Warning.IoInspect, []}, | ||
{Credo.Check.Warning.LeakyEnvironment, []}, | ||
# {Credo.Check.Warning.LazyLogging, []}, | ||
{Credo.Check.Warning.MapGetUnsafePass, []}, | ||
# disabling this check by default, as if not included, it will be | ||
# run on version 1.7.0 and above | ||
{Credo.Check.Warning.MissedMetadataKeyInLoggerConfig, false}, | ||
{Credo.Check.Warning.MixEnv, []}, | ||
{Credo.Check.Warning.OperationOnSameValues, []}, | ||
{Credo.Check.Warning.OperationWithConstantResult, []}, | ||
{Credo.Check.Warning.RaiseInsideRescue, []}, | ||
{Credo.Check.Warning.UnsafeExec, []}, | ||
{Credo.Check.Warning.UnsafeToAtom, []}, | ||
{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, []}, | ||
|
||
# | ||
## Custom | ||
# | ||
{Credo.Check.Warning.ForbiddenModule, | ||
[ | ||
modules: [ | ||
{Oban.Worker, "use Oban.Pro.Worker instead"} | ||
] | ||
]} | ||
] | ||
} | ||
] | ||
} |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# Used by "mix format" | ||
[ | ||
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"], | ||
import_deps: [:ecto], | ||
local_without_parens: [] | ||
inputs: ["*.{heex,ex,exs}", "{config,lib,priv,test}/**/*.{heex,ex,exs}"], | ||
line_length: 120, | ||
plugins: [] | ||
] |
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,169 @@ | ||
# This file is synced with stordco/common-config-elixir. Any changes will be overwritten. | ||
|
||
name: CI | ||
|
||
on: | ||
merge_group: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
push: | ||
branches: | ||
- main | ||
workflow_call: | ||
secrets: | ||
CI_SERVICE_KEY: | ||
required: true | ||
GH_PERSONAL_ACCESS_TOKEN: | ||
required: true | ||
HEX_API_KEY: | ||
required: true | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
Credo: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Elixir | ||
uses: stordco/actions-elixir/setup@v1 | ||
with: | ||
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | ||
hex-token: ${{ secrets.HEX_API_KEY }} | ||
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }} | ||
oban-token: ${{ secrets.OBAN_LICENSE_KEY }} | ||
|
||
- name: Credo | ||
run: mix credo --strict | ||
|
||
Dependencies: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Elixir | ||
uses: stordco/actions-elixir/setup@v1 | ||
with: | ||
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | ||
hex-token: ${{ secrets.HEX_API_KEY }} | ||
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }} | ||
oban-token: ${{ secrets.OBAN_LICENSE_KEY }} | ||
|
||
- name: Unused | ||
run: mix deps.unlock --check-unused | ||
|
||
Dialyzer: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Elixir | ||
uses: stordco/actions-elixir/setup@v1 | ||
with: | ||
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | ||
hex-token: ${{ secrets.HEX_API_KEY }} | ||
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }} | ||
oban-token: ${{ secrets.OBAN_LICENSE_KEY }} | ||
|
||
- name: Dialyzer | ||
run: mix dialyzer --format github | ||
|
||
Documentation: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Elixir | ||
uses: stordco/actions-elixir/setup@v1 | ||
with: | ||
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | ||
hex-token: ${{ secrets.HEX_API_KEY }} | ||
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }} | ||
oban-token: ${{ secrets.OBAN_LICENSE_KEY }} | ||
|
||
- name: Docs | ||
run: mix docs | ||
|
||
Format: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Elixir | ||
uses: stordco/actions-elixir/setup@v1 | ||
with: | ||
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | ||
hex-token: ${{ secrets.HEX_API_KEY }} | ||
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }} | ||
oban-token: ${{ secrets.OBAN_LICENSE_KEY }} | ||
|
||
- name: Format | ||
run: mix format --check-formatted | ||
|
||
Test: | ||
name: Test (Elixir ${{ matrix.versions.elixir }} OTP ${{ matrix.versions.otp }}) | ||
|
||
runs-on: ubuntu-latest | ||
|
||
env: | ||
MIX_ENV: test | ||
|
||
services: | ||
postgres: | ||
image: postgres:14-alpine | ||
ports: | ||
- 5432:5432 | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_INITDB_ARGS: "--nosync" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Elixir | ||
uses: stordco/actions-elixir/setup@v1 | ||
with: | ||
elixir-version: ${{ matrix.versions.elixir }} | ||
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | ||
hex-token: ${{ secrets.HEX_API_KEY }} | ||
oban-fingerprint: ${{ secrets.OBAN_KEY_FINGERPRINT }} | ||
oban-token: ${{ secrets.OBAN_LICENSE_KEY }} | ||
otp-version: ${{ matrix.versions.otp }} | ||
|
||
- name: Compile | ||
run: mix compile --warnings-as-errors | ||
|
||
- name: Test | ||
run: mix coveralls.github | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
versions: | ||
- elixir: 1.13 | ||
otp: 25 | ||
- elixir: 1.14 | ||
otp: 25 | ||
- elixir: 1.15 | ||
otp: 26 |
Oops, something went wrong.