Skip to content

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Jan 15, 2025

This PR contains the following updates:

Package Type Update Change
credo (source) dev minor 1.3.1 -> 1.7.14

Release Notes

rrrene/credo (credo)

v1.7.14

Compare Source

  • Fixed regression for DuplicatedCode
  • Expanded Credo.Check.Warning.ExpensiveEmptyEnumCheck to cover less obvious cases
  • New Check: Credo.Check.Warning.StructFieldAmount

v1.7.13

Compare Source

  • Fix compatibility & compiler warnings with Elixir 1.19
  • Credo.Check.Refactor.ABCSize fixed false positive

v1.7.12

Compare Source

  • Fix compatibility & compiler warnings with Elixir 1.19 (dev)
  • Provide :column on all checks
  • Fix check docs in other project's documentation
  • Credo.Check.Refactor.DoubleBooleanNegation fixed false positive
  • Credo.Check.Readability.NestedFunctionCalls fixed false positive
  • Credo.Check.Consistency.UnusedVariableNames fixed duplicate issues

v1.7.11

Compare Source

  • Fix compatibility & compiler warnings with Elixir 1.18
  • Fix crashing for invalid strings in issue messages
  • Show required Elixir version for skipped checks
  • Add options :exit_status and :category to format_issue/2 when using Credo.Check
  • Credo.Check.Readability.ModuleDoc fixed false positive
  • Credo.Check.Warning.UnusedEnumOperation fixed false positive
  • Credo.Check.Refactor.ABCSize fixed false positive for tuples and underscored matches (_foo)

v1.7.10

Compare Source

  • Maintenance release

v1.7.9

Compare Source

  • Credo.Check.Refactor.ABCSize fixed false positive for pin operator (^)
  • Credo.Check.Readability.FunctionNames fixed false positive for pow operator (**)
  • Fixed a bug in Credo.Code.Parameters when couting parameters for functions with guards

v1.7.8

Compare Source

  • Credo.Check.Refactor.Apply fixed false positive
  • Credo.Check.Warning.IoInspect fixed false positive
  • Credo.Check.Warning.UnsafeToAtom fixed false positive
  • Credo.Check.Readability.FunctionNames fixed false positive

v1.7.7

Compare Source

  • Fix compatibility & compiler warnings with Elixir 1.17
  • Credo.Check.Design.SkipTestWithoutComment, Credo.Check.Refactor.PassAsyncInTestCases and Credo.Check.Warning.WrongTestFileExtension now work for umbrella apps

v1.7.6

Compare Source

  • Credo.Check.Consistency.MultiAliasImportRequireUse fixed false positive
  • Credo.Check.Readability.PredicateFunctionNames now ignores functions that implement a behaviour
  • Credo.Check.Readability.FunctionName now supports multi-letter sigils
  • Credo.Check.Readability.Specs fixed false positive
  • Credo.Check.Warning.UnusedKeywordOperation fixed false positive
  • Fix column information on several checks in case there are two offending calls on the same line
  • Fix some deprecation warnings for upcoming Elixir 1.17

v1.7.5

Compare Source

  • Fix --read-from-stdin not respecting :files/:included param
  • Credo.Check.Readability.NestedFunctionCalls no longer crashes for functions with an unquoted name

v1.7.4

Compare Source

  • Add new check Credo.Check.Refactor.UtcNowTruncate as opt-in check (this is scheduled to become a standard check in v1.8)
  • Add lots of improvements around :trigger in Credo.Issue
  • Add new output format short
  • Improve docs for several checks
  • Fix another, smaller bottleneck in multicore performance
  • Fix --read-from-stdin not respecting :files param
  • Fix SARIF output format for non-string triggers
  • Fix initializing builtin commands twice
  • Fix diff command not recognizing a git ref as first argument

v1.7.3

Compare Source

  • Credo.Check.Readability.AliasOrder now supports a :sort_method parameter
  • Credo.Check.Readability.PredicateFunctionNames received fixes
  • Credo.Check.Warning.MissedMetadataKeyInLoggerConfig received fixes

