Skip to content

Commit

Permalink
chore: sync files with beam-community/common-config
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Jun 24, 2024
1 parent aeea9fa commit 1c7ee74
Show file tree
Hide file tree
Showing 9 changed files with 278 additions and 56 deletions.
93 changes: 42 additions & 51 deletions .credo.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is synced with beam-community/common-config. 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`.
#
Expand All @@ -21,16 +23,7 @@
# You can give explicit globs or simply directories.
# In the latter case `**/*.{ex,exs}` will be used.
#
included: [
"lib/",
"src/",
"test/",
"web/",
"apps/*/lib/",
"apps/*/src/",
"apps/*/test/",
"apps/*/web/"
],
included: ["config/", "lib/", "priv/", "test/"],
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
},
#
Expand All @@ -46,7 +39,7 @@
# If you want to enforce a style guide and need a more traditional linting
# experience, you can change `strict` to `true` below:
#
strict: false,
strict: true,
#
# To modify the timeout for parsing files, change this value:
#
Expand All @@ -70,18 +63,21 @@
#
{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: 0]},
{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).
Expand All @@ -92,39 +88,61 @@
#
## Readability Checks
#
{Credo.Check.Readability.AliasAs, false},
{Credo.Check.Readability.AliasOrder, []},
{Credo.Check.Readability.BlockPipe, []},
{Credo.Check.Readability.FunctionNames, []},
{Credo.Check.Readability.LargeNumbers, []},
{Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
{Credo.Check.Readability.ImplTrue, []},
{Credo.Check.Readability.LargeNumbers, [trailing_digits: 2]},
{Credo.Check.Readability.MaxLineLength, false},
{Credo.Check.Readability.ModuleAttributeNames, []},
{Credo.Check.Readability.ModuleDoc, []},
{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, []},

#
Expand All @@ -135,53 +153,26 @@
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
{Credo.Check.Warning.IExPry, []},
{Credo.Check.Warning.IoInspect, []},
{Credo.Check.Warning.LeakyEnvironment, []},
# {Credo.Check.Warning.LazyLogging, []},
{Credo.Check.Warning.MixEnv, false},
{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, []},
{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 replace `false` with `[]`)
#
{Credo.Check.Consistency.MultiAliasImportRequireUse, false},
{Credo.Check.Consistency.UnusedVariableNames, false},
{Credo.Check.Design.DuplicatedCode, false},
{Credo.Check.Readability.AliasAs, false},
{Credo.Check.Readability.BlockPipe, false},
{Credo.Check.Readability.ImplTrue, false},
{Credo.Check.Readability.MultiAlias, false},
{Credo.Check.Readability.SeparateAliasRequire, false},
{Credo.Check.Readability.SinglePipe, false},
{Credo.Check.Readability.Specs, false},
{Credo.Check.Readability.StrictModuleLayout, false},
{Credo.Check.Readability.WithCustomTaggedTuple, false},
{Credo.Check.Refactor.ABCSize, false},
{Credo.Check.Refactor.AppendSingleItem, false},
{Credo.Check.Refactor.DoubleBooleanNegation, false},
{Credo.Check.Refactor.ModuleDependencies, false},
{Credo.Check.Refactor.NegatedIsNil, false},
{Credo.Check.Refactor.PipeChainStart, false},
{Credo.Check.Refactor.VariableRebinding, false},
{Credo.Check.Warning.LeakyEnvironment, false},
{Credo.Check.Warning.MapGetUnsafePass, false},
{Credo.Check.Warning.UnsafeToAtom, false}

#
# Custom checks can be created using `mix credo.gen.check`.
#
{Credo.Check.Warning.UnusedTupleOperation, []}
]
}
]
Expand Down
9 changes: 6 additions & 3 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Used by "mix format"
# This file is synced with beam-community/common-config. Any changes will be overwritten.

[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"],
line_length: 120
import_deps: [],
inputs: ["*.{heex,ex,exs}", "{config,lib,priv,test}/**/*.{heex,ex,exs}"],
line_length: 120,
plugins: []
]
39 changes: 39 additions & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$comment": "This file is synced with beam-community/common-config. Any changes will be overwritten.",
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"changelog-sections": [
{
"type": "feat",
"section": "Features",
"hidden": false
},
{
"type": "fix",
"section": "Bug Fixes",
"hidden": false
},
{
"type": "chore",
"section": "Miscellaneous",
"hidden": false
}
],
"draft": false,
"draft-pull-request": false,
"packages": {
".": {
"extra-files": [
"README.md"
],
"release-type": "elixir"
}
},
"plugins": [
{
"type": "sentence-case"
}
],
"prerelease": false,
"pull-request-header": "An automated release has been created for you.",
"separate-pull-requests": true
}
106 changes: 106 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# This file is synced with beam-community/common-config. Any changes will be overwritten.

name: CI

on:
merge_group:
pull_request:
types:
- opened
- reopened
- synchronize
push:
branches:
- main
workflow_call:
secrets:
GH_PERSONAL_ACCESS_TOKEN:
required: true
workflow_dispatch:

concurrency:
group: CI ${{ 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 }}

- 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 }}

- 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 }}

- name: Dialyzer
run: mix dialyzer --format github

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 }}

- name: Format
run: mix format --check-formatted

Test:
runs-on: ubuntu-latest

env:
MIX_ENV: test

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Elixir
uses: stordco/actions-elixir/setup@v1
with:
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}

- name: Compile
run: mix compile --warnings-as-errors

- name: Test
run: mix test

4 changes: 2 additions & 2 deletions .github/workflows/common-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20
node-version: 18

- name: Setup Elixir
uses: stordco/actions-elixir/setup@v1
Expand All @@ -51,4 +51,4 @@ jobs:
pr-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
sync-auth: doomspork:${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
sync-branch: latest
sync-repository: github.com/beam-community/common-config.git
sync-repository: github.com/beam-community/common-config.git
Loading

0 comments on commit 1c7ee74

Please sign in to comment.