fmtlib/fmt
A modern formatting library
C++★ 25,581+134 that day#1 on trending
1.24%duplicated code · 251 of 20,306 lines
29clones in code
36code files of 122 scanned
1.24%duplicated over all files · 97 clones
The code number leaves out tests, fixtures, docs, examples, data files, styles, translations and vendored code.
Largest clones in the code
- 13 lines in 3 placesc-header93 tokens
1933struct formatter<day, Char> : private formatter<std::tm, Char> { 1934 private: 1935 bool use_tm_formatter_ = false; 1936 1937 public: 1938 FMT_CONSTEXPR auto parse(parse_context<Char>& ctx) -> const Char* { 1939 auto it = ctx.begin(), end = ctx.end(); 1940 use_tm_formatter_ = it != end && *it != '}'; 1941 return use_tm_formatter_ ? formatter<std::tm, Char>::parse(ctx) : it; 1942 }First 10 of 13 lines.
- 9 lines in 2 placesc-header174 tokens
505 * escape sequences to specify text formatting. 506 * 507 * **Example**: 508 * 509 * fmt::print(fmt::emphasis::bold | fg(fmt::color::red), 510 * "Elapsed time: {0:.2f} seconds", 1.23); 511 */ 512template <typename... T> 513void print(FILE* f, text_style ts, format_string<T...> fmt, T&&... args) {519 * specify text formatting. 520 * 521 * **Example**: 522 * 523 * fmt::print(fmt::emphasis::bold | fg(fmt::color::red), 524 * "Elapsed time: {0:.2f} seconds", 1.23); 525 */ 526template <typename... T> 527void print(text_style ts, format_string<T...> fmt, T&&... args) { - 7 lines in 4 placesc-header58 tokensinclude/fmt/chrono.h:1905–1911include/fmt/chrono.h:1933–1939include/fmt/chrono.h:1985–1991include/fmt/chrono.h:2009–2015
1905struct formatter<weekday, Char> : private formatter<std::tm, Char> { 1906 private: 1907 bool use_tm_formatter_ = false; 1908 1909 public: 1910 FMT_CONSTEXPR auto parse(parse_context<Char>& ctx) -> const Char* { 1911 auto it = ctx.begin(), end = ctx.end();
7 more
- 9 lines in 2 placesc-header166 tokens
- 17 lines in 2 placesc-header129 tokens
- 12 lines in 2 placesc-header122 tokens
- 7 lines in 2 placesc-header119 tokens
- 6 lines in 2 placesc-header110 tokens
- 6 lines in 2 placesc-header101 tokens
- 6 lines in 2 placesc-header94 tokens
Largest clones over all files, tests and data included
- 19 lines in 4 placesc-headertests73 tokenstest/gtest/gmock/gmock.h:3771–3789test/gtest/gmock/gmock.h:3839–3857test/gtest/gmock/gmock.h:3892–3911test/gtest/gmock/gmock.h:3947–3965
3771 case_sensitive_(case_sensitive) {} 3772 3773#if GTEST_INTERNAL_HAS_STRING_VIEW 3774 bool MatchAndExplain(const internal::StringView& s, 3775 MatchResultListener* listener) const { 3776 // This should fail to compile if StringView is used with wide 3777 // strings. 3778 const StringType& str = std::string(s); 3779 return MatchAndExplain(str, listener); 3780 }First 10 of 19 lines.
- 29 lines in 2 placescpptests203 tokens
9068 zx::socket stderr_socket_; 9069}; 9070 9071// Utility class for accumulating command-line arguments. 9072class Arguments { 9073 public: 9074 Arguments() { args_.push_back(nullptr); } 9075 9076 ~Arguments() { 9077 for (std::vector<char*>::iterator i = args_.begin(); i != args_.end();First 10 of 29 lines.
- 23 lines in 3 placesc-headertests101 tokenstest/gtest/gmock/gmock.h:3845–3867test/gtest/gmock/gmock.h:3899–3921test/gtest/gmock/gmock.h:3953–3975
3845 // strings. 3846 const StringType& str = std::string(s); 3847 return MatchAndExplain(str, listener); 3848 } 3849#endif // GTEST_INTERNAL_HAS_STRING_VIEW 3850 3851 // Accepts pointer types, particularly: 3852 // const char* 3853 // char* 3854 // const wchar_t*First 10 of 23 lines.
- 45 lines in 2 placescpptests188 tokens
- 13 lines in 3 placesc-header93 tokens
By format, code only
| Format | Files | Lines | Clones | Duplicated lines | Duplication |
|---|---|---|---|---|---|
| c-header | 15 | 17,081 | 28 | 244 | 1.43% |
| cpp | 4 | 676 | 1 | 7 | 1.04% |
| python | 6 | 1,601 | 0 | 0 | 0% |
| bash | 9 | 644 | 0 | 0 | 0% |
| perl | 1 | 174 | 0 | 0 | 0% |
| groovy | 1 | 130 | 0 | 0 | 0% |
By format, all files
| Format | Files | Lines | Clones | Duplicated lines | Duplication |
|---|---|---|---|---|---|
| c-header | 25 | 42,619 | 56 | 589 | 1.38% |
| cpp | 43 | 27,322 | 35 | 411 | 1.5% |
| markdown | 11 | 9,135 | 5 | 39 | 0.43% |
| yaml | 10 | 769 | 1 | 8 | 1.04% |
| txt | 10 | 1,898 | 0 | 0 | 0% |
| python | 6 | 1,601 | 0 | 0 | 0% |
| bash | 11 | 743 | 0 | 0 | 0% |
| perl | 1 | 174 | 0 | 0 | 0% |
| groovy | 1 | 130 | 0 | 0 | 0% |
| c | 1 | 112 | 0 | 0 | 0% |
Trending appearances
| Day | Rank | Stars | Files | Lines | Clones | All files | Code | Health | Commit |
|---|---|---|---|---|---|---|---|---|---|
| Sep 6, 2026 | #1 | 25,581 (+134) | 122 | 84,596 | 97 | 1.24% | 1.24% | — | 0f3c5fd |
| Sep 5, 2026 | #1 | 25,496 (+688) | 122 | 84,598 | 96 | 1.23% | 1.24% | — | 6226bc7 |
| Sep 4, 2026 | #1 | 25,204 (+963) | 122 | 84,653 | 96 | 1.23% | 1.24% | — | bc82c40 |
| Sep 3, 2026 | #1 | 24,448 (+14) | 122 | 84,653 | 96 | 1.23% | 1.24% | — | bc82c40 |
Want this for your own project? Install jscpd and run jscpd ., or measure it the way the baselines were measured.