v1.7.2

  • Fix compatibility & compiler warnings with Elixir 1.16
  • Fix a bottleneck in multicore performance
  • Cache scope priorities
  • CHANGELOG.md is now included in the package
  • Credo.Check.Readability.NestedFunctionCalls no longer warns on function calls in interpolated strings
  • Credo.Check.Readability.PredicateFunctionNames fixed false positives
  • Credo.Check.Readability.RedundantBlankLines fixed a bug with double quotes multiline strings
  • Credo.Check.Refactor.ModuleDependencies now takes modules for :excluded_namespaces parameter
  • Credo.Check.Refactor.NegatedIsNil no longer leaks memory
  • Credo.Check.Warning.Dbg now warns when part of a pipeline and called without parens
  • Credo.Check.Warning.MissedMetadataKeyInLoggerConfig received various fixes and improvements

v1.7.1

  • Fixed regression for DuplicatedCode
  • Expanded Credo.Check.Warning.ExpensiveEmptyEnumCheck to cover less obvious cases
  • New Check: Credo.Check.Warning.StructFieldAmount

v1.7.0

Compare Source

  • Credo.Check.Readability.ModuleDoc works for Phoenix 1.7+ views
  • Credo.Check.Readability.FunctionNames now ignores custom operators
  • Credo.Check.Refactor.Apply now works in pipes
  • Credo.Check.Consistency.ExceptionNames does no longer yield an issue if there is only one match
  • Credo.Check.Readability.ModuleNames now supports an :ignore parameter
  • Credo.Check.Design.AliasUsage now supports an :if_referenced parameter
  • Credo.Check.Readability.FunctionNames now works for acronyms in predicate functions
  • Credo.Check.Readability.NestedFunctionCalls now works for calls already in a pipeline and local function calls
Add SARIF support

Credo 1.7 provides a formatter that will output data in SARIF format, allowing direct GitHub support via the Security tab.

You can now use mix credo --format=sarif to output results in SARIF format.

Add IDs to checks

This was requested for SARIF support and has been added to provide a unique identifier for checks that is more technical than the check name.

Check authors can add IDs to their custom checks by using the :id option:

defmodule MyCheck do
  use Credo.Check,
    id: "EX5042",
    category: :warning,

...

end

Credo's naming scheme for these IDs is simple:

EX5042
^^

EX stands for Elixir.

EX5042
  ^

The first digit represents the category.

EX5042
   ^

The second digit is always 0 for Credo's standard checks (see below).

EX5042
    ^^

The last two digits are the incremental number of the check.

This means that you can extend Credo with

  • up to 99 categories,
  • up to 999 checks per category or
  • use the second digit for something completely different

all while adhering to Credo's own scheme (and of course, you can simply invent a completely different naming scheme for your checks).

Allow passing of multiple files to Mix task

It is now possible to pass a list of files to mix credo.

mix credo lib/foo.ex lib/foo/bar.ex lib/foo/baz.ex

This means that you can now use the output of commands to determine which files to analyse, e.g.:

mix credo $(git diff --name-only)
Ensure stable ordering of analysis results

Continuing our quest to remove ambiguity and reduce undocumented behaviour, Credo now orders its results by default.

Credo's results always had one caveat: Their order was determined by the runtime behaviour of the checks and workers running the checks (it was up to the output mechanism to provide its own stable order).

Now, results are always sorted by check ID, filename and line number.

New checks
  • Credo.Check.Readability.OneArityFunctionInPipe
  • Credo.Check.Readability.OnePipePerLine
  • Credo.Check.Refactor.FilterCount
  • Credo.Check.Refactor.PassAsyncInTestCases
  • Credo.Check.Warning.MissedMetadataKeyInLoggerConfig

v1.6.7

Compare Source

  • Improve compatibility with Elixir 1.14 (based on v1.14.0-rc.1)

v1.6.6

Compare Source

  • Fix error when analysing single-line modules
  • Fix false positive for Credo.Check.Readability.SpaceAroundOperators
  • Fix false positive for Credo.Check.Warning.UnusedStringOperation
  • Fix bug in Credo.Code.Scope.mod_name/1

v1.6.5

