Skip to content

Fix duplicate include error if clang-tidy helper file already exists #423

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

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

fktn-k
Copy link
Owner

@fktn-k fktn-k commented Nov 13, 2024

The current utility tool for clang-tidy just appends #include lines without checking the existence of its resulting helper file. That causes a number of errors like this:

/home/fktn/github/fkYAML/build_clang_tidy/tool/clang_tidy/clang_tidy_helper.cpp:48:1: error: duplicate include [readability-duplicate-include,-warnings-as-errors]
   47 | int main() { return 0; }
      |
   48 | #include <fkYAML/detail/assert.hpp> // NOLINT(misc-include-cleaner)

The tool now clears the file contents first by overwriting it with an empty string so the resulting file always have one #include directive for each library header file.


Pull Request Checklist

Read the CONTRIBUTING.md file for detailed information.

  • Changes are described in the pull request or in a referenced issue.
  • The test suite compiles and runs without any error.
  • The code coverage on your branch is 100%.
  • The documentation is updated if you added/changed a feature.

Please don't

  • The C++11 support varies between different compilers and versions. Please note the list of supported compilers. Some compilers like GCC 4.7 (and earlier), Clang 3.3 (and earlier), or Microsoft Visual Studio 13.0 and earlier are known not to work due to missing or incomplete C++11 support. Please refrain from proposing changes that work around these compiler's limitations with #ifdefs or other means.
  • Please refrain from proposing changes that would break YAML specifications. If you propose a conformant extension of YAML to be supported by the library, please motivate this extension.
  • Please do not open pull requests that address multiple issues.

@fktn-k fktn-k added the ci related to CI jobs label Nov 13, 2024
@fktn-k fktn-k added this to the Release v0.3.14 milestone Nov 13, 2024
@fktn-k fktn-k self-assigned this Nov 13, 2024
@fktn-k fktn-k merged commit f121341 into develop Nov 13, 2024
93 checks passed
@fktn-k fktn-k deleted the fix_tool_bug_for_clang_tidy branch November 13, 2024 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci related to CI jobs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant