Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettmichaelgeorge committed Feb 12, 2022
0 parents commit 2972a05
Show file tree
Hide file tree
Showing 22 changed files with 600 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .dialyzer_ignore.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# You can get the spec for these errors to ignore by running:
# $ mix dialyzer --format short
# ...and then taking that "short" output and either reproducing it whole here or by
# pulling out the file and error atom.
#
# More info in the Dialyxir README:
# https://github.com/jeremyjh/dialyxir#elixir-term-format
[
]
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eval "$(lorri direnv)"
4 changes: 4 additions & 0 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[
line_length: 140,
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: mix
directory: "/"
schedule:
interval: weekly
time: "12:00"
open-pull-requests-limit: 10
67 changes: 67 additions & 0 deletions .github/workflows/elixir-build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: ExUnit Tests

on:
push:
branches:
- main
pull_request:
branches:
- '*'

jobs:
test:
name: ExUnit Tests
runs-on: [ubuntu-20.04]
env:
MIX_ENV: test

strategy:
matrix:
elixir: ['1.12.3', '1.13.1']
otp: ['24.1']
steps:
- uses: actions/checkout@v2
- name: Setup elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{matrix.elixir}}
otp-version: ${{matrix.otp}}
- name: Cache Dependency Sources
uses: actions/cache@v2
id: deps-cache
with:
path: deps
# If you ever need to clear the cache, increment the number after "v1" here
key: dependencies-v1-${{matrix.elixir}}-${{ hashFiles('**/mix.lock') }}
restore-keys: dependencies-${{ hashFiles('**/mix.lock') }}
- name: Cache Compiled Files
uses: actions/cache@v2
with:
path: _build/test/
key: compiled-test-${{matrix.elixir}}-${{ hashFiles('**/mix.lock') }}
restore-keys: compiled-test-${{matrix.elixir}}
# In my experience, I have issues with incremental builds maybe 1 in 100
# times that are fixed by doing a full recompile.
# In order to not waste dev time on such trivial issues (while also reaping
# the time savings of incremental builds for *most* day-to-day development),
# I force a full recompile only on builds that we retry.
- name: Clean
if: github.run_attempt != '1'
run: |
mix deps.clean --all
mix clean
- name: Install Dependencies
run: mix deps.get
- name: Build
run: mix compile --all-warnings --warnings-as-errors
# If the compile fails, it's likely due to a warning. Go ahead and run the tests
# to give the devs feedback and save them some time.
- name: Run Tests
# You might consider adding the --stale flag here as well.
# Doing so will cause Mix to attempt to run only the tests that reference modules
# that have changed since the last CI run.
# https://hexdocs.pm/mix/1.12/Mix.Tasks.Test.html#module-the-stale-option
run: mix test
if: always()

# TODO: Log test coverage
46 changes: 46 additions & 0 deletions .github/workflows/elixir-dialyzer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Elixir Dialyzer

on:
push:
branches:
- main
pull_request:
branches:
- '*'

jobs:
dialyzer:
name: Run Dialyzer type checking
runs-on: [ubuntu-20.04]

strategy:
matrix:
elixir: ['1.13.1']
otp: ['24.1']
steps:
- uses: actions/checkout@v2
- name: Setup elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{matrix.elixir}}
otp-version: ${{matrix.otp}}
- name: Cache Dependency Sources
uses: actions/cache@v2
id: deps-cache
with:
path: deps
# If you ever need to clear the cache, increment the number after "v1" here
key: dependencies-v1-${{matrix.elixir}}-${{ hashFiles('**/mix.lock') }}
restore-keys: dependencies-${{ hashFiles('**/mix.lock') }}
- name: Cache Compiled Files
uses: actions/cache@v2
with:
path: _build/dev/
key: compiled-dev-${{matrix.elixir}}-${{ hashFiles('**/mix.lock') }}
restore-keys: compiled-dev-${{matrix.elixir}}
- name: Install Dependencies
run: mix deps.get
- name: Generate PLT
run: mix dialyzer --plt
- name: Run Dialyzer
run: mix dialyzer
50 changes: 50 additions & 0 deletions .github/workflows/elixir-quality-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Elixir Quality Checks

on:
push:
branches:
- main
pull_request:
branches:
- '*'

jobs:
quality_checks:
runs-on: ubuntu-latest
env:
MIX_ENV: test

