Coder Social home page Coder Social logo

Comments (4)

dirk-thomas avatar dirk-thomas commented on July 24, 2024

I don't think the proposed approach:

Adding and EXCLUDE option in ament_lint_auto_find_test_dependencies could make the code above cleaner: e.g.

would work. The ament_lint_auto extension point is being triggered when ament_package() is called and if that call happens after the above snippet it would still trigger all linters previous being found (independently from how they are found - by ament_lint_auto_find_test_dependencies or an explicit call to find_package).

If this feature were implemented, would it be accepted?

Sure.

from ament_lint.

jpsamper2009 avatar jpsamper2009 commented on July 24, 2024

@dirk-thomas Thanks for the quick response!

Re:

The ament_lint_auto extension point is being triggered when ament_package() is called and if that call happens after the above snippet it would still trigger all linters previous being found (independently from how they are found - by ament_lint_auto_find_test_dependencies or an explicit call to find_package).

So we would need to find a way to determine if a package was found by ament_lint_auto_find_test_dependencies or by an explicit call, correct?

What if:

We set a variable in ament_lint_auto_find_test_dependencies called REGISTER_AUTO_LINT_EXTENSIONS, which would then be used in each linter package (ament_cmake_cpplint, etc) to conditionally register the auto lint extension: e.g.,

macro(ament_lint_auto_find_test_dependencies)
...
  set(REGISTER_AMENT_LINT_AUTO_EXTENSIONS TRUE)
  # try to find_package() all test dependencies
  foreach(_dep ${${PROJECT_NAME}_TEST_DEPENDS})
    find_package(${_dep} QUIET)
    if(${_dep}_FOUND)
      list(APPEND ${PROJECT_NAME}_FOUND_TEST_DEPENDS ${_dep})
    endif()
  endforeach()
  set(REGISTER_AMENT_LINT_AUTO_EXTENSIONS FALSE)
endmacro()

Then in, ament_cmake_cpplint:

if(REGISTER_AMENT_LINT_AUTO_EXTENSIONS)
  ament_register_extension("ament_lint_auto" "ament_cmake_cpplint"
    "ament_cmake_cpplint_lint_hook.cmake")
endif()

If a package is missing the if(), it will still get picked up by ament_lint_auto_find_test_dependencies, so we don't run the risk of accidentally turning off a checker.

Thoughts?

from ament_lint.

dirk-thomas avatar dirk-thomas commented on July 24, 2024

Please see my comments on the PR: #133.

from ament_lint.

dirk-thomas avatar dirk-thomas commented on July 24, 2024

Implemented in #133.

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.