Skip to content

Commit

Permalink
Add a custom Credo configuration file
Browse files Browse the repository at this point in the history
This is based on Ecto's configuration and tweaks a number of defaults
rules to be more lenient than the stock configuration.
  • Loading branch information
jparise committed Dec 23, 2016
1 parent 164d8d6 commit e10836a
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 8 deletions.
64 changes: 64 additions & 0 deletions .credo.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
%{configs: [
%{name: "default",
files: %{
included: ["lib/", "test/"],
excluded: ["_build/", "deps/", "ext/"]
},
requires: [],
check_for_updates: false,

# 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: [
{Credo.Check.Consistency.ExceptionNames},
{Credo.Check.Consistency.LineEndings},
{Credo.Check.Consistency.SpaceAroundOperators},
{Credo.Check.Consistency.SpaceInParentheses},
{Credo.Check.Consistency.TabsOrSpaces},

{Credo.Check.Design.AliasUsage, false},
{Credo.Check.Design.DuplicatedCode, excluded_macros: []},

{Credo.Check.Readability.FunctionNames},
{Credo.Check.Readability.LargeNumbers, false},
{Credo.Check.Readability.MaxLineLength, false},
{Credo.Check.Readability.ModuleAttributeNames},
{Credo.Check.Readability.ModuleNames},
{Credo.Check.Readability.ParenthesesInCondition},
{Credo.Check.Readability.PredicateFunctionNames},
{Credo.Check.Readability.TrailingBlankLine},
{Credo.Check.Readability.TrailingWhiteSpace},
{Credo.Check.Readability.VariableNames},
{Credo.Check.Readability.RedundantBlankLines},

{Credo.Check.Refactor.ABCSize, false},
{Credo.Check.Refactor.CondStatements},
{Credo.Check.Refactor.MatchInCondition},
{Credo.Check.Refactor.PipeChainStart, false},
{Credo.Check.Refactor.CyclomaticComplexity},
{Credo.Check.Refactor.NegatedConditionsInUnless},
{Credo.Check.Refactor.NegatedConditionsWithElse},
{Credo.Check.Refactor.Nesting},
{Credo.Check.Refactor.UnlessWithElse},

{Credo.Check.Warning.IExPry},
{Credo.Check.Warning.IoInspect, false},
{Credo.Check.Warning.NameRedeclarationByAssignment, false},
{Credo.Check.Warning.NameRedeclarationByCase, false},
{Credo.Check.Warning.NameRedeclarationByDef, false},
{Credo.Check.Warning.NameRedeclarationByFn, false},
{Credo.Check.Warning.BoolOperationOnSameValues},
{Credo.Check.Warning.UnusedEnumOperation},
{Credo.Check.Warning.UnusedKeywordOperation},
{Credo.Check.Warning.UnusedListOperation},
{Credo.Check.Warning.UnusedStringOperation},
{Credo.Check.Warning.UnusedTupleOperation},
{Credo.Check.Warning.OperationWithConstantResult},
]
}
]}
6 changes: 3 additions & 3 deletions .ebert.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
styleguide: false
engines:
credo:
enabled: true
fixme:
enabled: true
remark-lint:
enabled: true
exclude_paths:
- ci
- doc
- ext
- test
3 changes: 0 additions & 3 deletions test/parser_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ defmodule ParserTest do
constant = "const set<string> SET_CONST = {\"hello\", \"bye\"}"
|> parse([:constants, :SET_CONST])


assert constant == %Constant{name: :SET_CONST,
value: MapSet.new(["hello", "bye"]),
type: {:set, :string}}
Expand All @@ -159,7 +158,6 @@ defmodule ParserTest do
constant = "const map<string, i32> MAP_CONST = {\"hello\": 1, \"world\": 2};"
|> parse([:constants, :MAP_CONST])


assert constant == %Constant{name: :MAP_CONST,
value: %{"world" => 2, "hello" => 1},
type: {:map, {:string, :i32}}}
Expand Down Expand Up @@ -407,7 +405,6 @@ defmodule ParserTest do
"""
|> parse([:services, :MyService])


assert service == %Service{
name: :MyService,
functions: %{hi: %Function{name: :hi, return_type: :void, params: []}}
Expand Down
2 changes: 0 additions & 2 deletions test/test_helper.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
ExUnit.start()


defmodule ThriftTestHelpers do
@root_dir "test/fixtures/thrift/"

Expand All @@ -15,7 +14,6 @@ defmodule ThriftTestHelpers do
file_relative_path = file_name
|> Atom.to_string


file_path = Path.join(base_dir, file_relative_path)

file_path
Expand Down

0 comments on commit e10836a

Please sign in to comment.