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

apply clang-format #553

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
120 changes: 99 additions & 21 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -1,25 +1,103 @@
BasedOnStyle: LLVM
AllowShortFunctionsOnASingleLine: None
BreakBeforeBraces: Allman
ColumnLimit: 100
UseTab: Never
IndentWidth: 4
TabWidth: 4
---
BasedOnStyle: WebKit
Language: Cpp
LineEnding: LF
ColumnLimit: 0

AlignAfterOpenBracket: DontAlign
Cpp11BracedListStyle: false
BreakStringLiterals: false
IndentCaseLabels: true
AlignConsecutiveAssignments:
Enabled: true
AlignConsecutiveBitFields:
Enabled: true
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: Consecutive
AlignTrailingComments: true
AlignArrayOfStructures: Left

AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false

BinPackArguments: false
BinPackParameters: false
AlignTrailingComments: false
BitFieldColonSpacing: Both

InsertBraces: true
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterStruct: false
AfterUnion: false
BeforeElse: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: false

AlwaysBreakAfterReturnType: None
BreakBeforeBinaryOperators: All
BreakBeforeTernaryOperators: true
BreakStringLiterals: true

DerivePointerAlignment: false
PointerAlignment: Right
ReferenceAlignment: Right

ContinuationIndentWidth: 4
IndentCaseBlocks: false
IndentCaseLabels: false
IndentGotoLabels: false
IndentPPDirectives: None
IndentWidth: 4

SortIncludes: CaseSensitive
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"nitro/types\.h"$'
Priority: -4
- Regex: '^"global\.h"$'
Priority: -3
- Regex: '^"nitro/nitro\.h"$'
Priority: -2
- Regex: '^"nitro/'
Priority: -1
- Regex: '.\*'
Priority: 1
- Regex: '((<.+>)|("nitro/.*\.h"))'
Priority: 1
- Regex: '"global\.h"'
Priority: 2
- Regex: '"(consts|constants)/.*\.h"'
Priority: 3
- Regex: '"(struct_(decls|defs))/.*\.h"'
Priority: 4
- Regex: '"(constdata|res)/.*\.(h|naix)"'
Priority: 7
- Regex: '"[[:alnum:]_]+/.*\.(h|naix)"'
Priority: 5
- Regex: '"[[:alnum:]_]+\.(h|naix)"'
Priority: 6
- Regex: '.*'
Priority: 8

InsertTrailingCommas: Wrapped
InsertNewlineAtEOF: true
KeepEmptyLinesAtEOF: false
MaxEmptyLinesToKeep: 1
RemoveParentheses: ReturnStatement
RemoveSemicolon: true

# QualifierAlignment: Custom
# QualifierOrder: [static, inline, const, volatile, type]

SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeParens: ControlStatements
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParens: Never
6 changes: 6 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**/*.s
**/*.inc
**/*.json
arm9/lib/
arm7/lib/
include/nitro/
18 changes: 11 additions & 7 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
*.sha1 text eol=lf
charmap.txt text eol=crlf
m2ctx.sh text eol=lf
format.sh text eol=lf

*.png binary

*.c text eol=crlf
*.h text eol=crlf
*.cpp text eol=crlf
*.hpp text eol=crlf
*.s text eol=crlf
.gitattributes text eol=crlf
.gitignore text eol=crlf
*.c text eol=lf
*.h text eol=lf
*.cpp text eol=lf
*.hpp text eol=lf
*.s text eol=lf
.gitattributes text eol=lf
.gitignore text eol=lf
Makefile text eol=lf
.clang-format-ignore eol=lf
.clang-format eol=lf
9 changes: 9 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
# Redirect output to stderr.
exec 1>&2

# Run clang-format on staged files; abort the commit if any files are changed
if ! git clang-format --extensions c,cpp,h,hpp ; then
echo "linting made changes to source files; aborting commit"
exit 1
fi
1 change: 1 addition & 0 deletions arm9/lib/NitroSDK/include/PAD_pad.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define NITRO_PAD_PAD_H_

#include "registers.h"
#include "mmap.h"

//================================================================================
// BUTTONS
Expand Down
2 changes: 2 additions & 0 deletions arm9/lib/NitroSDK/include/RTC_api.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef NITRO_RTC_API_H_
#define NITRO_RTC_API_H_

#include "nitro/types.h"

typedef enum RTCAlarmChan
{
RTC_ALARM_CHAN_1 = 0,
Expand Down
1 change: 1 addition & 0 deletions arm9/overlays/01/src/overlay_01.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "global.h"

#include "sinit.h"

static void NitroStaticInit(void) {
Expand Down
6 changes: 3 additions & 3 deletions arm9/overlays/05/include/ov05_021E72FC.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#define POKEDIAMOND_ov05_021E72FC_H

#include "nitro/types.h"

#include "field_system.h"
#include "task.h"

typedef struct UnkStruct021E7358
{
typedef struct UnkStruct021E7358 {
u32 Unk00;
u32 Unk04;
u32 Unk08;
Expand All @@ -22,4 +22,4 @@ BOOL ov05_021E73B4(TaskManager *taskManager);
UnkStruct021E7358 *ov05_021E74D4(u32 param0);
void ov05_021E74F8(UnkStruct021E7358 *param0);

#endif //POKEDIAMOND_ov05_021E72FC_H
#endif // POKEDIAMOND_ov05_021E72FC_H
6 changes: 3 additions & 3 deletions arm9/overlays/05/include/overlay_05.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef POKEDIAMOND_OVERLAY_05_H
#define POKEDIAMOND_OVERLAY_05_H

//todo: remove this file
// todo: remove this file

#include "pokemon.h"

void ov05_SetEggStats(struct Pokemon * mon, u16 species, int a1, PlayerProfile * data, int a2, int metLoc);
void ov05_SetEggStats(struct Pokemon *mon, u16 species, int a1, PlayerProfile *data, int a2, int metLoc);

#endif //POKEDIAMOND_OVERLAY_05_H
#endif // POKEDIAMOND_OVERLAY_05_H
Loading
Loading