Skip to content

Commit

Permalink
Merge pull request #2 from project-fifo/copy-elvis
Browse files Browse the repository at this point in the history
Copy in the elvis files
  • Loading branch information
jfacorro committed Nov 25, 2015
2 parents d5cf013 + 7773bf7 commit c5e813e
Show file tree
Hide file tree
Showing 73 changed files with 7,036 additions and 4 deletions.
11 changes: 7 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
.eunit
.rebar
deps
ebin
*.o
*.beam
*.plt
erl_crash.dump
ebin
rel/example_project
.concrete/DEV_MODE
.rebar
log*/
.erlang.mk.packages.*
_build
# Ignore elvis escript
elvis
631 changes: 631 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Contribute

Before anything else... Thank you for your time and contributions!

## Issues (New Features, Rules & Bug Reports)

If you have a feature or rule you want to see added to Elvis, please create an
[issue](https://github.com/inaka/elvis/issues) before doing any work, so that we can discuss it and figure
out what to do about it.

In the case of rules, keep in mind you can always create your [User Defined Rules](https://github.com/inaka/elvis#user-defined-rules), in order to run them locally.

When you find a bug in one of Elvis's rules or the way Elvis itself work, please provide detailed steps
that show how to reproduce the problem.

## Rules

When an issue is already marked with the `rule` label and you are interested in working on it, first check
there is no existing [branch](https://github.com/inaka/elvis/branches) with the issue's number, If so, you
can go ahead and start working on it.

The following is a checklist you can follow when implementing a new Elvis rule:

- [ ] Write both test cases that fail and that pass the rule.
- [ ] Edit the [Rules](https://github.com/inaka/elvis/wiki/Rules) wiki page, by adding the rule to the list.
- [ ] When the issue has the label `default rule`, add the rule to [Default Rules in Elvis Webhook](https://github.com/inaka/elvis/wiki/Default-Rules-in-Elvis-Webhook) and in the [`config/elvis.config`](https://github.com/inaka/elvis/blob/master/config/elvis.config) file.

## Questions?

If you have any questions or general comments regarding how to contribute, please use our public [hipchat room](http://inaka.net/hipchat).
46 changes: 46 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
PROJECT = elvis

DEPS = lager zipper katana

dep_lager = git https://github.com/basho/lager.git 3.0.2
dep_zipper = git https://github.com/inaka/zipper 0.1.2
dep_katana = git https://github.com/inaka/erlang-katana 0.2.13

TEST_DEPS = meck

dep_meck = git https://github.com/eproxus/meck 0.8.3

include erlang.mk

ERLC_OPTS += +'{parse_transform, lager_transform}'
ERLC_OPTS += +warn_unused_vars +warn_export_all +warn_shadow_vars +warn_unused_import +warn_unused_function
ERLC_OPTS += +warn_bif_clash +warn_unused_record +warn_deprecated_function +warn_obsolete_guard +strict_validation
ERLC_OPTS += +warn_export_vars +warn_exported_vars +warn_missing_spec +warn_untyped_record +debug_info

# Commont Test Config

TEST_ERLC_OPTS += +'{parse_transform, lager_transform}'
CT_OPTS = -cover test/elvis.coverspec -erl_args -config config/test.config

# Builds the elvis escript.
escript: all
rebar escriptize
./elvis help

shell: app
erl -pa ebin -pa deps/*/ebin -name elvis@`hostname` -s sync -s elvis -s lager -config config/elvis.config

test-shell: build-ct-suites app
erl -pa ebin -pa deps/*/ebin -name elvis-test@`hostname` -pa test -s sync -s elvis -s lager -config config/test.config

install: escript
cp elvis /usr/local/bin

quicktests: ERLC_OPTS = $(TEST_ERLC_OPTS)
quicktests: clean app build-ct-suites
@if [ -d "test" ] ; \
then \
mkdir -p logs/ ; \
$(CT_RUN) -suite $(addsuffix _SUITE,$(CT_SUITES)) $(CT_OPTS) ; \
fi
$(gen_verbose) rm -f test/*.beam
14 changes: 14 additions & 0 deletions config/elvis-test-pa.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
elvis,
[
{config,
[#{dirs => ["../../test/examples"],
filter => "user_defined_rules.erl",
rules => [{user_defined_rules, rule}]
}
]
}
]
}
].
50 changes: 50 additions & 0 deletions config/elvis-test.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[
{
elvis,
[
{config,
[#{dirs => ["../../src"],
filter => "*.erl",
rules => [{elvis_style, line_length, #{limit => 80,
skip_comments => false}},
{elvis_style, no_tabs},
{elvis_style, macro_names},
{elvis_style, macro_module_names},
{elvis_style, operator_spaces, #{rules => [{right, ","},
{right, "++"},
{left, "++"}]}},
{elvis_style, nesting_level, #{level => 3}},
{elvis_style, god_modules, #{limit => 25}},
{elvis_style, no_if_expression},
{elvis_style, invalid_dynamic_call, #{ignore => [elvis]}},
{elvis_style, used_ignored_variable},
{elvis_style, no_behavior_info},
{
elvis_style,
module_naming_convention,
#{regex => "^([a-z][a-z0-9]*_?)*(_SUITE)?$",
ignore => []}
},
{elvis_style, state_record_and_type},
{elvis_style, no_spec_with_records}
]
},
#{dirs => ["."],
filter => "Makefile",
rules => [{elvis_project, no_deps_master_erlang_mk, #{ignore => []}},
{elvis_project, protocol_for_deps_erlang_mk, #{ignore => []}}]
},
#{dirs => ["."],
filter => "rebar.config",
rules => [{elvis_project, no_deps_master_rebar, #{ignore => []}},
{elvis_project, protocol_for_deps_rebar, #{ignore => []}}]
},
#{dirs => ["."],
filter => "elvis.config",
rules => [{elvis_project, old_configuration_format}]
}
]
}
]
}
].
59 changes: 59 additions & 0 deletions config/elvis.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[
{
elvis,
[
{config,
[#{dirs => ["src"],
filter => "*.erl",
rules => [{elvis_style, line_length, #{limit => 80,
skip_comments => false}},
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace},
{elvis_style, macro_names},
{elvis_style, macro_module_names},
{elvis_style, operator_spaces, #{rules => [{right, ","},
{right, "++"},
{left, "++"}]}},
{elvis_style, nesting_level, #{level => 3}},
{elvis_style, god_modules, #{limit => 25}},
{elvis_style, no_if_expression},
{elvis_style, invalid_dynamic_call, #{ignore => [elvis]}},
{elvis_style, used_ignored_variable},
{elvis_style, no_behavior_info},
{
elvis_style,
module_naming_convention,
#{regex => "^([a-z][a-z0-9]*_?)*(_SUITE)?$",
ignore => []}
},
{
elvis_style,
function_naming_convention,
#{regex => "^([a-z][a-z0-9]*_?)*$"}
},
{elvis_style, state_record_and_type},
{elvis_style, no_spec_with_records},
{elvis_style, dont_repeat_yourself, #{min_complexity => 10}},
{elvis_style, no_debug_call, #{ignore => [elvis,
elvis_utils]}}
]
},
#{dirs => ["."],
filter => "Makefile",
rules => [{elvis_project, no_deps_master_erlang_mk, #{ignore => []}},
{elvis_project, protocol_for_deps_erlang_mk, #{ignore => []}}]
},
#{dirs => ["."],
filter => "rebar.config",
rules => [{elvis_project, no_deps_master_rebar, #{ignore => []}},
{elvis_project, protocol_for_deps_rebar, #{ignore => []}}]
},
#{dirs => ["."],
filter => "elvis.config",
rules => [{elvis_project, old_configuration_format}]
}
]
}
]
}
].
48 changes: 48 additions & 0 deletions config/old/elvis-test-rule-config-list.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[
{
elvis,
[
{config,
[#{dirs => ["../../test/examples"],
filter => "*.erl",
rules => [{elvis_style, line_length, [80]},
{elvis_style, no_tabs, []},
{elvis_style, macro_names, []},
{elvis_style, macro_module_names, []},
{elvis_style, operator_spaces, [{right, ","},
{right, "++"},
{left, "++"}]},
{elvis_style, nesting_level, [3]},
{elvis_style, god_modules, [25]},
{elvis_style, no_if_expression, []},
{elvis_style, invalid_dynamic_call, [elvis]},
{elvis_style, used_ignored_variable, []},
{elvis_style, no_behavior_info, []},
{
elvis_style,
module_naming_convention,
["^([a-z][a-z0-9]*_?)*(_SUITE)?$", []]
},
{elvis_style, state_record_and_type, []},
{elvis_style, no_spec_with_records, []}
]
},
#{dirs => ["."],
filter => "Makefile",
rules => [{elvis_project, no_deps_master_erlang_mk, []},
{elvis_project, protocol_for_deps_erlang_mk, []}]
},
#{dirs => ["."],
filter => "rebar.config",
rules => [{elvis_project, no_deps_master_rebar, []},
{elvis_project, protocol_for_deps_rebar, []}]
},
#{dirs => ["."],
filter => "elvis.config",
rules => [{elvis_project, old_configuration_format, []}]
}
]
}
]
}
].
32 changes: 32 additions & 0 deletions config/old/elvis-test.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
elvis,
[
{config,
#{src_dirs => ["../../src"],
rules => [{elvis_style, line_length, [80]},
{elvis_style, no_tabs, []},
{elvis_style, macro_names, []},
{elvis_style, macro_module_names, []},
{elvis_style, operator_spaces, [{right, ","},
{right, "++"},
{left, "++"}]},
{elvis_style, nesting_level, [3]},
{elvis_style, god_modules, [25]},
{elvis_style, no_if_expression, []},
{elvis_style, invalid_dynamic_call, [elvis]},
{elvis_style, used_ignored_variable, []},
{elvis_style, no_behavior_info, []},
{
elvis_style,
module_naming_convention,
["^([a-z][a-z0-9]*_?)*(_SUITE)?$", []]
},
{elvis_style, state_record_and_type, []},
{elvis_style, no_spec_with_records, []}
]
}
}
]
}
].
32 changes: 32 additions & 0 deletions config/old/elvis.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[
{
elvis,
[
{config,
#{src_dirs => ["src"],
rules => [{elvis_style, line_length, [80]},
{elvis_style, no_tabs, []},
{elvis_style, macro_names, []},
{elvis_style, macro_module_names, []},
{elvis_style, operator_spaces, [{right, ","},
{right, "++"},
{left, "++"}]},
{elvis_style, nesting_level, [3]},
{elvis_style, god_modules, [25]},
{elvis_style, no_if_expression, []},
{elvis_style, invalid_dynamic_call, [elvis]},
{elvis_style, used_ignored_variable, []},
{elvis_style, no_behavior_info, []},
{
elvis_style,
module_naming_convention,
["^([a-z][a-z0-9]*_?)*(_SUITE)?$", []]
},
{elvis_style, state_record_and_type, []},
{elvis_style, no_spec_with_records, []}
]
}
}
]
}
].
52 changes: 52 additions & 0 deletions config/test.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[
{
elvis,
[
{config,
[#{dirs => ["../../test/examples"],
filter => "**.erl",
rules => [{elvis_style, line_length, #{limit => 80,
skip_comments => false}},
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace},
{elvis_style, macro_names},
{elvis_style, macro_module_names},
{elvis_style, operator_spaces, #{rules => [{right, ","},
{right, "++"},
{left, "++"}]}},
{elvis_style, nesting_level, #{level => 3}},
{elvis_style, god_modules, #{limit => 25}},
{elvis_style, no_if_expression},
{elvis_style, invalid_dynamic_call, #{ignore => [elvis]}},
{elvis_style, used_ignored_variable},
{elvis_style, no_behavior_info},
{
elvis_style,
module_naming_convention,
#{regex => "^([a-z][a-z0-9]*_?)*(_SUITE)?$",
ignore => []}
},
{elvis_style, state_record_and_type},
{elvis_style, no_spec_with_records}
]
},
#{dirs => ["."],
filter => "Makefile",
rules => [{elvis_project, no_deps_master_erlang_mk, #{ignore => []}},
{elvis_project, protocol_for_deps_erlang_mk, #{ignore => []}}]
},
#{dirs => ["."],
filter => "rebar.config",
rules => [{elvis_project, no_deps_master_rebar, #{ignore => []}},
{elvis_project, protocol_for_deps_rebar, #{ignore => []}}]
},
#{dirs => ["."],
filter => "elvis.config",
rules => [{elvis_project, old_configuration_format}]
}
]
},
{output_format, plain}
]
}
].
Loading

0 comments on commit c5e813e

Please sign in to comment.