|
| 1 | +alias Credo.Check |
| 2 | + |
| 3 | +%{ |
| 4 | + configs: [ |
| 5 | + %{ |
| 6 | + name: "default", |
| 7 | + files: %{ |
| 8 | + included: [ |
| 9 | + "lib/", |
| 10 | + "src/", |
| 11 | + "test/", |
| 12 | + "web/", |
| 13 | + "apps/*/lib/", |
| 14 | + "apps/*/src/", |
| 15 | + "apps/*/test/", |
| 16 | + "apps/*/web/" |
| 17 | + ], |
| 18 | + excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"] |
| 19 | + }, |
| 20 | + plugins: [], |
| 21 | + requires: [], |
| 22 | + strict: true, |
| 23 | + parse_timeout: 5000, |
| 24 | + color: true, |
| 25 | + checks: %{ |
| 26 | + enabled: [ |
| 27 | + ## Consistency Checks ------------------------------------------------ |
| 28 | + {Check.Consistency.ExceptionNames, []}, |
| 29 | + {Check.Consistency.LineEndings, []}, |
| 30 | + {Check.Consistency.ParameterPatternMatching, []}, |
| 31 | + {Check.Consistency.SpaceAroundOperators, []}, |
| 32 | + {Check.Consistency.SpaceInParentheses, []}, |
| 33 | + {Check.Consistency.TabsOrSpaces, []}, |
| 34 | + |
| 35 | + ## Design Checks ----------------------------------------------------- |
| 36 | + {Check.Design.AliasUsage, if_nested_deeper_than: 2}, |
| 37 | + |
| 38 | + ## Readability Checks ------------------------------------------------ |
| 39 | + {Check.Readability.AliasOrder, []}, |
| 40 | + {Check.Readability.FunctionNames, []}, |
| 41 | + {Check.Readability.LargeNumbers, []}, |
| 42 | + {Check.Readability.MaxLineLength, priority: :low, max_length: 120}, |
| 43 | + {Check.Readability.ModuleAttributeNames, []}, |
| 44 | + {Check.Readability.ModuleDoc, []}, |
| 45 | + {Check.Readability.ModuleNames, []}, |
| 46 | + {Check.Readability.ParenthesesInCondition, []}, |
| 47 | + {Check.Readability.ParenthesesOnZeroArityDefs, []}, |
| 48 | + {Check.Readability.PipeIntoAnonymousFunctions, []}, |
| 49 | + {Check.Readability.PredicateFunctionNames, []}, |
| 50 | + {Check.Readability.PreferImplicitTry, []}, |
| 51 | + {Check.Readability.RedundantBlankLines, []}, |
| 52 | + {Check.Readability.Semicolons, []}, |
| 53 | + {Check.Readability.SpaceAfterCommas, []}, |
| 54 | + {Check.Readability.StringSigils, []}, |
| 55 | + {Check.Readability.TrailingBlankLine, []}, |
| 56 | + {Check.Readability.TrailingWhiteSpace, []}, |
| 57 | + {Check.Readability.UnnecessaryAliasExpansion, []}, |
| 58 | + {Check.Readability.VariableNames, []}, |
| 59 | + {Check.Readability.WithSingleClause, []}, |
| 60 | + |
| 61 | + ## Refactoring Opportunities ----------------------------------------- |
| 62 | + {Check.Refactor.Apply, []}, |
| 63 | + {Check.Refactor.CondStatements, []}, |
| 64 | + {Check.Refactor.CyclomaticComplexity, []}, |
| 65 | + {Check.Refactor.FunctionArity, []}, |
| 66 | + {Check.Refactor.LongQuoteBlocks, []}, |
| 67 | + {Check.Refactor.MatchInCondition, []}, |
| 68 | + {Check.Refactor.MapJoin, []}, |
| 69 | + {Check.Refactor.NegatedConditionsInUnless, []}, |
| 70 | + {Check.Refactor.NegatedConditionsWithElse, []}, |
| 71 | + {Check.Refactor.Nesting, []}, |
| 72 | + {Check.Refactor.UnlessWithElse, []}, |
| 73 | + {Check.Refactor.WithClauses, []}, |
| 74 | + {Check.Refactor.FilterFilter, []}, |
| 75 | + {Check.Refactor.RejectReject, []}, |
| 76 | + {Check.Refactor.RedundantWithClauseResult, []}, |
| 77 | + |
| 78 | + ## Warnings ---------------------------------------------------------- |
| 79 | + {Check.Warning.ApplicationConfigInModuleAttribute, []}, |
| 80 | + {Check.Warning.BoolOperationOnSameValues, []}, |
| 81 | + {Check.Warning.ExpensiveEmptyEnumCheck, []}, |
| 82 | + {Check.Warning.IExPry, []}, |
| 83 | + {Check.Warning.IoInspect, []}, |
| 84 | + {Check.Warning.OperationOnSameValues, []}, |
| 85 | + {Check.Warning.OperationWithConstantResult, []}, |
| 86 | + {Check.Warning.RaiseInsideRescue, []}, |
| 87 | + {Check.Warning.SpecWithStruct, []}, |
| 88 | + {Check.Warning.WrongTestFileExtension, []}, |
| 89 | + {Check.Warning.UnusedEnumOperation, []}, |
| 90 | + {Check.Warning.UnusedFileOperation, []}, |
| 91 | + {Check.Warning.UnusedKeywordOperation, []}, |
| 92 | + {Check.Warning.UnusedListOperation, []}, |
| 93 | + {Check.Warning.UnusedPathOperation, []}, |
| 94 | + {Check.Warning.UnusedRegexOperation, []}, |
| 95 | + {Check.Warning.UnusedStringOperation, []}, |
| 96 | + {Check.Warning.UnusedTupleOperation, []}, |
| 97 | + {Check.Warning.UnsafeExec, []}, |
| 98 | + |
| 99 | + ## Checks which should always be on for consistency-sake IMO --------- |
| 100 | + {Check.Consistency.MultiAliasImportRequireUse, []}, |
| 101 | + {Check.Consistency.UnusedVariableNames, force: :meaningful}, |
| 102 | + {Check.Design.DuplicatedCode, []}, |
| 103 | + {Check.Design.SkipTestWithoutComment, []}, |
| 104 | + {Check.Readability.ImplTrue, []}, |
| 105 | + {Check.Readability.MultiAlias, []}, |
| 106 | + {Check.Readability.NestedFunctionCalls, []}, |
| 107 | + {Check.Readability.SeparateAliasRequire, []}, |
| 108 | + {Check.Readability.SingleFunctionToBlockPipe, []}, |
| 109 | + {Check.Readability.SinglePipe, []}, |
| 110 | + {Check.Readability.StrictModuleLayout, []}, |
| 111 | + {Check.Readability.WithCustomTaggedTuple, []}, |
| 112 | + {Check.Refactor.ABCSize, [max_size: 50]}, |
| 113 | + {Check.Refactor.AppendSingleItem, []}, |
| 114 | + {Check.Refactor.DoubleBooleanNegation, []}, |
| 115 | + {Check.Refactor.FilterReject, []}, |
| 116 | + {Check.Refactor.MapMap, []}, |
| 117 | + {Check.Refactor.NegatedIsNil, []}, |
| 118 | + {Check.Refactor.PipeChainStart, []}, |
| 119 | + {Check.Refactor.RejectFilter, []}, |
| 120 | + {Check.Refactor.VariableRebinding, []}, |
| 121 | + {Check.Warning.LeakyEnvironment, []}, |
| 122 | + {Check.Warning.MapGetUnsafePass, []}, |
| 123 | + {Check.Warning.MixEnv, []}, |
| 124 | + {Check.Warning.UnsafeToAtom, []}, |
| 125 | + |
| 126 | + ## Causes Issues with Phoenix ---------------------------------------- |
| 127 | + {Check.Readability.Specs, []}, |
| 128 | + {Check.Readability.AliasAs, []}, |
| 129 | + {Check.Refactor.ModuleDependencies, []}, |
| 130 | + |
| 131 | + ## Optional (move to `disabled` based on app domain) ----------------- |
| 132 | + {Check.Refactor.IoPuts, []} |
| 133 | + ], |
| 134 | + disabled: [ |
| 135 | + ## Checks which are overly limiting ---------------------------------- |
| 136 | + {Check.Design.TagTODO, exit_status: 2}, |
| 137 | + {Check.Design.TagFIXME, []}, |
| 138 | + {Check.Readability.BlockPipe, []}, |
| 139 | + |
| 140 | + ## Incompatible with modern versions of Elixir ----------------------- |
| 141 | + {Check.Refactor.MapInto, []}, |
| 142 | + {Check.Warning.LazyLogging, []} |
| 143 | + ] |
| 144 | + } |
| 145 | + } |
| 146 | + ] |
| 147 | +} |
0 commit comments