Coder Social home page Coder Social logo

Comments (8)

mm318 avatar mm318 commented on August 28, 2024 1

The action is on me to produce a pull request. I will try to get that done by the end of next week.

from ament_lint.

JShep1 avatar JShep1 commented on August 28, 2024

ament_clang_tidy is essentially a wrapped call to clang-tidy so it may be necessary to create a compile_commands.json file in order for extraneous header files to be found and other corrections to be made (see also here).

from ament_lint.

mm318 avatar mm318 commented on August 28, 2024

My current understanding is that even if we do have compile_commands.json present, ament_clang_tidy does not pass the relevant -p option to the underlying clang-tidy.

@dirk-thomas and @JShep1, I propose we enhance ament_clang_tidy --fix-errors to do the following:

  1. Run colcon configure --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON to run the CMake configuration step for generating the relevant compile_commands.json file. (If the configure verb doesn't exist in colcon, we should add it. It will perform a subset of what build currently does.)
  2. ament_clang_tidy --fix-errors will search subdirectories for compile_commands.json and make calls to run-clang-tidy -fix -p <path_to_db>1

1: Why call run-clang-tidy instead of clang-tidy? The clang project provided this script to dedupe fixes to header files, which could be analyzed and otherwise "fixed" multiple times per project.

from ament_lint.

jacobperron avatar jacobperron commented on August 28, 2024

@mm318 I'd discourage using colcon as part of any ament functionality since ament packages should not have to depend on or have knowledge of colcon. Can the compile_commands.json be generated independently for your project? We can likely still improve ament_clang_tidy to accept the compilation database file.

from ament_lint.

mm318 avatar mm318 commented on August 28, 2024

@mm318 I'd discourage using colcon as part of any ament functionality since ament packages should not have to depend on or have knowledge of colcon.

Okay, that's reasonable.

We can likely still improve ament_clang_tidy to accept the compilation database file.

I already have a script that makes clang-tidy use a compilation database file to find lint issues correctly (but it can't fix issues). I can contribute that to ament_clang_tidy.

To use this script currently, I am indeed independently generating the compile_commands.json file for my project through colcon build before running the script.

from ament_lint.

dirk-thomas avatar dirk-thomas commented on August 28, 2024

@mm318 What is the status of this ticket?

from ament_lint.

mm318 avatar mm318 commented on August 28, 2024

The pull request at #213 is ready for review, @JShep1, @jacobperron, and @dirk-thomas.

from ament_lint.

ivanpauno avatar ivanpauno commented on August 28, 2024

Connected PR has been merged, closing

from ament_lint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.