Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(clang_format_analyzer): create parent folders for target file #838

Conversation

d-cheholia
Copy link
Contributor

Description

Resolves #837

Added creation of directories before opening a file in universum/analyzers/clang_format.py:43

Checklist:

  • My code follows the PEP 8
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules



@pytest.mark.parametrize('analyzer, extra_args, tested_content', [
['clang_format', ["--report-html"], source_code_c],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are not checking html file after running clang_format, so you don't need to add the --report-html parameter.
BTW, the html generation is already checked in another test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, fixed


log = runner_with_analyzers.run(ConfigData().add_analyzer(analyzer, args, extra_config).finalize())
assert not re.findall(r'No such file or directory', log), f"'No such file or directory' is found in '{log}'"
assert re.findall(log_fail, log), f"'{log_success}' is not found in '{log}'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assert message doesn't match the assert condition. Please fix the message or the condition.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -405,3 +405,29 @@ def test_code_report_extended_arg_search_embedded(tmp_path: pathlib.Path, stdout

env.run()
stdout_checker.assert_absent_calls_with_param("${CODE_REPORT_FILE}")


@pytest.mark.parametrize('analyzer, extra_args, tested_content', [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now you don't need to parametrize the test, because you only have one set of parameter values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, removed

@i-keliukh i-keliukh merged commit f6abf90 into Samsung:master Feb 5, 2024
1 check passed
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.

Error when using clang_format analyzer with subfolders
2 participants