* [FFmpeg-devel] [PATCH] [RFC] global/clang-format: Add .clang-format configuration for consistent formatting
@ 2025-04-21 23:52 softworkz
2025-04-21 23:56 ` softworkz .
0 siblings, 1 reply; 2+ messages in thread
From: softworkz @ 2025-04-21 23:52 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: softworkz
From: softworkz <softworkz@hotmail.com>
This is an attempt to create and establish a common definition for
code formatting. Besides .clang-format, there don't seem to be many
good candidates for C when looking for non-proprietary open-source
solutions, so there's wasn't really much choice.
I have tried to configure everything according to the current
guidelines, to which it should come pretty close. There are a few
things for which I couldn't find any FFmpeg rules, or where it wasn't
clear and I made choices that seemed reasonable.
This is in no way intended to prescribe any formatting detail rules,
it's rather meant as an invitation to collaborate on this and ideally
end up with something "official" that allows to check and fix
formatting in CI flows or Patchwork and locally for everybody using
editors with clang-format support or using clang-format from the
command line.
Signed-off-by: softworkz <softworkz@hotmail.com>
---
[RFC] global/clang-format: Add .clang-format configuration for
consistent formatting
This is an attempt to create and establish a common definition for code
formatting. Besides .clang-format, there don't seem to be many good
candidates for C when looking for non-proprietary open-source solutions,
so there's wasn't really much choice.
I have tried to configure everything according to the current
guidelines, to which it should come pretty close. There are a few things
for which I couldn't find any FFmpeg rules, or where it wasn't clear and
I made choices that seemed reasonable.
This is in no way intended to prescribe any formatting detail rules,
it's rather meant as an invitation to collaborate on this and ideally
end up with something "official" that allows to check and fix formatting
in CI flows or Patchwork and locally for everybody using editors with
clang-format support or using clang-format from the command line.
Signed-off-by: softworkz softworkz@hotmail.com
Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-74%2Fsoftworkz%2Fsubmit_clang_format-v1
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-74/softworkz/submit_clang_format-v1
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/74
.clang-format | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 81 insertions(+)
create mode 100644 .clang-format
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000000..e49e571d48
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,81 @@
+---
+BasedOnStyle: GNU
+
+# Alignment & indentation rules
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: Consecutive
+AlignConsecutiveDeclarations: AcrossEmptyLinesAndComments
+AlignArrayOfStructures: Left
+AlignOperands: false
+AlignTrailingComments: Always
+AlignEscapedNewlines: LeftWithLastLine
+IndentWidth: 4
+ContinuationIndentWidth: 4
+UseTab: Never
+TabWidth: 4
+IndentPPDirectives: None
+IndentCaseBlocks: true
+IndentCaseLabels: false
+IndentGotoLabels: true
+PointerAlignment: Right
+
+AlignConsecutiveShortCaseStatements:
+ Enabled: true
+ AcrossEmptyLines: true
+ AcrossComments: true
+ AlignCaseColons: false
+
+# Bracing style
+BreakBeforeBraces: Custom
+BraceWrapping:
+ AfterCaseLabel: true
+ AfterControlStatement: Never
+ AfterEnum: true
+ AfterFunction: true
+ AfterClass: false
+ AfterStruct: false
+ AfterUnion: false
+ AfterExternBlock: false
+ BeforeElse: false
+ SplitEmptyFunction: true
+ SplitEmptyRecord: true
+BreakAfterReturnType: None
+
+# Keep lines from becoming too long (adjust to your preference)
+ColumnLimit: 0
+
+# Misc formatting
+AlwaysBreakAfterReturnType: None
+BinPackArguments: false
+BinPackParameters: false
+# BinPackLongBracedList: false
+BreakBeforeTernaryOperators: true
+InsertNewlineAtEOF: true
+MaxEmptyLinesToKeep: 2
+AlwaysBreakAfterDefinitionReturnType: None
+
+# Include style
+SortIncludes: Never
+IncludeBlocks: Preserve
+IncludeCategories:
+ - Regex: '^<.*'
+ Priority: 1
+ - Regex: '^".*'
+ Priority: 2
+ - Regex: '.*'
+ Priority: 3
+
+# Spacing
+SpaceAfterCStyleCast: false
+SpaceAfterLogicalNot: false
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceBeforeSquareBrackets: false
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInConditionalStatement: false
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+...
base-commit: b6c2498a5902766f924cc8728ac65d4fbfd95238
--
ffmpeg-codebot
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH] [RFC] global/clang-format: Add .clang-format configuration for consistent formatting
2025-04-21 23:52 [FFmpeg-devel] [PATCH] [RFC] global/clang-format: Add .clang-format configuration for consistent formatting softworkz
@ 2025-04-21 23:56 ` softworkz .
0 siblings, 0 replies; 2+ messages in thread
From: softworkz . @ 2025-04-21 23:56 UTC (permalink / raw)
To: softworkz, ffmpeg-devel
[-- Attachment #1: Type: text/plain, Size: 2980 bytes --]
> -----Original Message-----
> From: softworkz <ffmpegagent@gmail.com>
> Sent: Dienstag, 22. April 2025 01:53
> To: ffmpeg-devel@ffmpeg.org
> Cc: softworkz <softworkz@hotmail.com>; softworkz
> <softworkz@hotmail.com>
> Subject: [PATCH] [RFC] global/clang-format: Add .clang-format
> configuration for consistent formatting
>
> From: softworkz <softworkz@hotmail.com>
>
> This is an attempt to create and establish a common definition for
> code formatting. Besides .clang-format, there don't seem to be many
> good candidates for C when looking for non-proprietary open-source
> solutions, so there's wasn't really much choice.
>
> I have tried to configure everything according to the current
> guidelines, to which it should come pretty close. There are a few
> things for which I couldn't find any FFmpeg rules, or where it wasn't
> clear and I made choices that seemed reasonable.
>
> This is in no way intended to prescribe any formatting detail rules,
> it's rather meant as an invitation to collaborate on this and ideally
> end up with something "official" that allows to check and fix
> formatting in CI flows or Patchwork and locally for everybody using
> editors with clang-format support or using clang-format from the
> command line.
>
> Signed-off-by: softworkz <softworkz@hotmail.com>
> ---
> [RFC] global/clang-format: Add .clang-format configuration for
> consistent formatting
>
> This is an attempt to create and establish a common definition for
> code
> formatting. Besides .clang-format, there don't seem to be many
> good
> candidates for C when looking for non-proprietary open-source
> solutions,
> so there's wasn't really much choice.
>
> I have tried to configure everything according to the current
> guidelines, to which it should come pretty close. There are a few
> things
> for which I couldn't find any FFmpeg rules, or where it wasn't
> clear and
> I made choices that seemed reasonable.
>
> This is in no way intended to prescribe any formatting detail
> rules,
> it's rather meant as an invitation to collaborate on this and
> ideally
> end up with something "official" that allows to check and fix
> formatting
> in CI flows or Patchwork and locally for everybody using editors
> with
> clang-format support or using clang-format from the command line.
>
> Signed-off-by: softworkz softworkz@hotmail.com
>
> Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-
> ffstaging-74%2Fsoftworkz%2Fsubmit_clang_format-v1
> Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-
> ffstaging-74/softworkz/submit_clang_format-v1
> Pull-Request: https://github.com/ffstaging/FFmpeg/pull/74
>
> .clang-format | 81
> +++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 81 insertions(+)
> create mode 100644 .clang-format
>
Here's the file as attachment.
[-- Attachment #2: .clang-format.zip --]
[-- Type: application/x-zip-compressed, Size: 1010 bytes --]
[-- Attachment #3: .clang-format.tar.gz --]
[-- Type: application/x-gzip, Size: 967 bytes --]
[-- Attachment #4: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-21 23:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-21 23:52 [FFmpeg-devel] [PATCH] [RFC] global/clang-format: Add .clang-format configuration for consistent formatting softworkz
2025-04-21 23:56 ` softworkz .
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git