Compare Source

  • Include the 'only_greater_than' value in the Credo.Check.Readability.LargeNumbers message
  • Ignore Phoenix.LiveView modules by default
  • Fix for false positive in Credo.Check.Refactor.Apply
  • Fix for false positive in Credo.Check.Refactor.NegatedIsNil
  • Fix for false positive in Credo.Check.Readability.WithSingleClause

v1.6.4

Compare Source

  • Fix for false positive in Credo.Check.Readability.MaxLineLength
  • Fix a bug in Credo.Check.Refactor.PipeChainStart
  • Fix error message in gen.check command

v1.6.3

Compare Source

  • The HTML report generated by --debug now includes slowest files, checks and file/check combinations
  • Fix for false positive in Credo.Check.Consistency.UnusedVariableNames
  • Fix for false positive in Credo.Check.Readability.SpaceAfterCommas
  • Fix a bug in Credo.Check.Warning.ForbiddenModule
  • Fix a bug in Credo.Check.Warning.MixEnv
  • Credo.Check.Readability.LargeNumbers now supports :trailing_digits

v1.6.2

Compare Source

  • Bug fixes
  • Add -i as shorthand for --ignore

v1.6.1

Compare Source

  • Improve compatibility with Elixir 1.13 (based on v1.13.0-rc.1)

v1.6.0

Compare Source

First Run Mode

Credo 1.6 features a new mode, designed to be run every time you introduce Credo to an existing codebase.

mix credo --first-run

This offers a couple of suggestions on how to introduce Credo to your workflow/CI.

All of these suggestions are contextualized and project-specific, here's an example when running it on Credo's codebase:

-------------------------------------- 8< --------------------------------------

# Where to start?

That's a lot of issues to deal with at once.

While not recommended, you could simply start ignoring issues for the time being:

    mix credo --ignore readability      # exclude checks matching a given phrase

You can use `diff` to only show the issues that were introduced on this branch:

    mix credo diff master

## Compare to a point in history

Alternatively, you can use `diff` to only show the issues that were introduced after
a certain tag or commit:

    mix credo diff v1.5.6               # use the latest tag

    mix credo diff e0d84ba9             # use the current HEAD of master

Lastly, you can compare your working dir against this point in time:

    mix credo diff --since 2021-08-28   # use the current date

## Every project is different

Introducing code analysis to an existing codebase should not be about following any
"best practice" in particular, it should be about helping you to get to know the ropes
and make the changes you want.

Try the options outlined above to see which one is working for this project!
New Diff Options

mix credo diff is often used when developing on a branch and comparing that branch with a base branch.

Let's illustrate this with the following example:

(feature-a)                        J---K---L
                                  /         \
(master)          base---A---B---C---D---E---F
                              \
(current branch)               X---Y---Z
  • mix credo diff --from-git-ref master (same as mix credo diff master) - this will compare the current branch to the current state of the given ref (commit F in the example above)
  • mix credo diff --from-git-merge-base master - this will compare the current branch to the point where the current branch was branched off of the given ref (commit B in the example above)

There is also --from-dir which you can use to compare the current dir to another dir, thus decoupling the diff command from Git, e.g. mix credo diff --from-dir ../credo_v1_5_6

Pinning Checks in a Project's Config

Credo's config always had one caveat: Your configuration settings are merged with the default config, without you having any chance of knowing what the default config is (except by generating a fresh one via mix credo.gen.config).

%{
  configs: [
    %{
      name: "default",
      checks: [

this configures LargeNumbers and all default checks are still enabled

        {Credo.Check.Readability.LargeNumbers, only_greater_than: 99_999}
      ]
    }
  ]
}

This adds an additional problem: When checks are added to the default config, they are also added for you, because there is no way to explicitly say, which checks should run.

Credo 1.6 adds this option to explicitly say which checks are enabled on your project by changing the :checks key in the config from a List to a Map with an :enabled key:

%{
  configs: [
    %{
      name: "default",
      checks: %{
        enabled: [

this means that only LargeNumbers will run for this project

          {Credo.Check.Readability.LargeNumbers, only_greater_than: 99_999}
        ]
      }
    }
  ]
}

You can now go the other way as well and disable checks explicitly while keeping their params instead of replacing them with false:

