Commit 9bf6e475 authored by Benjamin Eikel's avatar Benjamin Eikel

Imported Upstream version 1.0.1+git3224cf2

parent a4db0471

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.4)
FOREACH(p
CMP0003
CMP0026
CMP0054
)
IF(POLICY ${p})
CMAKE_POLICY(SET ${p} NEW)
ENDIF()
ENDFOREACH()
PROJECT(KWStyle)
......@@ -36,6 +43,7 @@ ENDIF (BUILD_TESTING)
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
${KWStyle_BINARY_DIR}/Utilities
${KWStyle_SOURCE_DIR}/Utilities
)
SET(KWStyle_HDRS
......@@ -77,6 +85,8 @@ kwsCheckStruct.cxx
kwsCheckVariables.cxx
kwsCheckMemberFunctions.cxx
kwsCheckFunctions.cxx
kwsCheckUsingDirectives.cxx
kwsCheckRelativePathInInclude.cxx
)
SUBDIRS(Utilities)
......@@ -94,15 +104,9 @@ ADD_LIBRARY(KWStyleLib ${KWStyle_SRCS} ${KWStyle_HDRS})
ADD_EXECUTABLE(KWStyle kwsStyle.cxx)
TARGET_LINK_LIBRARIES(KWStyle KWStyleLib kwssys)
# Move the executable to the top binary tree
GET_TARGET_PROPERTY(EXECUTABLE_PATH KWStyle LOCATION)
GET_FILENAME_COMPONENT(EXECUTABLE_NAME ${EXECUTABLE_PATH} NAME)
ADD_CUSTOM_COMMAND(
TARGET KWStyle
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${EXECUTABLE_PATH} ${KWStyle_BINARY_DIR}/${EXECUTABLE_NAME}
)
ADD_CUSTOM_COMMAND(TARGET KWStyle POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:KWStyle>" "${KWStyle_BINARY_DIR}/${EXECUTABLE_NAME}"
COMMENT "Move the executable to the top binary tree")
# Installation file
INSTALL(TARGETS KWStyle
......@@ -123,7 +127,7 @@ INCLUDE(InstallRequiredSystemLibraries)
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "KWStyle")
SET(CPACK_PACKAGE_VENDOR "Kitware Inc.")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/ReadMe.txt")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/Copyright.txt")
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "0")
......
/*=========================================================================
Program: KWStyle - Kitware Style Checker
Module: $RCSfile: KWStyleConfigure.h.in,v $
Module: KWStyleConfigure.h.in
Copyright (c) Kitware, Inc. All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
......
KWStyle
=======
[![Circle CI]( https://circleci.com/gh/Kitware/KWStyle.svg?style=svg)](https://circleci.com/gh/Kitware/KWStyle )
Overview
--------
KWStyle is a style checker for source code which is integrated in the software process
to ensure that the code written by several users is consistent and can be
viewed/printed as it was written by one person.
Features
--------
Among the fearures provided by KWStyle:
- Several Indentation checking
- Copyright Header correctness
- Maximum line length
- Encapsulation preservation
- Internal variable checking via regular expressions
- New line at the end of file
A complete list of the features is available [here][fl].
[fl]: https://kitware.github.io/KWStyle/resources/features.html
......@@ -35,6 +35,7 @@ MACRO(ADD_TEST_FROM_BUG_TRACKER BUG_NUMBER FILENAME)
ENDMACRO(ADD_TEST_FROM_BUG_TRACKER BUG_NUMBER FILENAME)
ADD_TEST_FROM_BUG_TRACKER(kwsTabsTest test.cxx)
ADD_TEST_FROM_BUG_TRACKER(0001 test.cpp)
ADD_TEST_FROM_BUG_TRACKER(4204 test.cpp)
ADD_TEST_FROM_BUG_TRACKER(4227 test.cpp)
......@@ -65,3 +66,4 @@ ADD_TEST_FROM_BUG_TRACKER(9935 test.cxx)
ADD_TEST_FROM_BUG_TRACKER(9937 test.cxx)
ADD_TEST_FROM_BUG_TRACKER(9938 test.cxx)
ADD_TEST_FROM_BUG_TRACKER(9939 test.cxx)
ADD_TEST_FROM_BUG_TRACKER(10872 test.cxx)
<?xml version="1.0" encoding="iso-8859-1"?>
<Description>
<LineLength>120</LineLength>
<DeclarationOrder>0,1,2</DeclarationOrder>
<Typedefs>^[A-Z](\w|\d)*</Typedefs>
<MemberFunctions>^~?(\w|\d)*</MemberFunctions>
<InternalVariables>^[A-Z](\w|\d)*</InternalVariables>
<SemicolonSpace>0</SemicolonSpace>
<EndOfFileNewLine>1</EndOfFileNewLine>
<Tabs>1</Tabs>
<Spaces>3</Spaces>
<Comments>/**, *, */,true</Comments>
<Indent>SPACE,2,true,true</Indent>
<NameOfClass>[NameOfClass],qZ</NameOfClass>
<IfNDefDefine>__[NameOfClass]_[Extension]</IfNDefDefine>
<EmptyLines>2</EmptyLines>
<Template>[TNV]</Template>
<Operator>1,1</Operator>
</Description>
A()
{
f("//");
}
B()
{
g("//");
}
C()
{
}
<?xml version="1.0" encoding="iso-8859-1"?>
<Description>
<LineLength>120</LineLength>
<Tabs>1</Tabs>
</Description>
<Error>
<SourceLineNumber1>3</SourceLineNumber1>
<SourceLineNumber2>3</SourceLineNumber2>
<ErrorNumber>10</ErrorNumber>
</Error>
<Error>
<SourceLineNumber1>4</SourceLineNumber1>
<SourceLineNumber2>4</SourceLineNumber2>
<ErrorNumber>10</ErrorNumber>
</Error>
<Error>
<SourceLineNumber1>5</SourceLineNumber1>
<SourceLineNumber2>5</SourceLineNumber2>
<ErrorNumber>10</ErrorNumber>
</Error>
<Error>
<SourceLineNumber1>6</SourceLineNumber1>
<SourceLineNumber2>6</SourceLineNumber2>
<ErrorNumber>10</ErrorNumber>
</Error>
if (1) // this line has no tabs
{ // this line has no tabs
// this line has a leading tab
// this line has a tab in the middle
// this line has a tab at the end
// this line has lots of tabs
} // this line has no tabs
FROM debian:8
MAINTAINER Insight Software Consortium <community@itk.org>
RUN apt-get update && apt-get install -y \
build-essential \
cmake \
ninja-build \
git
RUN mkdir -p /usr/src/KWStyle-build
WORKDIR /usr/src
#!/bin/sh
script_dir="`cd $(dirname $0); pwd`"
docker build -t kitware/kwstyle-testing $script_dir
#!/bin/sh
script_dir="`cd $(dirname $0); pwd`"
docker run \
--rm \
-v $script_dir/../..:/usr/src/KWStyle \
kitware/kwstyle-testing \
/usr/src/KWStyle/Testing/Docker/test.sh
#!/bin/bash
# This is a script to build the modules and run the test suite in the base
# Docker container.
die() {
echo "Error: $@" 1>&2
exit 1;
}
cd /usr/src/KWStyle-build || die "Could not cd into the build directory"
cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE:STRING=Release \
/usr/src/KWStyle || die "CMake configuration failed"
ctest -VV -D Experimental || die "ctest failed"
/*=========================================================================
Program: KWStyle - Kitware Style Checker
Module: $RCSfile: KWStyleTests.cxx,v $
Module: KWStyleTests.cxx
Copyright (c) Kitware, Inc. All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
......
/*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: $RCSfile: kwsBadCharactersTest.cxx,v $
Module: kwsBadCharactersTest.cxx
Language: C++