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

Allow custom config file for ament_uncrustify #200

Merged
merged 6 commits into from
Nov 15, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions ament_cmake_uncrustify/cmake/ament_uncrustify.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,19 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

dirk-thomas marked this conversation as resolved.
Show resolved Hide resolved
#
# Add a test to check the code for compliance with uncrustify.
#
# The default configuration file used for uncrustify is located at
# configuration/ament_code_style.cfg within the uncrustify directory
dirk-thomas marked this conversation as resolved.
Show resolved Hide resolved
# The default configuration file can be overridden by the
# argument 'CONFIG_FILE'.
#
# :param TESTNAME: the name of the test, default: "uncrustify"
# :type TESTNAME: string
# :param CONFIG_FILE: the path of the configuration file for
# uncrustify to consider
dirk-thomas marked this conversation as resolved.
Show resolved Hide resolved
# :type CONFIG_FILE: string
# :param MAX_LINE_LENGTH: override the maximum line length,
# the default is defined in ament_uncrustify
# :type MAX_LINE_LENGTH: integer
Expand All @@ -26,7 +33,7 @@
# @public
#
function(ament_uncrustify)
cmake_parse_arguments(ARG "" "MAX_LINE_LENGTH;TESTNAME" "" ${ARGN})
cmake_parse_arguments(ARG "" "MAX_LINE_LENGTH;TESTNAME;CONFIG_FILE" "" ${ARGN})
if(NOT ARG_TESTNAME)
set(ARG_TESTNAME "uncrustify")
endif()
Expand All @@ -41,6 +48,9 @@ function(ament_uncrustify)
if(DEFINED ARG_MAX_LINE_LENGTH)
list(APPEND cmd "--linelength" "${ARG_MAX_LINE_LENGTH}")
endif()
if(ARG_CONFIG_FILE)
list(APPEND cmd "-c" "${ARG_CONFIG_FILE}")
endif()
list(APPEND cmd ${ARG_UNPARSED_ARGUMENTS})

file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/ament_uncrustify")
Expand Down