%{
  configs: [
    %{
      name: "default",
      checks: %{
        disabled: [

this means that LargeNumbers is disabled for this project

          {Credo.Check.Readability.LargeNumbers, only_greater_than: 99_999}
        ]
      }
    }
  ]
}

This has the added benefit that, when re-enabled via --enable-disabled-checks, the check is enabled with its customized params.

Credo configs are transitive in nature, so what about a situation where you want to pin checks for an umbrella, but overwrite individual checks in a child app? You can use the :extra option:

my_umbrella/.credo.exs

%{
  configs: [
    %{
      name: "default",
      checks: %{
        enabled: [
          {Credo.Check.Readability.LargeNumbers, []}
        ]
      }
    }
  ]
}

my_umbrella/apps/my_app2/.credo.exs

%{
  configs: [
    %{
      name: "default",
      checks: %{
        extra: [

this means that the checks config from the parent applies,

only LargeNumbers being configured differently for this project

          {Credo.Check.Readability.LargeNumbers, only_greater_than: 99_999}
        ]
      }
    }
  ]
}

Of course, the "old" way of specifying a list of checks still works.

Exit Status

Before Credo 1.6 it was unclear which exit status "ranges" where intended for which kind of error.
For example, we are not enforcing the ranges for issue errors or plugin errors, but this change gives an official guideline to these considerations.

Working Directory

Up until now, Credo provided the ability to analyse files and directories anywhere on disk by simply typing

# BEFORE (now deprecated):
mix credo ../other-elixir-project/

This was not really documented and not really supported very well, resulting in most people not really utilizing it and instead running Credo from the root of their project using mix credo.

Now there is --working-dir, which allows users to define their working directory explicitly:

mix credo --working-dir ../other-elixir-project/
New checks
  • Credo.Check.Design.SkipTestWithoutComment
  • Credo.Check.Readability.PipeIntoAnonymousFunctions
  • Credo.Check.Readability.SingleFunctionToBlockPipe
  • Credo.Check.Refactor.Apply
  • Credo.Check.Refactor.IoPuts
  • Credo.Check.Refactor.MapJoin
  • Credo.Check.Refactor.RedundantWithClauseResult

v1.5.6

Compare Source

  • Ensure compatibility with Elixir 1.12

v1.5.5

Compare Source

  • Fix bug where compilation warnings are shown if compilation directory is not part of a Git work tree
  • Fix bug in mix credo diff where too many issues are reported because

v1.5.4

Compare Source

  • Fix bug where :exit_status was not a valid option for use Credo.Check
  • Fix bug where mix credo diff exited with a non-zero exit status even if no issues were shown
  • mix credo diff now fails with an error if the given ref was not found

v1.5.3

Compare Source

  • Fix bug in diff and version command when git is not installed

v1.5.2

Compare Source

  • Fix output bug in diff command
  • Fix bug in diff command when run on a Git ref that does not contain a given --config-name
  • Fix bug in all commands when a given --config-name is not found
  • Fix false positive in Credo.Check.Warning.ExpensiveEmptyEnumCheck
  • Fix false positive in Credo.Check.Refactor.PipeChainStart regarding custom operators
  • Fix --version to include pre version and build info for unpublished versions (e.g. when the dep is included via path: or github:)

v1.5.1

Compare Source

  • Fix bug in diff command when run on a subdirectory of a Git repository
  • Fix bug in new general param :files when excluding files

v1.5.0

Compare Source

  • Credo now requires Elixir 1.7 or newer
  • Refactor check runner (much faster now for common scenarios)
  • Add param allow_acronyms to check Credo.Check.Readability.FunctionNames
  • Add name of check to message when printing issues with --verbose
  • Add support for "dynamic" tagging for checks via .credo.exs

Overwrite all tags for FooCheck

  {FooCheck, [tags: [:my_tag]]}

Add tags for FooCheck

  {SomeCredoCheck, [tags: [:__initial__, :my_tag]]}

Tags can then be used as usual, via the CLI switch --checks-with[out]-tag:

Only run checks tagged :my_tag during analysis

  $ mix credo --checks-with-tag my_tag

