Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
563 commits
Select commit Hold shift + click to select a range
daf7e7d
Merge pull request #685 from judemille/main
allevato Feb 4, 2024
12dae5b
fix readme typo
saturnboy Feb 7, 2024
3129697
Merge pull request #688 from saturnboy/patch-1
allevato Feb 7, 2024
3d44a2f
Renamed plugin configuration parameter
dmonagle Mar 4, 2024
e4ce680
Merge pull request #696 from dmonagle/rename-plugin-configuration-arg…
allevato Mar 7, 2024
ac3cc94
Update README to specify version 510.1.0 for building from source
mh-mobile Mar 24, 2024
5545cf6
Merge pull request #709 from mh-mobile/update-source-build-version-to…
allevato Mar 25, 2024
a0bbe05
fix comment for multiElementCollectionTrailingCommas
ozumin Mar 26, 2024
8c4a487
fix method name in CommaTests.swift
ozumin Mar 26, 2024
07c5509
Merge pull request #710 from ozumin/patch-1
allevato Mar 27, 2024
629372a
fix typo in Configuration+Testing.swift
mrs1669 Mar 27, 2024
1967bf7
fix typo in FileIterator.swift
mrs1669 Mar 27, 2024
d4bbe76
fix typo in Trivia+Convenience.swift
mrs1669 Mar 27, 2024
af84165
fix annotation
mrs1669 Mar 28, 2024
5eb3d20
Merge pull request #711 from mrs1669/fix/typos
allevato Mar 28, 2024
b04a373
Fix @_originallyDefinedIn argument spacing
dduan Apr 16, 2024
26d83e5
Merge pull request #717 from apple/dd/originally-defined-in-arguments
allevato Apr 17, 2024
36ba8dc
Fix incorrect spacing when pretty-printing @_documentation
dduan Apr 16, 2024
fdb4f43
Merge pull request #719 from apple/dd/documentation-vilibility-printing
allevato Apr 18, 2024
3062c3a
Add post merge Swift CI support for swift-format
shahmishal Apr 19, 2024
58c2ef5
Fix typo in the .swiftci windows testing file
shahmishal Apr 19, 2024
f93ddbd
Update RuleDocumentation.md
fawkeswei Apr 29, 2024
2dd68a0
Remove check for prioritizeKeepingFunctionOutputTogether on enum decl.
shawnhyam Apr 29, 2024
9623f3e
Merge pull request #727 from fawkeswei/patch-1
ahoppen Apr 29, 2024
53238b5
Make sure there is a break after an #endif.
shawnhyam Apr 29, 2024
366da31
Merge pull request #728 from shawnhyam/fix-crash-on-enum-decl
allevato May 1, 2024
bc7c751
Merge pull request #729 from shawnhyam/fix-arguments-following-endif
allevato May 2, 2024
6cf4ea0
Merge adjacent .line and .docLine comments into a single element.
shawnhyam May 7, 2024
b065fa3
Improvements based on feedback and further testing.
shawnhyam May 8, 2024
4f19acc
Merge pull request #732 from shawnhyam/collect-line-comments
allevato May 9, 2024
eec6403
Handle indented block comments with ASCII art correctly.
shawnhyam May 28, 2024
6640067
Support for formatting a selection (given as an array of ranges) <htt…
DaveEwing Mar 21, 2024
88beb85
Some small refectorings and updates from review feedback. Add a few m…
DaveEwing Jun 3, 2024
0c0977d
Change the `--offsets` argument to take a single pair of offsets, and…
DaveEwing Jun 4, 2024
2541a14
Fix `@_expose` attribute argument spacing
kateinoigakukun Jun 14, 2024
53279ee
Merge pull request #708 from apple/dewing/FormatRanges
allevato Jun 14, 2024
ee3a4be
Merge pull request #750 from kateinoigakukun/katei/fix-expose-attribute
allevato Jun 17, 2024
d46e30f
Merge pull request #746 from shawnhyam/handle-block-comment-indentation
allevato Jun 17, 2024
95d85a2
add support for riscv64
futurejones Jun 18, 2024
ae0922d
Delete CODE_OF_CONDUCT.md
parispittman Jun 24, 2024
981c130
Delete CONTRIBUTING.md
parispittman Jun 24, 2024
1ca1b53
Update README.md
parispittman Jun 24, 2024
824ac89
Merge pull request #753 from swiftlang/parispittman-patch-1
shahmishal Jun 25, 2024
ee5e8c6
Merge pull request #755 from swiftlang/parispittman-patch-3
shahmishal Jun 25, 2024
cef7eca
Update links for repositories moved to the swiftlang org on GitHub
ahoppen Jun 25, 2024
56fa13b
Update README.md to mention that swift-format is included in Xcode 16
ahoppen Jun 25, 2024
4cd4380
Merge pull request #754 from swiftlang/parispittman-patch-2
ahoppen Jun 25, 2024
a8ff3ca
Split the PrettyPrint class into two pieces.
shawnhyam Jun 25, 2024
0ac5bbc
Merge pull request #757 from ahoppen/swiftlang-migration
ahoppen Jun 25, 2024
16dc01a
Merge pull request #756 from ahoppen/swift-format-in-xcode
ahoppen Jun 25, 2024
8be2ab2
Merge pull request #752 from futurejones/add-riscv64-support
ahoppen Jun 26, 2024
415b8ea
Add missing comments for new struct and its properties.
shawnhyam Jun 26, 2024
d8b446b
Merge pull request #759 from shawnhyam/pretty-print-code-reorg
allevato Jun 27, 2024
dce1e60
Add PrettyPrintBuffer.swift to CMakeLists.txt
ahoppen Jun 27, 2024
6fadf64
Merge pull request #763 from ahoppen/prettyprintbuffer-cmake
ahoppen Jun 27, 2024
d0954cb
Add swift-format rule warning for retroactive conformances.
harlanhaskins Jul 9, 2024
e99495c
Add source file to CMakeLists
harlanhaskins Jul 11, 2024
f42d4f2
Merge pull request #765 from harlanhaskins/hhaskins/retro-activity
allevato Jul 12, 2024
1c9d743
Add check to allow underscores in test functions marked with @Test at…
hamtiko Jul 13, 2024
5a63aee
Add Swift Testing checks
hamtiko Jul 14, 2024
77779ac
Move attribute lookup to separate extension
hamtiko Jul 15, 2024
dca8bec
Merge branch 'adding-swift-testing-checks' into allow-underscore-for-…
hamtiko Jul 15, 2024
c7d8018
Use new extension for attribute lookup
hamtiko Jul 15, 2024
b10cf16
Add a break after `do` when it has typed throws
bnbarham Jul 15, 2024
fe36876
Merge pull request #769 from bnbarham/fixed-do-typed-throws
bnbarham Jul 17, 2024
8019514
Update hasAttribute extension signature to check module name as well.
hamtiko Jul 18, 2024
d2d5dc3
updating the doc for hasAttribute
hamtiko Jul 18, 2024
ae1ef61
Merge pull request #767 from hamtiko/allow-underscore-for-testing-funcs
allevato Jul 19, 2024
38d8e10
Improve formatting of macro decls with attributes.
shawnhyam Jul 19, 2024
4a99f1c
Add option to customize number of spaces leading `//` comments
dduan Jul 20, 2024
ba2a192
Update Sources/SwiftFormat/API/Configuration.swift
dduan Jul 24, 2024
bb7524d
Fix missing break in nested IfConfig decls. Fixes #779.
shawnhyam Jul 25, 2024
6603bd6
Merge pull request #775 from shawnhyam/improve-macro-decl-formatting
ahoppen Jul 26, 2024
b268009
Merge pull request #780 from shawnhyam/fix-nested-if-config-statements
ahoppen Jul 26, 2024
9d1f88c
Ignore CMakeLists.txt in SwiftPM
dduan Jul 28, 2024
ababcef
Merge pull request #785 from dduan/dd/ignore-cmakelist-swiftpm
ahoppen Jul 30, 2024
ffc641e
Merge pull request #776 from dduan/dd/line-comment-leading-spaces
allevato Jul 30, 2024
3155cb5
Upgrade the DontRepeatTypeInStaticProperties rule.
shawnhyam Aug 1, 2024
992d2c6
Add option to add a newline between 2 adjacent attributes (#784)
dduan Aug 1, 2024
f0d1167
Merge pull request #777 from shawnhyam/upgrade-dont-repeat-type-in-st…
allevato Aug 1, 2024
fc7042b
Make rules work even inside of nested data structures. Fixes #778.
shawnhyam Jul 24, 2024
01ac894
Change assertLint helper to run via the pipeline only.
shawnhyam Jul 25, 2024
b60a4ee
Merge pull request #789 from shawnhyam/improved-rules-in-nested-types
allevato Aug 2, 2024
87d5fb2
Merge pull request #788 from shawnhyam/swift-format-ignore
allevato Aug 2, 2024
a917604
Remove closure capture equal sign spacing.
MAJKFL Aug 6, 2024
5936e56
Merge pull request #790 from MAJKFL/main
ahoppen Aug 7, 2024
29c39eb
Add support for re-indenting block comments.
shawnhyam Aug 8, 2024
021a5ab
Merge pull request #791 from shawnhyam/support-block-comment-reindent
allevato Aug 12, 2024
16c2c28
Support assume-filename option to find the configuration file when
shawnhyam Aug 14, 2024
6e0e645
Fix build warnings
ahoppen Aug 15, 2024
3d79237
Merge pull request #796 from ahoppen/fix-warnings
ahoppen Aug 15, 2024
c658a00
Merge pull request #794 from shawnhyam/assume-filename
allevato Aug 15, 2024
705af09
Wrap multiline string literals to line length.
thunderseethe Aug 12, 2024
89ccc79
Merge pull request #792 from thunderseethe/multiline
allevato Aug 19, 2024
0c71671
Add NoEmptyLinesOpeningClosingBraces rule
mateusrodriguesxyz Aug 22, 2024
3f5d15a
Fix extraction of trailing comments only when necessary during afterT…
TTOzzi Aug 23, 2024
8411c07
Fix to arrange attributeList for attributes starting with ifConfig
TTOzzi Aug 24, 2024
7bca483
Merge pull request #800 from TTOzzi/attributes-merged-without-space
allevato Aug 26, 2024
4a3def9
Merge pull request #798 from TTOzzi/fix-multiElementCollectionTrailin…
allevato Aug 26, 2024
a1ee216
Fix infinite loop on Windows caused by checking path against "/". (#802)
shawnhyam Sep 6, 2024
08cc71f
Fix link to configuration in rule documentation file
mattia Sep 10, 2024
11b7887
Merge pull request #805 from mattia/doc-fix
ahoppen Sep 10, 2024
34d1bbf
[CI] GitHub Actions support for Linux platform
shahmishal Sep 28, 2024
ab48e0f
Add CODEOWNERS file
shahmishal Sep 28, 2024
26fbd13
Merge pull request #820 from swiftlang/ci-support-linux
shahmishal Sep 28, 2024
1f01ae4
Use human-readable names in pull_request action and consistently use …
ahoppen Sep 29, 2024
a29f7e6
Create a GitHub action to create a release
ahoppen Sep 29, 2024
5cb2b03
Merge pull request #823 from ahoppen/actions-improvements
shahmishal Sep 30, 2024
7a98187
Merge branch 'main' into release-action
shahmishal Sep 30, 2024
d2b01fc
Fix build warning: `eachKeyword` was renamed to `specifier`
ahoppen Sep 29, 2024
acc3c6c
Don’t discard the return value of `FileManager.createFile`
ahoppen Sep 29, 2024
8cb684e
Merge pull request #821 from ahoppen/release-action
ahoppen Sep 30, 2024
9fb082f
Merge pull request #822 from ahoppen/fix-warning
ahoppen Sep 30, 2024
226601a
Replace `Sanity` by `Basic`
ahoppen Sep 30, 2024
77edc43
Quote `$(realpath .)`
ahoppen Sep 30, 2024
83a6ed9
Merge pull request #825 from ahoppen/soundess
ahoppen Sep 30, 2024
abff181
Move tests in `swift-formatTests` to `SwiftFormatTests`
ahoppen Sep 30, 2024
1e0fd86
[CI] Add soundness check (#824)
shahmishal Sep 30, 2024
c1f06b8
Allow the `Publish Release` action to create a tag and release
ahoppen Sep 30, 2024
f7df163
Merge pull request #828 from ahoppen/allow-publish-release-to-publish
ahoppen Oct 1, 2024
b3314ac
Merge pull request #827 from ahoppen/no-executable-test-target
ahoppen Oct 1, 2024
f94d502
Skip files and directories starting with `.` on Windows
ahoppen Oct 1, 2024
6e4c4b5
Merge pull request #829 from ahoppen/skip-dot-windows
ahoppen Oct 1, 2024
6452eff
Bring over swift-syntax's formatter config into swift-format.
allevato Oct 1, 2024
f0eabf8
Run swift-format on swift-format.
allevato Oct 1, 2024
40d3f3e
Re-enable format check (the default behavior).
allevato Oct 1, 2024
e113695
Merge pull request #830 from allevato/reformat
allevato Oct 1, 2024
65bac1e
Make `build-script-helper.py` pass flake8 linting
ahoppen Oct 4, 2024
ee8342e
Update YAML files to pass yamllint
ahoppen Oct 4, 2024
8068ff7
Merge pull request #831 from ahoppen/flake8
ahoppen Oct 4, 2024
1e72780
Add a relative symlink to FileIteratorTests
kkebo Oct 5, 2024
f824817
Fix relative symlinks when using `--follow-symlinks`
kkebo Oct 5, 2024
8e54731
Update README.md
0xTim Oct 5, 2024
b8f8f9e
Fix broken links in PrettyPrinter.md
plemarquand Oct 7, 2024
1812069
Merge pull request #840 from plemarquand/fix-source-ref-links-pretty-…
allevato Oct 7, 2024
c46f2c6
Support building swift-format using SwiftPM for toolchain builds on W…
ahoppen Oct 7, 2024
69ad898
Update README.md
0xTim Oct 8, 2024
bc1e395
Merge pull request #841 from ahoppen/windows-build
ahoppen Oct 8, 2024
d143a8a
Merge pull request #839 from 0xTim/patch-1
ahoppen Oct 8, 2024
f170037
Merge pull request #832 from ahoppen/yamllint
ahoppen Oct 10, 2024
231be3c
Fix infinite looping if swift-format is run in a directory that doesn…
ahoppen Oct 10, 2024
0ea619a
Add `@ahoppen` and `@bnbarham` as code owners for CI directories
ahoppen Oct 10, 2024
7ee11c7
Merge pull request #845 from ahoppen/infinite-searching
ahoppen Oct 11, 2024
ba8f585
Fix infinite searching for `.swift-format` file on Linux
ahoppen Oct 11, 2024
1699d87
Merge pull request #846 from ahoppen/codeowners
ahoppen Oct 11, 2024
9df5622
Merge pull request #848 from ahoppen/infinite-searching-linux
ahoppen Oct 11, 2024
1babba4
Support building only tests using SwiftPM
ahoppen Oct 7, 2024
79cef55
Allow building against a single dynamic swift-syntax library
ahoppen Oct 14, 2024
fa5530c
Merge pull request #851 from ahoppen/windows-build
ahoppen Oct 14, 2024
b267bee
Merge pull request #852 from ahoppen/sourcekit-lsp-windows-build
ahoppen Oct 14, 2024
a5298f7
Remove duplicated dependencies in Package.swift
ahoppen Oct 14, 2024
06ca47b
Merge pull request #853 from ahoppen/duplicate-dependencies
ahoppen Oct 14, 2024
ef73806
Fix test by deduplicating files in `FileIterator.next()`
kkebo Oct 16, 2024
5f90fb3
Remove `isDirectory: false` so that `URL` can infer it
kkebo Oct 16, 2024
b9065b1
Simplify the code by replacing `.abosoluteURL.standardized` with `.st…
kkebo Oct 17, 2024
8581f2c
Skip missing configuration file tests on Windows for Swift < 6.0.2
ahoppen Oct 17, 2024
8f4f6e2
Make tests pass using Swift 5.9 and Swift 5.10 on Windows
ahoppen Oct 17, 2024
29197fe
Merge pull request #857 from ahoppen/skip-tests
ahoppen Oct 18, 2024
24fc4d6
Merge pull request #858 from ahoppen/windows-5
ahoppen Oct 18, 2024
3ca1a18
Merge pull request #837 from kkebo/relative-symlinks
ahoppen Oct 18, 2024
39ee6a2
Run Windows tests before tagging a release
ahoppen Oct 24, 2024
ce212ca
Use matrix to run debug and release
ahoppen Oct 24, 2024
c3b0c9f
Prepare for integer generics with new generic argument node
Azoy Oct 25, 2024
dfb366a
Fix formatting
Azoy Oct 25, 2024
9cbc942
Update UseShorthandTypeNames.swift
Azoy Oct 28, 2024
e6aa9ec
Update UseShorthandTypeNames.swift
Azoy Nov 4, 2024
211884f
Fix tests when building swift-format using Swift 6.0.2
ahoppen Oct 31, 2024
c1e7b6e
Merge pull request #869 from ahoppen/tests-on-602
ahoppen Nov 4, 2024
637cb85
Merge pull request #866 from Azoy/integer-generics
ahoppen Nov 7, 2024
5e4caa8
feat: add pre-commit hooks
danthorpe Apr 10, 2024
0c05520
Merge pull request #712 from danthorpe/danthorpe/add_pre_commit_hooks
ahoppen Nov 12, 2024
fee42c9
Add `--enable-experimental-feature` to enable those features in the p…
allevato Nov 8, 2024
2830399
Merge pull request #876 from allevato/experimental-features
ahoppen Nov 12, 2024
8c68ec3
Add indentBlankLines configuration
TTOzzi Nov 15, 2024
5a0ac33
Merge pull request #804 from TTOzzi/allowWhitespaceOnlyLines
ahoppen Nov 15, 2024
2cd032c
PrettyPrinter reports wrong line LineNumbersTests
bkolb Nov 23, 2024
832d1bc
[6.1] Update related dependencies to release/6.1
ahoppen Dec 4, 2024
0c5afee
Merge pull request #883 from bkolb/bug/882-wrongLineNumberWithComments
ahoppen Dec 4, 2024
8fec655
Use dockerless Windows jobs
ahoppen Dec 4, 2024
36849fd
Merge pull request #889 from ahoppen/dockerless-windows
ahoppen Dec 4, 2024
fed90eb
Merge pull request #888 from ahoppen/related-dependencies-6.1
ahoppen Dec 4, 2024
36d00f0
Merge pull request #863 from ahoppen/windows-pre-build
ahoppen Dec 4, 2024
23709e8
Fix issue in publish_release pipeline testing swift-format in debug c…
ahoppen Dec 5, 2024
4db71db
Run Windows tests dockerless
ahoppen Dec 5, 2024
6c8eabe
Run Windows tests before tagging a release
ahoppen Oct 24, 2024
989d0cc
Use matrix to run debug and release
ahoppen Oct 24, 2024
5fc28a6
Fix issue in publish_release pipeline testing swift-format in debug c…
ahoppen Dec 5, 2024
8b79703
Run Windows tests dockerless
ahoppen Dec 5, 2024
49fc60e
Merge pull request #890 from ahoppen/publish-release-fixes
ahoppen Dec 5, 2024
6e4c968
Merge pull request #891 from ahoppen/6.1/publish-release
ahoppen Dec 5, 2024
003208b
Fix support for `FileIterator` when working directory is `/`
Dec 5, 2024
8358e38
Add an api-breakages file to allow API breakages
ahoppen Dec 5, 2024
3b27ab5
Merge pull request #865 from macshome/main
ahoppen Dec 5, 2024
2abf666
Merge remote-tracking branch 'swiftlang/main' into release/6.1
ahoppen Dec 10, 2024
a978bf3
Merge pull request #893 from ahoppen/merge-main-6.1-2024-12-10
ahoppen Dec 10, 2024
f077071
PathCchIsRoot PathCchIsRoot PathCchIsRoot Updated isRoot extension.
Dec 6, 2024
ed01028
Merge pull request #892 from macshome/PathCchIsRoot
ahoppen Dec 10, 2024
a652b9d
Fix comment length computation
rauhul Dec 11, 2024
e658606
Merge pull request #895 from rauhul/rauhul/fix-end-of-line-off-by-1
allevato Dec 11, 2024
6566d61
Fix build warning in tests
ahoppen Dec 12, 2024
a871b81
Merge pull request #896 from ahoppen/fix-warning
ahoppen Dec 12, 2024
84c0b4e
Merge remote-tracking branch 'swiftlang/main' into release/6.1
ahoppen Dec 12, 2024
f410c3c
Merge pull request #898 from ahoppen/ahoppen/merge-main-2024-12-12
ahoppen Dec 12, 2024
6cb2c76
Document default config values
rauhul Dec 13, 2024
2e588a0
Merge pull request #899 from rauhul/rauhul/config-docs
ahoppen Dec 13, 2024
f384f62
Add Swift package index
kimdv Dec 13, 2024
dba874b
Fix documentation
kimdv Dec 14, 2024
239ffcb
Merge pull request #900 from kimdv/kimdv/add-swift-package-index
ahoppen Dec 15, 2024
72123e5
Bump to Swift 5.8 for tool version
kimdv Dec 16, 2024
cd042df
Merge pull request #903 from kimdv/kimdv/update-to-swift-5.8
ahoppen Dec 17, 2024
8c7b261
Merge remote-tracking branch 'swiftlang/main' into release/6.1
ahoppen Dec 17, 2024
94ce795
Merge pull request #904 from ahoppen/6.1/merge-main-2024-12-17
ahoppen Dec 18, 2024
87467ee
PrettyPrinterPerformance PrettyPrinterPerformance PrettyPrinterPerfor…
Dec 13, 2024
bb5b4c9
Update Sources/SwiftFormat/PrettyPrint/PrettyPrintBuffer.swift
macshome Dec 19, 2024
f334bb3
Merge pull request #901 from macshome/PrettyPrinterPerformance
ahoppen Dec 19, 2024
8073ddc
Revert "PrettyPrinterPerformance Optimized the PrettyPrinter for #894"
bnbarham Dec 20, 2024
2b7e6d8
Merge pull request #906 from swiftlang/revert-901-PrettyPrinterPerfor…
bnbarham Dec 20, 2024
3d1e03b
Fix NoEmptyLinesOpeningClosingBraces to respect consecutive newlines …
TTOzzi Jan 4, 2025
e82cdd7
Merge pull request #910 from TTOzzi/fix-NoEmptyLinesOpeningClosingBraces
allevato Jan 7, 2025
f9c8cf8
Merge remote-tracking branch 'swiftlang/main' into release/6.1
ahoppen Jan 8, 2025
8c4e008
Merge pull request #911 from ahoppen/merge-main-6.1-2025-01-08
ahoppen Jan 8, 2025
3ca204b
Optimize pretty printing performance
bnbarham Jan 10, 2025
6e64b26
Merge pull request #913 from bnbarham/pretty-print-perf
bnbarham Jan 10, 2025
83b5f01
[WhitespaceLinter] Use hand crafted "is whitespace" function
rintaro Jan 13, 2025
c0b518e
Merge pull request #915 from rintaro/lint-iswhitespace
bnbarham Jan 13, 2025
3f041ed
Gradually deprecate running swift-format without input paths; require…
TTOzzi Jan 11, 2025
f9b10f2
Merge pull request #914 from TTOzzi/more-friendly-commands
allevato Jan 29, 2025
4bba23b
Document missing configuration
DimaMishchenko Jan 30, 2025
2f71242
Merge pull request #919 from DimaMishchenko/main
ahoppen Feb 5, 2025
5e2fa1d
Merge branch 'main' into release/6.1
ahoppen Feb 5, 2025
72fc65f
Merge pull request #921 from ahoppen/merge-main-6.1-2025-02-04
ahoppen Feb 5, 2025
3bd4582
Run Windows tests inside a Docker container
ahoppen Mar 5, 2025
4c2421c
Merge pull request #954 from ahoppen/6.1/docker-windows
ahoppen Mar 5, 2025
d749be6
Revert "[5.8] Update for SwiftSyntax if/switch expression work"
hamishknight Feb 14, 2023
aa18686
Update package dependencies for 508.0.0.
allevato Apr 7, 2023
8d3a55f
Relax version requirement for swift-argument-parser
ahoppen Apr 21, 2023
214cc45
Remove test targets and test util
deepak-deepsource Aug 23, 2023
78844c3
Add Dockerfile
deepak-deepsource Aug 23, 2023
72835cc
Add GH to build and push image
deepak-deepsource Aug 23, 2023
8d6fde2
For test -- undo this change
deepak-deepsource Aug 23, 2023
709004b
Copy file for docker build
deepak-deepsource Aug 23, 2023
e9004bc
Add GCR build script and remove workflow
deepak-deepsource Aug 24, 2023
1c74422
Add deepsource config
deepak-deepsource Aug 24, 2023
bf917c2
Apply suggestions from code review
deepak-deepsource Aug 24, 2023
7ceb398
Apply suggestions from code review
deepak-deepsource Aug 24, 2023
b90827c
Add makefile for tag creation
deepak-deepsource Aug 25, 2023
a6293af
Make sure only DeepSource tags are used
deepak-deepsource Aug 25, 2023
24fc8e9
Use newer ubuntu
tushar-deepsource Oct 4, 2023
d4d602e
chore: replace -static-executable with --static-swift-stdlib
anto-deepsource Oct 4, 2023
0e53082
Merge branch 'deepsource-workbranch' into rebase-with-swift-6.1.1-REL…
srijan-deepsource May 28, 2025
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
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]

# Match the maximum line length in Swift files.
max-line-length = 120
152 changes: 152 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
name: Publish Release

on:
workflow_dispatch:
inputs:
prerelease:
type: boolean
description: "Prerelease"
# Whether to create a prerelease or proper release
default: true
required: true
swift_format_version:
type: string
default: 601.0.0
description: "swift-format version"
# The version of swift-format to tag. If this is a prerelease, `-prerelease-<date>` is added to this version.
required: true
swift_syntax_tag:
type: string
default: 601.0.0
description: "swift-syntax version"
# The swift-syntax version to depend on. If this is a prerelease, the latest swift-syntax prerelease tag for this version is used.
required: true

jobs:
check_triggering_actor:
name: Check user is allowed to create release
# Only a single user should be allowed to create releases to avoid two people triggering the creation of a release
# at the same time. If the release manager changes between users, update this condition.
runs-on: ubuntu-latest
steps:
- run: |
if [[ "${{ github.triggering_actor }}" != "ahoppen" ]]; then
echo "${{ github.triggering_actor }} is not allowed to create a release"
exit 1
fi
create_release_commits:
name: Create release commits
runs-on: ubuntu-latest
outputs:
swift_format_version: ${{ steps.swift_format_version.outputs.swift_format_version }}
release_commit_patch: ${{ steps.create_release_commits.outputs.release_commit_patch }}
steps:
- name: Determine swift-syntax tag to depend on
id: swift_syntax_tag
shell: bash
run: |
if [[ "${{ github.event.inputs.prerelease }}" == "false" ]]; then
SWIFT_SYNTAX_TAG="${{ github.event.inputs.swift_syntax_tag }}"
else
git clone https://github.com/swiftlang/swift-syntax.git
cd swift-syntax
SWIFT_SYNTAX_TAG="$(git tag | grep ${{ github.event.inputs.swift_syntax_tag }}-prerelease | sort -r | head -1)"
fi

echo "Using swift-syntax tag: $SWIFT_SYNTAX_TAG"
echo "swift_syntax_tag=$SWIFT_SYNTAX_TAG" >> "$GITHUB_OUTPUT"
- name: Determine swift-format prerelease version
id: swift_format_version
run: |
if [[ "${{ github.event.inputs.prerelease }}" == "false" ]]; then
SWIFT_FORMAT_VERSION="${{ github.event.inputs.swift_format_version }}"
else
SWIFT_FORMAT_VERSION="${{ github.event.inputs.swift_format_version }}-prerelease-$(date +'%Y-%m-%d')"
fi
echo "Using swift-format version: $SWIFT_FORMAT_VERSION"
echo "swift_format_version=$SWIFT_FORMAT_VERSION" >> "$GITHUB_OUTPUT"
- name: Checkout repository
uses: actions/checkout@v4
- name: Create release commits
id: create_release_commits
run: |
# Without this, we can't perform git operations in GitHub actions.
git config --global --add safe.directory "$(realpath .)"
git config --local user.name 'swift-ci'
git config --local user.email 'swift-ci@users.noreply.github.com'

BASE_COMMIT=$(git rev-parse HEAD)

sed -E -i "s#branch: \"(main|release/[0-9]+\.[0-9]+)\"#from: \"${{ steps.swift_syntax_tag.outputs.swift_syntax_tag }}\"#" Package.swift
git add Package.swift
git commit -m "Change swift-syntax dependency to ${{ steps.swift_syntax_tag.outputs.swift_syntax_tag }}"

sed -E -i "s#print\(\".*\"\)#print\(\"${{ steps.swift_format_version.outputs.swift_format_version }}\"\)#" Sources/swift-format/PrintVersion.swift
git add Sources/swift-format/PrintVersion.swift
git commit -m "Change version to ${{ steps.swift_format_version.outputs.swift_format_version }}"

{
echo 'release_commit_patch<<EOF'
git format-patch "$BASE_COMMIT"..HEAD --stdout
echo EOF
} >> "$GITHUB_OUTPUT"
test:
name: Test in ${{ matrix.release && 'Release' || 'Debug' }} configuration
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
needs: create_release_commits
strategy:
fail-fast: false
matrix:
release: [true, false]
with:
linux_pre_build_command: |
git config --global --add safe.directory "$(realpath .)"
git config --local user.name 'swift-ci'
git config --local user.email 'swift-ci@users.noreply.github.com'
git am << EOF
${{ needs.create_release_commits.outputs.release_commit_patch }}
EOF
windows_pre_build_command: |
git config --local user.name "swift-ci"
git config --local user.email "swift-ci@users.noreply.github.com"
echo @"
${{ needs.create_release_commits.outputs.release_commit_patch }}
"@ > $env:TEMP\patch.diff
# For some reason `git am` fails in Powershell with the following error. Executing it in cmd works...
# fatal: empty ident name (for <>) not allowed
cmd /c "type $env:TEMP\patch.diff | git am || (exit /b 1)"
# We require that releases of swift-format build without warnings
linux_build_command: swift test -Xswiftc -warnings-as-errors ${{ matrix.release && '-c release' || '' }}
windows_build_command: swift test -Xswiftc -warnings-as-errors ${{ matrix.release && '-c release' || '' }}
create_tag:
name: Create Tag
runs-on: ubuntu-latest
needs: [check_triggering_actor, test, create_release_commits]
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Apply release commits
run: |
git config --global --add safe.directory "$(realpath .)"
git config --local user.name 'swift-ci'
git config --local user.email 'swift-ci@users.noreply.github.com'
git am << EOF
${{ needs.create_release_commits.outputs.release_commit_patch }}
EOF
- name: Tag release
run: |
git tag "${{ needs.create_release_commits.outputs.swift_format_version }}"
git push origin "${{ needs.create_release_commits.outputs.swift_format_version }}"
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
if [[ "${{ github.event.inputs.prerelease }}" != "true" ]]; then
# Only create a release automatically for prereleases. For real releases, release notes should be crafted by hand.
exit
fi
gh release create "${{ needs.create_release_commits.outputs.swift_format_version }}" \
--title "${{ needs.create_release_commits.outputs.swift_format_version }}" \
--prerelease
17 changes: 17 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Pull request

on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
tests:
name: Test
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
soundness:
name: Soundness
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
with:
license_header_check_enabled: false
license_header_check_project_name: "Swift.org"
api_breakage_check_allowlist_path: "api-breakages.txt"
6 changes: 6 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- id: swift-format
name: swift-format
entry: swift-format format --in-place --recursive --parallel
language: swift
types: [swift]
require_serial: true
11 changes: 11 additions & 0 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This is manifest file for the Swift Package Index for it to
# auto-generate and host DocC documentation.
# For reference see https://swiftpackageindex.com/swiftpackageindex/spimanifest/documentation/spimanifest/commonusecases#Host-DocC-documentation-in-the-Swift-Package-Index.

version: 1
builder:
configs:
- documentation_targets:
# First item in the list is the "landing" (default) target
- SwiftFormat
custom_documentation_parameters: [--experimental-skip-synthesized-symbols]
18 changes: 18 additions & 0 deletions .swift-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"version": 1,
"lineLength": 120,
"indentation": {
"spaces": 2
},
"lineBreakBeforeEachArgument": true,
"indentConditionalCompilationBlocks": false,
"prioritizeKeepingFunctionOutputTogether": true,
"rules": {
"AlwaysUseLowerCamelCase": false,
"AmbiguousTrailingClosureOverload": false,
"NoBlockComments": false,
"OrderedImports": true,
"UseLetInEveryBoundCaseVariable": false,
"UseSynthesizedInitializer": false
}
}
5 changes: 5 additions & 0 deletions .swiftci/5_10_ubuntu2204
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LinuxSwiftPackageJob {
swift_version_tag = "5.10-jammy"
repo = "swift-format"
branch = "main"
}
5 changes: 5 additions & 0 deletions .swiftci/5_7_ubuntu2204
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LinuxSwiftPackageJob {
swift_version_tag = "5.7-jammy"
repo = "swift-format"
branch = "main"
}
5 changes: 5 additions & 0 deletions .swiftci/5_8_ubuntu2204
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LinuxSwiftPackageJob {
swift_version_tag = "5.8-jammy"
repo = "swift-format"
branch = "main"
}
5 changes: 5 additions & 0 deletions .swiftci/5_9_ubuntu2204
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LinuxSwiftPackageJob {
swift_version_tag = "5.9-jammy"
repo = "swift-format"
branch = "main"
}
5 changes: 5 additions & 0 deletions .swiftci/nightly_6_0_macos
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
macOSSwiftPackageJob {
swift_version = "6.0"
repo = "swift-format"
branch = "main"
}
5 changes: 5 additions & 0 deletions .swiftci/nightly_6_0_ubuntu2204
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LinuxSwiftPackageJob {
nightly_docker_tag = "nightly-6.0-jammy"
repo = "swift-format"
branch = "main"
}
5 changes: 5 additions & 0 deletions .swiftci/nightly_main_macos
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
macOSSwiftPackageJob {
swift_version = "main"
repo = "swift-format"
branch = "main"
}
5 changes: 5 additions & 0 deletions .swiftci/nightly_main_ubuntu2204
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LinuxSwiftPackageJob {
nightly_docker_tag = "nightly-jammy"
repo = "swift-format"
branch = "main"
}
7 changes: 7 additions & 0 deletions .swiftci/nightly_main_windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
WindowsSwiftPackageWithDockerImageJob {
docker_image = "swiftlang/swift:nightly-windowsservercore-1809"
repo = "swift-format"
branch = "main"
sub_dir = "swift-format"
label = "windows-server-2019"
}
92 changes: 92 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#[[
This source file is part of the swift-format open source project

Copyright (c) 2024 Apple Inc. and the swift-format project authors
Licensed under Apache License v2.0 with Runtime Library Exception

See https://swift.org/LICENSE.txt for license information
#]]

cmake_minimum_required(VERSION 3.19.0)

if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()
if(POLICY CMP0091)
cmake_policy(SET CMP0091 NEW)
endif()

project(SwiftFormat
LANGUAGES C Swift)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift)
set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)

list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)

include(FetchContent)
include(GNUInstallDirs)
include(SwiftSupport)

find_package(Foundation CONFIG)

set(_SF_VENDOR_DEPENDENCIES)

set(BUILD_EXAMPLES NO)
set(BUILD_TESTING NO)

find_package(ArgumentParser CONFIG)
if(NOT ArgumentParser_FOUND)
FetchContent_Declare(ArgumentParser
GIT_REPOSITORY https://github.com/apple/swift-argument-parser
GIT_TAG 1.2.3)
list(APPEND _SF_VENDOR_DEPENDENCIES ArgumentParser)
endif()

find_package(cmark-gfm CONFIG)
if(NOT cmark-gfm_FOUND)
FetchContent_Declare(cmark-gfm
GIT_REPOSITORY https://github.com/apple/swift-cmark
GIT_TAG gfm)
list(APPEND _SF_VENDOR_DEPENDENCIES cmark-gfm)
endif()

find_package(SwiftMarkdown CONFIG)
if(NOT SwiftMarkdown_FOUND)
# TODO(compnerd) we need a latest version for now as we need the CMake support
# which is untagged.
FetchContent_Declare(Markdown
GIT_REPOSITORY https://github.com/apple/swift-markdown
GIT_TAG main)
list(APPEND _SF_VENDOR_DEPENDENCIES Markdown)
endif()

find_package(SwiftSyntax CONFIG)
if(NOT SwiftSyntax_FOUND)
FetchContent_Declare(Syntax
GIT_REPOSITORY https://github.com/swiftlang/swift-syntax
GIT_TAG main)
list(APPEND _SF_VENDOR_DEPENDENCIES Syntax)
endif()

if(_SF_VENDOR_DEPENDENCIES)
FetchContent_MakeAvailable(${_SF_VENDOR_DEPENDENCIES})

if(NOT TARGET SwiftMarkdown::Markdown)
add_library(SwiftMarkdown::Markdown ALIAS Markdown)
endif()

if(NOT TARGET SwiftSyntax::SwiftSyntax)
add_library(SwiftSyntax::SwiftSyntax ALIAS SwiftSyntax)
add_library(SwiftSyntax::SwiftSyntaxBuilder ALIAS SwiftSyntaxBuilder)
add_library(SwiftSyntax::SwiftOperators ALIAS SwiftOperators)
add_library(SwiftSyntax::SwiftParser ALIAS SwiftParser)
add_library(SwiftSyntax::SwiftParserDiagnostics ALIAS SwiftParserDiagnostics)
endif()
endif()

add_subdirectory(Sources)
14 changes: 14 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2024 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for Swift project authors
#

* @ahoppen @allevato @bnbarham @shawnhyam

.github/ @ahoppen @bnbarham @shahmishal
.swiftci/ @ahoppen @bnbarham @shahmishal
Loading
Loading