Skip to content

Commit

Permalink
feat: Add .clang-format and .clang-tidy
Browse files Browse the repository at this point in the history
Part of #2
  • Loading branch information
Gashmob committed Jul 15, 2024
1 parent 9bcde96 commit 54524c9
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 16 deletions.
7 changes: 7 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
BasedOnStyle: LLVM
IndentWidth: 4
---
Language: Cpp
Standard: c++17
UseTab: Never
33 changes: 33 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
FormatStyle: llvm
CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.ClassConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.ClassMemberCase
value: lower_case
- key: readability-identifier-naming.ClassMethodCase
value: camelBack
- key: readability-identifier-naming.ConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.EnumCase
value: CamelCase
- key: readability-identifier-naming.EnumConstantCase
value: UPPER_CASE
- key: readability-identifier-naming.FunctionCase
value: camelBack
- key: readability-identifier-naming.LocalVariableCase
value: lower_case
- key: readability-identifier-naming.MemberCase
value: lower_case
- key: readability-identifier-naming.MethodCase
value: camelBack
- key: readability-identifier-naming.NamespaceCase
value: lower_case
- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.StructCase
value: CamelCase
- key: readability-identifier-naming.VariableCase
value: lower_case
6 changes: 3 additions & 3 deletions include/filc/filc.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand All @@ -28,4 +28,4 @@

auto hello_world() -> std::string;

#endif //FILC_FILC_H
#endif // FILC_FILC_H
4 changes: 2 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand Down
8 changes: 3 additions & 5 deletions src/filc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand All @@ -23,6 +23,4 @@
*/
#include "filc/filc.h"

auto hello_world() -> std::string {
return "Hello World!";
}
auto hello_world() -> std::string { return "Hello World!"; }
10 changes: 4 additions & 6 deletions tests/unit/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand All @@ -21,9 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <gtest/gtest.h>
#include <filc/filc.h>
#include <gtest/gtest.h>

TEST(filc, hello_world) {
ASSERT_STREQ("Hello World!", hello_world().c_str());
}
TEST(filc, hello_world) { ASSERT_STREQ("Hello World!", hello_world().c_str()); }
1 change: 1 addition & 0 deletions tools/nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

[
(import ./pinned-bazel.nix { inherit pkgs; })
(import ./pinned-clang.nix { inherit pkgs; })
]
5 changes: 5 additions & 0 deletions tools/nix/pinned-clang.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{ pkgs }:

[
pkgs.libclang
]

0 comments on commit 54524c9

Please sign in to comment.