Exclude all checks tagged :my_tag from analysis

  $ mix credo --checks-without-tag my_tag
New switch to enable file watcher

You can now ask Credo to re-run on file changes:

  $ mix credo --watch
New diff command

You can now ask Credo to only report changes in files that were changed since a given Git ref:

  $ mix credo diff HEAD^
  $ mix credo diff master

You can, of course, combine this with the new --watch switch to iteratively fix issues that have come up since the last release:

  $ mix credo diff v1.4.0 --watch
New general check param :files

You can now include/exclude specific files or patterns for specific checks.

The syntax is the same as for the top-level :files key:

# check included for Elixir files in lib/ only
{Credo.Check.Consistency.ExceptionNames, files: %{included: ["lib/**/*.ex"]}},

# check excluded for a specific file
{Credo.Check.Warning.IExPry, files: %{excluded: ["lib/debug_server.ex"]}},

# check included for all Elixir script files, but excluded for test scripts
{Credo.Check.Warning.IoInspect, files: %{included: ["**/*.exs"], excluded: ["**/*_test.exs"]}},

This means that you can now also include/exclude specific files or patterns for your custom checks by default.

The syntax is the same as with all other check params:

defmodule MyApp.Check.SomethingAboutTests do
  use Credo.Check,
    base_priority: :normal,
    explanations: [
      check: """
      ...
      """
    ],
    param_defaults: [
      files: %{included: ["**/*_test.exs"]}
    ]

Please note that these params do not "override" the top-level config, but are applied to the result of the top-level config's resolution.

New checks

These new checks can now be enabled:

  • Credo.Check.Readability.BlockPipe
  • Credo.Check.Readability.ImplTrue
  • Credo.Check.Readability.SeparateAliasRequire

Additionally, Credo.Check.Warning.ApplicationConfigInModuleAttribute is a new check which warns about reading environment variables into module attributes at compile-time and is enabled by default.

v1.4.1

Compare Source

  • Ensure compatibility with Elixir 1.11.0

v1.4.0

Compare Source

  • Credo's schema for pre-release names changes: There is now a . after the rc like in many other Elixir projects.

  • Add support for explaining checks (in addition to issues), i.e.

    $ mix credo explain Credo.Check.Design.AliasUsage
    
  • Add support for tags on checks

    Checks can now declare tags via the __using__ macro, i.e.

    defmodule MyCheck do
      use Credo.Check, tags: [:foo]
    
      def run(%SourceFile{} = source_file, params) do
        #
      end
    end
    

    Tags can be used via the CLI switch --checks-with[out]-tag:

Only run checks tagged :foo during analysis

  $ mix credo --checks-with-tag foo

Exclude all checks tagged :foo from analysis

  $ mix credo --checks-without-tag foo
  • Add validation of check params in config

    If a param is not found, Credo checks for mispellings and suggests corrections:

    $ mix credo
    ** (config) Credo.Check.Design.AliasUsage: unknown param `fi_called_more_often_than`. Did you mean `if_called_more_often_than`?
    
  • Add auto-generated check docs

  • Add new documentation on Hex with extra guides and CHANGELOG

v1.3.2

Compare Source

  • Support non-ascii characters in variable names
  • Fix false positive in Credo.Check.Readability.ParenthesesOnZeroArityDefs

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot force-pushed the renovate/credo-1.x-lockfile branch from 3f4115f to 0add5ea Compare April 17, 2025 07:29
@renovate renovate bot changed the title chore(deps): update dependency credo to v1.7.11 chore(deps): update dependency credo to v1.7.12 Apr 17, 2025
@renovate renovate bot force-pushed the renovate/credo-1.x-lockfile branch from 0add5ea to a52028b Compare October 15, 2025 05:26
@renovate renovate bot changed the title chore(deps): update dependency credo to v1.7.12 chore(deps): update dependency credo to v1.7.13 Oct 15, 2025
@renovate renovate bot force-pushed the renovate/credo-1.x-lockfile branch from a52028b to 8147901 Compare December 1, 2025 19:54
@renovate renovate bot changed the title chore(deps): update dependency credo to v1.7.13 chore(deps): update dependency credo to v1.7.14 Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant