Skip to content

Adding file exclusions to a single check causes a hang #1195

@tomtaylor

Description

@tomtaylor

I'm rolling out a custom check slowly and have 68 files to exclude from it initially.

The check works fine without exclusions:

> mix credo suggest -C ci
Checking 1595 source files (this might take a while) ...

[snip]

Please report incorrect results: https://github.com/rrrene/credo/issues

Analysis took 0.9 seconds (0.4s to load, 0.5s running 35 checks on 1595 files)
12514 mods/funs, found 250 warnings.

Use `mix credo explain` to explain issues, `mix credo --help` for options.

But when I add the 68 file exclusions to my custom check it seems to become unresponsive and I have to kill BEAM:

%{
  configs: [
    %{
      name: "ci",
      files: %{
        included: [
          "lib/",
          "test/"
        ]
      },
      requires: ["lib/checks/"],
      strict: true,
      parse_timeout: 5000,
      color: false,
      checks: [
        {Credo.Check.Design.TagFIXME, []},
        {Credo.Check.Readability.AliasOrder, []},
        {Credo.Check.Readability.FunctionNames, []},
        {Credo.Check.Readability.ModuleAttributeNames, []},
        {Credo.Check.Readability.MultiAlias, []},
        {Credo.Check.Readability.RedundantBlankLines, []},
        {Credo.Check.Readability.Semicolons, []},
        {Credo.Check.Readability.SeparateAliasRequire, []},
        {Credo.Check.Readability.VariableNames, []},
        {Credo.Check.Warning.ApplicationConfigInModuleAttribute, []},
        {Credo.Check.Warning.BoolOperationOnSameValues, []},
        {Credo.Check.Warning.Dbg, []},
        {Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
        {Credo.Check.Warning.ForbiddenModule, []},
        {Credo.Check.Warning.IExPry, []},
        {Credo.Check.Warning.IoInspect, []},
        {Credo.Check.Warning.LeakyEnvironment, []},
        {Credo.Check.Warning.MapGetUnsafePass, []},
        {Credo.Check.Warning.MixEnv, []},
        {Credo.Check.Warning.OperationOnSameValues, []},
        {Credo.Check.Warning.OperationWithConstantResult, []},
        {Credo.Check.Warning.RaiseInsideRescue, []},
        {Credo.Check.Warning.SpecWithStruct, []},
        {Credo.Check.Warning.UnsafeExec, []},
        {Credo.Check.Warning.UnsafeToAtom, []},
        {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, []},
        {Credo.Check.Warning.WrongTestFileExtension, []},
        {Checks.ExampleCheck,
         files: %{
           excluded: [
             "lib/foo.ex", ...
           ]
         }}
      ]
    }
  ]
}

If I set excluded to an empty list it works fine again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions