Skip to content

Commit

Permalink
Merge pull request #395 from srz-zumix/feature/cpplint
Browse files Browse the repository at this point in the history
fix cpplint
  • Loading branch information
srz-zumix committed Mar 26, 2020
2 parents b72f6a0 + f48d202 commit a39153f
Show file tree
Hide file tree
Showing 25 changed files with 277 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ block_comment = *
block_comment_end = */
line_comment = //

[*.{cpp,hpp,ipp}]
[*.{cpp,hpp,ipp,inl}]
charset = utf-8-bom
trim_trailing_whitespace = true
insert_final_newline = true
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ jobs:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
flags: --extensions=h,hpp,c,cpp,cc,cu,ipp --linelength=150
filter: "-readability/braces\
filter: "-build/c++11\
,-build/c++tr1\
,-build/header_guard\
,-readability/braces\
,-readability/todo\
,-runtime/int\
,-runtime/references\
,-runtime/string\
,-whitespace/braces\
,-whitespace/comments\
,-whitespace/indent\
Expand Down
4 changes: 4 additions & 0 deletions CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set noparent
exclude_files=fused-src
exclude_files=\..*
exclude_files=docs
1 change: 1 addition & 0 deletions projects/cmake/CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exclude_files=tmp
3 changes: 3 additions & 0 deletions projects/vs2013/CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exclude_files=mfc
exclude_files=android
exclude_files=unittest
3 changes: 3 additions & 0 deletions projects/vs2015/CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exclude_files=mfc
exclude_files=android
exclude_files=unittest
3 changes: 3 additions & 0 deletions projects/vs2017/CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exclude_files=mfc
exclude_files=android
exclude_files=unittest
3 changes: 3 additions & 0 deletions projects/vs2019/CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
exclude_files=mfc
exclude_files=android
exclude_files=unittest
1 change: 1 addition & 0 deletions projects/vscode/iutest.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
],
"files.associations": {
"*.ipp": "cpp",
"*.inl": "cpp",
"*.in": "makefile",
".ecrc": "json",
".nuspec": "xml",
Expand Down
1 change: 1 addition & 0 deletions samples/CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
filter=-build/namespaces,-runtime/printf,-build/include_subdir
28 changes: 21 additions & 7 deletions samples/gmock/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@

//======================================================================
//-----------------------------------------------------------------------
/**
* @file main.cpp
* @brief gmock sample
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2020, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
//-----------------------------------------------------------------------
//======================================================================

/*
* is not available vprintf, can be replaced.
*/
Expand All @@ -20,11 +34,11 @@ int main(int argc, char* argv[])
{
::testing::InitGoogleMock(&argc, argv);
IUTEST_INIT(&argc, argv);
return IUTEST_RUN_ALL_TESTS(); // run all
return IUTEST_RUN_ALL_TESTS(); // run all
}

/**
* @brief モック対象のオブジェクト
* @brief モック対象のオブジェクト
*/
class Foo
{
Expand All @@ -33,7 +47,7 @@ class Foo
};

/**
* @brief モック
* @brief モック
*/
class MockFoo : public Foo
{
Expand All @@ -42,13 +56,13 @@ class MockFoo : public Foo
};

/**
* @brief テストしたいクラス
* @brief テストしたいクラス
*/
class FooTest
{
Foo* m_foo;
Foo* m_foo;
public:
FooTest(Foo* foo) : m_foo(foo) {}
explicit FooTest(Foo* foo) : m_foo(foo) {}

::std::string name(void) { return m_foo->name(); }
::std::string repeat(int n)
Expand Down
24 changes: 19 additions & 5 deletions samples/vcunittest/unittest.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#include "stdafx.h"
//======================================================================
//-----------------------------------------------------------------------
/**
* @file unittest.cpp
* @brief vc unittest sample
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2020, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
//-----------------------------------------------------------------------
//======================================================================

#include "stdafx.h"
#include "CppUnitTest.h"

#include "../../include/iutest.hpp"
Expand Down Expand Up @@ -29,9 +44,8 @@ namespace iutest_unittest
{
Assert::AreEqual(0, 1);
}

};
}
} // end of namespace iutest_unittest
#endif

/** --------------------------------------------------
Expand Down Expand Up @@ -125,7 +139,7 @@ IUTEST(AssertionTest, Base)
IUTEST_ASSERT_NE(x0, x1);
IUTEST_EXPECT_NE(x0, x1);
IUTEST_INFORM_NE(x0, x1);
int* one=(int*)1;
int* one=reinterpret_cast<int*>(1);
IUTEST_ASSERT_NE(NULL, one);
}

Expand Down Expand Up @@ -507,7 +521,7 @@ IUTEST(AssertionTest, Exception)
class exception_test
{
public:
exception_test(const ::std::vector<int>&)
explicit exception_test(const ::std::vector<int>&)
{
IUTEST_SUPPRESS_UNREACHABLE_CODE_WARNING(throw ::std::exception());
}
Expand Down
4 changes: 4 additions & 0 deletions samples/windows/CPPLINT.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
exclude_files=Resource\.h
exclude_files=stdafx\..*
exclude_files=targetver.h
exclude_files=iutest_windows_sample\..*
17 changes: 16 additions & 1 deletion samples/windows/tests/test1.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
#include <stdafx.h>
//======================================================================
//-----------------------------------------------------------------------
/**
* @file test1.cpp
* @brief windows sample
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2020, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
//-----------------------------------------------------------------------
//======================================================================

#include <stdafx.h>

IUTEST_TEST(TestCase1, Test1)
{
Expand Down
12 changes: 6 additions & 6 deletions sider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ linter:
goodcheck:
config: ./.ci/goodcheck.yml
cpplint:
filter: "-readability/braces\
filter: "-build/c++11\
,-build/c++tr1\
,-build/header_guard\
,-readability/braces\
,-readability/todo\
,-runtime/int\
,-runtime/references\
,-runtime/string\
,-whitespace/braces\
,-whitespace/comments\
,-whitespace/indent\
Expand All @@ -19,8 +24,3 @@ linter:
linelength: 150
extensions: "c,cpp"
headers: "h,hpp,ipp"
exclude:
- "projects/*/android/iutest_android.NativeActivity/*"
- "projects/*/mfc/*"
- "samples/*/*"

0 comments on commit a39153f

Please sign in to comment.