florianschanda/miss_hit

Non-existent directory listed under `exclude_dir` directive in config file causes miss_hit to error out

Closed this issue · 3 comments

MISS_HIT Component affected

  • Style checker
  • Code metrics

MISS_HIT version: 0.9.43

Your operating system and Python version

  • Windows
  • State output of python3 --version: Python 3.12.4

Describe the bug
If a directory is excluded in the config file via the exclude_dir directive, mh_style and mh_metric error out if that directory does not exist. This is a problem for our CI setup. In our miss_hit.cfg, we use the exclude_dir directive to ignore the contents of the works folder, which contains auto-generated code. This folder is also listed in our .gitignore, and is therefore not part of our project. Running mh_style on our individual development machines works fine, and the contents of the works folder are ignored for analysis. However, running mh_style on our CI machine causes it to error out every time, since the works folder is not present on a fresh checkout of the project repository.

If miss_hit cannot find a directory listed in miss_hit.cfg, it should simply continue and not exit with a non-zero exit code. If it must, it can print a warning, but I don't think that's necessary - after all git doesn't print a warning if it can't find a directory/file listed in .gitignore.

Double check but I think there is now an alternative config option for that use case.

See 5baaa4d

Excellent, thanks! For future reference, use ignore_dir instead of exclude_dir.

Thanks for closing this, I forgot to write here and do it myself ;)