strategy:
matrix:
elixir: ['1.13.1']
otp: ['24.1']
steps:
- uses: actions/checkout@v2
- name: Setup elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{matrix.elixir}}
otp-version: ${{matrix.otp}}
- name: Cache Dependency Sources
uses: actions/cache@v2
id: deps-cache
with:
path: deps
# If you ever need to clear the cache, increment the number after "v1" here
key: dependencies-v1-${{matrix.elixir}}-${{ hashFiles('**/mix.lock') }}
restore-keys: dependencies-${{ hashFiles('**/mix.lock') }}
- name: Cache Compiled Files
uses: actions/cache@v2
with:
path: _build/test/
key: compiled-test-${{matrix.elixir}}-${{ hashFiles('**/mix.lock') }}
restore-keys: compiled-test-${{matrix.elixir}}
- name: Install Dependencies
run: mix deps.get
- name: Run Credo
run: mix credo
# The format check gets run even if Credo fails so that
# we give the devs as much feedback as possible & save some time.
- name: Check Formatting
run: mix format --check-formatted
if: always()
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/_build
/cover
/deps
/doc
/.fetch
erl_crash.dump
*.ez
*.beam
/config/*.secret.exs
.elixir_ls/
7 changes: 7 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This lists the versions ASDF should use with this project.
# If you're using ASDF to manage your Elixir runtimes, you
# can do:
# $ asdf install
# to get going quickly.
elixir 1.12.3-otp-24
erlang 24.1
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Tyler A. Young

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# ZipZip
163 changes: 163 additions & 0 deletions config/.credo.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
# 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/", "src/", "test/", "web/", "apps/"],
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/", ~r"/data/"]
},
#
# 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: [
"config/credo_checks/explicitly_ignore_return_values.ex"
],
#
# If you want to enforce a style guide and need a more traditional linting
# experience, you can change `strict` to `true` below:
#
strict: true,
#
# 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.ParameterPatternMatching, []},
{Credo.Check.Consistency.SpaceAroundOperators, []},
{Credo.Check.Consistency.SpaceInParentheses, []},
{Credo.Check.Consistency.TabsOrSpaces, []},

#
## 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]},
# Don't cause to-do comments to fail
{Credo.Check.Design.TagTODO, [exit_status: 0]},
{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: 140]},
{Credo.Check.Readability.ModuleAttributeNames, []},
{Credo.Check.Readability.ModuleDoc, []},
{Credo.Check.Readability.ModuleNames, []},
{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.SpaceAfterCommas, []},
{Credo.Check.Readability.StringSigils, []},
{Credo.Check.Readability.TrailingBlankLine, []},
{Credo.Check.Readability.TrailingWhiteSpace, []},
{Credo.Check.Readability.UnnecessaryAliasExpansion, []},
{Credo.Check.Readability.VariableNames, []},

#
## Refactoring Opportunities
#
{Credo.Check.Refactor.CondStatements, []},
{Credo.Check.Refactor.CyclomaticComplexity, []},
{Credo.Check.Refactor.FunctionArity, []},
{Credo.Check.Refactor.LongQuoteBlocks, []},
{Credo.Check.Refactor.MatchInCondition, []},
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
{Credo.Check.Refactor.Nesting, [max_nesting: 3]},
{Credo.Check.Refactor.UnlessWithElse, []},
{Credo.Check.Refactor.WithClauses, []},

#
## Warnings
#
{Credo.Check.Warning.BoolOperationOnSameValues, []},
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
{Credo.Check.Warning.IExPry, []},
{Credo.Check.Warning.IoInspect, []},
{Credo.Check.Warning.MixEnv, []},
{Credo.Check.Warning.OperationOnSameValues, []},
{Credo.Check.Warning.OperationWithConstantResult, []},
{Credo.Check.Warning.RaiseInsideRescue, []},
{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, []},

#
# Controversial and experimental checks (opt-in, just replace `false` with `[]`)
#
{Credo.Check.Consistency.MultiAliasImportRequireUse, []},
# Tyler says: I don't like this one... it just enforces that you always name your unused vars the *same* way
# either anonymously (like `_`) or with a real name (like `_client`)
{Credo.Check.Consistency.UnusedVariableNames, false},
# Tyler says: I like this one
{Credo.Check.Design.DuplicatedCode, []},
{Credo.Check.Readability.AliasAs, []},
{Credo.Check.Readability.MultiAlias, []},
{Credo.Check.Readability.Specs, false},
{Credo.Check.Readability.SeparateAliasRequire, false},
{Credo.Check.Readability.SinglePipe, []},
{Credo.Check.Readability.WithCustomTaggedTuple, []},
{Credo.Check.Refactor.ABCSize, false},
{Credo.Check.Refactor.AppendSingleItem, []},
{Credo.Check.Refactor.DoubleBooleanNegation, []},
{Credo.Check.Refactor.ModuleDependencies, false},
{Credo.Check.Refactor.PipeChainStart, false},
# Tyler says: I like this one
{Credo.Check.Refactor.VariableRebinding, []},
# Tyler says: I like this one
{Credo.Check.Warning.MapGetUnsafePass, []},
{Credo.Check.Warning.UnsafeToAtom, []}
]
}
]
}
Loading

0 comments on commit 2972a05

Please sign in to comment.