-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add Credo to Elixir test suite #1769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e65e3da
test: add credo to Elixir tests mix.exs
dottorblaster 895403c
test: add Credo configuration
dottorblaster bb05139
test: add elixir-credo goal to Makefile and Makefile.win
dottorblaster 2a880e1
test: fix Elixir tests with style tips coming from Credo
dottorblaster 26fd081
test: enforce max line length to 90 columns
dottorblaster 0e2a0d8
test: apply 90 columns max length onto the whole Elixir test suite
dottorblaster File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| # 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/"] | ||
| }, | ||
| # | ||
| # 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: [], | ||
| # | ||
| # If you want to enforce a style guide and need a more traditional linting | ||
| # experience, you can change `strict` to `true` below: | ||
| # | ||
| strict: false, | ||
| # | ||
| # 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, false}, | ||
| {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]}, | ||
| # 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). | ||
| # | ||
| {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: :normal, max_length: 90]}, | ||
| {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.VariableNames, []}, | ||
|
|
||
| # | ||
| ## Refactoring Opportunities | ||
| # | ||
| {Credo.Check.Refactor.CondStatements, []}, | ||
| {Credo.Check.Refactor.CyclomaticComplexity, false}, | ||
| {Credo.Check.Refactor.FunctionArity, []}, | ||
| {Credo.Check.Refactor.LongQuoteBlocks, false}, | ||
| {Credo.Check.Refactor.MapInto, []}, | ||
| {Credo.Check.Refactor.MatchInCondition, []}, | ||
| {Credo.Check.Refactor.NegatedConditionsInUnless, []}, | ||
| {Credo.Check.Refactor.NegatedConditionsWithElse, []}, | ||
| {Credo.Check.Refactor.Nesting, false}, | ||
| {Credo.Check.Refactor.PipeChainStart, | ||
| [excluded_argument_types: [:atom, :binary, :fn, :keyword], excluded_functions: []]}, | ||
| {Credo.Check.Refactor.UnlessWithElse, []}, | ||
|
|
||
| # | ||
| ## Warnings | ||
| # | ||
| {Credo.Check.Warning.BoolOperationOnSameValues, []}, | ||
| {Credo.Check.Warning.ExpensiveEmptyEnumCheck, []}, | ||
| {Credo.Check.Warning.IExPry, []}, | ||
| {Credo.Check.Warning.IoInspect, []}, | ||
| {Credo.Check.Warning.LazyLogging, []}, | ||
| {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 remove `, false`) | ||
| # | ||
| {Credo.Check.Consistency.MultiAliasImportRequireUse, false}, | ||
| {Credo.Check.Design.DuplicatedCode, false}, | ||
| {Credo.Check.Readability.Specs, false}, | ||
| {Credo.Check.Refactor.ABCSize, false}, | ||
| {Credo.Check.Refactor.AppendSingleItem, false}, | ||
| {Credo.Check.Refactor.DoubleBooleanNegation, false}, | ||
| {Credo.Check.Refactor.VariableRebinding, false}, | ||
| {Credo.Check.Warning.MapGetUnsafePass, false}, | ||
| {Credo.Check.Warning.UnsafeToAtom, false} | ||
|
|
||
| # | ||
| # Custom checks can be created using `mix credo.gen.check`. | ||
| # | ||
| ] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| # Used by "mix format" | ||
| [ | ||
| inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"], | ||
| line_length: 120, | ||
| line_length: 90, | ||
| rename_deprecated_at: "1.5.0" | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| %{ | ||
| "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm"}, | ||
| "credo": {:hex, :credo, "1.0.0", "aaa40fdd0543a0cf8080e8c5949d8c25f0a24e4fc8c1d83d06c388f5e5e0ea42", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm"}, | ||
| "httpotion": {:hex, :httpotion, "3.1.0", "14d20d9b0ce4e86e253eb91e4af79e469ad949f57a5d23c0a51b2f86559f6589", [:mix], [{:ibrowse, "~> 4.4", [hex: :ibrowse, repo: "hexpm", optional: false]}], "hexpm"}, | ||
| "ibrowse": {:hex, :ibrowse, "4.4.1", "2b7d0637b0f8b9b4182de4bd0f2e826a4da2c9b04898b6e15659ba921a8d6ec2", [:rebar3], [], "hexpm"}, | ||
| "jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"}, | ||
| "jiffy": {:hex, :jiffy, "0.15.2", "de266c390111fd4ea28b9302f0bc3d7472468f3b8e0aceabfbefa26d08cd73b7", [:rebar3], [], "hexpm"}, | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.