Browse files

Add test_on_projects script

  • Loading branch information...
rrrene committed Mar 30, 2018
1 parent 70a0eba commit 18af91c304e84880f830d31dbd274aeb21e5a646
Showing with 99 additions and 15 deletions.
  1. +1 −0 .gitignore
  2. +0 −15 lib/credo.ex
  3. +98 −0 test/
@@ -3,6 +3,7 @@
@@ -1,20 +1,5 @@
defmodule Credo do
@moduledoc """
Credo is composed of these namespaces:
* `Credo.Check` - checks are the building blocks of Credo's analysis. Each check analyses a part of the source code based on configurable parameters and returns found issues. A check can run on all files at once or on individual files.
* `Credo.CLI` - CLI commands like `mix credo explain` are defined here.
Additionally, this module holds everything else necessary to provide the command line interface experience, e.g. option parsing and output formatting.
* `Credo.Code` - all of Credo's general purpose code analysing functions are stored here. These include utility functions for working with ASTs, tokens and text analysis.
* `Credo.Execution` - modules responsible for orchestrating the flow of Credo's business logic. This includes metaprogramming facilities for the definition of business processes comprised of activities which are a series of tasks.
@version Mix.Project.config()[:version]
@doc "Returns Credo's version"
def version, do: @version
@@ -0,0 +1,98 @@
# common setup
set -e
DIRNAME=$( cd "$( dirname "$0" )" && pwd )
PROJECT_ROOT=$( cd "$DIRNAME/.." && pwd )
# script specific sources, variables and function definitions
clone_and_test() {
CMD="mix credo $DIRNAME --mute-exit-status --format json --strict $CREDO_ARG1 $CREDO_ARG2 $CREDO_ARG3 $CREDO_ARG4 $CREDO_ARG5"
echo ""
echo "--> Cloning $PROJECT_NAME ..."
rm -fr $DIRNAME || true
git clone $GIT_REPO $DIRNAME --depth=1 --quiet
echo "--> Analysing $PROJECT_NAME ..."
echo ""
benchmark $CMD "" "" $METRIC
benchmark() {
COMMAND=$1 # command to be timed/benchmarked
HOST=$2 # hostname of statsd listener
PORT=$3 # port of statsd listener
METRIC=$4 # metric to be collected
# The '%N' option does not seem to work on macOS
t1=$(date +%s%N)
bash -c "$COMMAND"
t2=$(date +%s%N)
TIME=`expr $t2 - $t1`
TIME=`expr $TIME / 1000000`
echo "$METRIC:$TIME|ms" #| nc -C -w 1 -u $HOST $PORT
# setup
mkdir -p tmp
mix deps.get
mix compile
# execution
# Community projects
clone_and_test elixirscript
clone_and_test guardian
clone_and_test distillery
clone_and_test timex
clone_and_test jason
clone_and_test ex_machina
clone_and_test graphql
clone_and_test absinthe
clone_and_test poison
clone_and_test mox
clone_and_test benchee
# Elixir
clone_and_test elixir
clone_and_test ex_doc
clone_and_test flow
clone_and_test gettext
clone_and_test gen_stage
clone_and_test ecto
# Phoenix
clone_and_test phoenix
clone_and_test phoenix_html
clone_and_test phoenix_pubsub
clone_and_test phoenix_ecto
clone_and_test phoenix_live_reload
# Nerves
clone_and_test nerves
# teardown
echo ""
echo "All tests done."

0 comments on commit 18af91c

Please sign in to comment.