Samsung/Universum

Error when using clang_format analyzer with subfolders

d-cheholia opened this issue · 0 comments

Description

When using universum.analysers.clang_format with source files in subfolders, an error [Errno 2] No such file or directory error occurs

Steps to reproduce

  1. Create .cpp source file in subfolder (for example <root>/src/main.cpp)
    1. Put some code in the file:
      #include <iostream>
      
      int main() 
      {
          std::cout  << "Hello, World!" << std::endl;
          return 0;
      }
  2. Configure .universum file in root folder:
#!/usr/bin/env python3
from universum.configuration_support import Configuration, Step

configs = Configuration(
    [
        Step(
            name="clang-format",
            code_report=True,
            command=[
                "python3",
                "-m",
                "universum.analyzers.clang_format",
                "--executable",
                "clang-format",
                "--files",
                "**/*.cpp",
                "--result-file",
                "${CODE_REPORT_FILE}"
            ],
        ),
    ]
)


if __name__ == "__main__":
    print(configs.dump())
  1. Run universum with the following command:
python3 -m universum run

Expected result

Created <root>/code_report_results/clang-format.json file with formatting problems found.

Actual result

Got an error stderr: [Errno 2] No such file or directory: '/home/dev/projects/code-examples/clang-format/src/main.cpp'

Environment

  • OS: Ubuntu 23.10
  • Python version 3.11
  • Universum version 0.19.19