From 2233b4651234f43ea356b5f4427c7be8e3a1817c Mon Sep 17 00:00:00 2001 From: nerix Date: Sun, 15 Jan 2023 17:27:41 +0100 Subject: [PATCH] Format YAML and JSON Files With Prettier (#4304) * ci: format yaml and json files with prettier * chore: add changelog entry * fix: format everything * ci: run pretter on all files * ci: rename prettier step --- .cirrus.yml | 2 +- .clang-tidy | 110 +++++++------- .github/FUNDING.yml | 2 +- .github/ISSUE_TEMPLATE/a_make_a_report.yml | 61 ++++---- .github/ISSUE_TEMPLATE/config.yml | 18 +-- .github/workflows/build.yml | 146 +++++++++---------- .github/workflows/changelog-check.yml | 8 +- .github/workflows/check-formatting.yml | 2 +- .github/workflows/homebrew.yml | 8 +- .github/workflows/lint.yml | 6 +- .github/workflows/post-clang-tidy-review.yml | 4 +- .github/workflows/push-aur.yml | 2 +- .github/workflows/test.yml | 54 +++---- .prettierignore | 19 ++- .prettierrc | 6 + .prettierrc.toml | 6 - CHANGELOG.md | 1 + benchmarks/.clang-format | 38 +++-- src/.clang-format | 39 +++-- tests/.clang-format | 39 +++-- 20 files changed, 303 insertions(+), 268 deletions(-) create mode 100644 .prettierrc delete mode 100644 .prettierrc.toml diff --git a/.cirrus.yml b/.cirrus.yml index 4f6a74ab5..7d957444b 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -3,7 +3,7 @@ freebsd_instance: task: install_script: - - pkg install -y boost-libs git qt5-buildtools qt5-concurrent qt5-core qt5-multimedia qt5-svg qtkeychain-qt5 qt5-qmake cmake qt5-linguist + - pkg install -y boost-libs git qt5-buildtools qt5-concurrent qt5-core qt5-multimedia qt5-svg qtkeychain-qt5 qt5-qmake cmake qt5-linguist script: | git submodule init git submodule update diff --git a/.clang-tidy b/.clang-tidy index ba619439a..e1d6bfca6 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,56 +1,56 @@ -Checks: '-*, - clang-diagnostic-*, - llvm-*, - misc-*, - -misc-unused-parameters, - readability-identifier-naming, - -llvm-header-guard, - -llvm-include-order, - modernize-*, - readability-*, - performance-*, - misc-*, - bugprone-*, - cert-*, - cppcoreguidelines-*, - -cppcoreguidelines-pro-type-cstyle-cast, - -cppcoreguidelines-pro-bounds-pointer-arithmetic, - -cppcoreguidelines-pro-bounds-array-to-pointer-decay, - -cppcoreguidelines-pro-type-member-init, - -cppcoreguidelines-owning-memory, - -cppcoreguidelines-avoid-magic-numbers, - -readability-magic-numbers, - -performance-noexcept-move-constructor, - -misc-non-private-member-variables-in-classes, - -cppcoreguidelines-non-private-member-variables-in-classes, - -cppcoreguidelines-special-member-functions, - -modernize-use-nodiscard, - -modernize-use-trailing-return-type, - -readability-identifier-length, - -readability-function-cognitive-complexity, - -bugprone-easily-swappable-parameters, - -cert-err58-cpp, - ' +Checks: "-*, + clang-diagnostic-*, + llvm-*, + misc-*, + -misc-unused-parameters, + readability-identifier-naming, + -llvm-header-guard, + -llvm-include-order, + modernize-*, + readability-*, + performance-*, + misc-*, + bugprone-*, + cert-*, + cppcoreguidelines-*, + -cppcoreguidelines-pro-type-cstyle-cast, + -cppcoreguidelines-pro-bounds-pointer-arithmetic, + -cppcoreguidelines-pro-bounds-array-to-pointer-decay, + -cppcoreguidelines-pro-type-member-init, + -cppcoreguidelines-owning-memory, + -cppcoreguidelines-avoid-magic-numbers, + -readability-magic-numbers, + -performance-noexcept-move-constructor, + -misc-non-private-member-variables-in-classes, + -cppcoreguidelines-non-private-member-variables-in-classes, + -cppcoreguidelines-special-member-functions, + -modernize-use-nodiscard, + -modernize-use-trailing-return-type, + -readability-identifier-length, + -readability-function-cognitive-complexity, + -bugprone-easily-swappable-parameters, + -cert-err58-cpp, + " CheckOptions: - - key: readability-identifier-naming.ClassCase - value: CamelCase - - key: readability-identifier-naming.EnumCase - value: CamelCase - - key: readability-identifier-naming.FunctionCase - value: camelBack - - key: readability-identifier-naming.MemberCase - value: camelBack - - key: readability-identifier-naming.PrivateMemberIgnoredRegexp - value: .* - - key: readability-identifier-naming.PrivateMemberSuffix - value: _ - - key: readability-identifier-naming.ProtectedMemberSuffix - value: _ - - key: readability-identifier-naming.UnionCase - value: CamelCase - - key: readability-identifier-naming.GlobalConstantCase - value: UPPER_CASE - - key: readability-identifier-naming.VariableCase - value: camelBack - - key: readability-implicit-bool-conversion.AllowPointerConditions - value: true + - key: readability-identifier-naming.ClassCase + value: CamelCase + - key: readability-identifier-naming.EnumCase + value: CamelCase + - key: readability-identifier-naming.FunctionCase + value: camelBack + - key: readability-identifier-naming.MemberCase + value: camelBack + - key: readability-identifier-naming.PrivateMemberIgnoredRegexp + value: .* + - key: readability-identifier-naming.PrivateMemberSuffix + value: _ + - key: readability-identifier-naming.ProtectedMemberSuffix + value: _ + - key: readability-identifier-naming.UnionCase + value: CamelCase + - key: readability-identifier-naming.GlobalConstantCase + value: UPPER_CASE + - key: readability-identifier-naming.VariableCase + value: camelBack + - key: readability-implicit-bool-conversion.AllowPointerConditions + value: true diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 996f0a9d9..20628285f 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -custom: "https://streamelements.com/fourtf/tip" \ No newline at end of file +custom: "https://streamelements.com/fourtf/tip" diff --git a/.github/ISSUE_TEMPLATE/a_make_a_report.yml b/.github/ISSUE_TEMPLATE/a_make_a_report.yml index 07a36f670..73314f8aa 100644 --- a/.github/ISSUE_TEMPLATE/a_make_a_report.yml +++ b/.github/ISSUE_TEMPLATE/a_make_a_report.yml @@ -6,48 +6,47 @@ body: - type: checkboxes id: acknowledgments attributes: - label: Checklist - description: - options: - - label: I'm reporting a problem with Chatterino - required: true - - label: I've verified that I'm running **the most** recent nightly build or stable release - required: true - - label: I've looked for my problem on the [wiki](https://wiki.chatterino.com/Help/) - required: true - - label: I've searched the [issues and pull requests](https://github.com/Chatterino/chatterino2/issues?q=) for similar looking reports - required: true + label: Checklist + description: + options: + - label: I'm reporting a problem with Chatterino + required: true + - label: I've verified that I'm running **the most** recent nightly build or stable release + required: true + - label: I've looked for my problem on the [wiki](https://wiki.chatterino.com/Help/) + required: true + - label: I've searched the [issues and pull requests](https://github.com/Chatterino/chatterino2/issues?q=) for similar looking reports + required: true - type: textarea id: description validations: - required: true + required: true attributes: - label: Describe your issue - description: | - Write a brief description of your issue. - Important: - Focus on the problem instead of a concrete solution. This ensures that the focus of the thread is to resolve your issue. - If you want to voice a concrete idea you can add a comment below after posting the issue. - placeholder: | - Examples: - - I cannot do X. - - I have trouble doing X. - - Feature X has stopped working for me. + label: Describe your issue + description: | + Write a brief description of your issue. + Important: + Focus on the problem instead of a concrete solution. This ensures that the focus of the thread is to resolve your issue. + If you want to voice a concrete idea you can add a comment below after posting the issue. + placeholder: | + Examples: + - I cannot do X. + - I have trouble doing X. + - Feature X has stopped working for me. - type: textarea id: screenshots attributes: - label: Screenshots - description: While optional, it's highly encouraged to include screenshots or videos to illustrate what you mean. - placeholder: You can upload them using the text editor's dedicated button. + label: Screenshots + description: While optional, it's highly encouraged to include screenshots or videos to illustrate what you mean. + placeholder: You can upload them using the text editor's dedicated button. - type: input id: versions validations: - required: true + required: true attributes: - label: OS and Chatterino Version - description: The name of your Operating System and the version shown in Chatterino's about settings page (⚙ -> about tab). - placeholder: Chatterino 2.3.5 (commit 81a62764, 2022-04-05) on Windows 10 Version 2009, kernel 10.0.19043 - + label: OS and Chatterino Version + description: The name of your Operating System and the version shown in Chatterino's about settings page (⚙ -> about tab). + placeholder: Chatterino 2.3.5 (commit 81a62764, 2022-04-05) on Windows 10 Version 2009, kernel 10.0.19043 diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 47dbbb2a4..2f0ec0fae 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,11 +1,11 @@ blank_issues_enabled: false contact_links: - - name: Issue about the Chatterino Browser Extension - url: https://github.com/Chatterino/chatterino-browser-ext/issues - about: Make a suggestion or report a bug about the Chatterino browser extension. - - name: Suggestions or feature request - url: https://github.com/chatterino/chatterino2/discussions/categories/ideas - about: Got something you think should change or be added? Search for or start a new discussion! - - name: Help - url: https://github.com/chatterino/chatterino2/discussions/categories/q-a - about: Chatterino2 not working as you'd expect? Not sure it's a bug? Check the Q&A section! + - name: Issue about the Chatterino Browser Extension + url: https://github.com/Chatterino/chatterino-browser-ext/issues + about: Make a suggestion or report a bug about the Chatterino browser extension. + - name: Suggestions or feature request + url: https://github.com/chatterino/chatterino2/discussions/categories/ideas + about: Got something you think should change or be added? Search for or start a new discussion! + - name: Help + url: https://github.com/chatterino/chatterino2/discussions/categories/q-a + about: Chatterino2 not working as you'd expect? Not sure it's a bug? Check the Q&A section! diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5d0a57d9b..3be221c53 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,19 +35,19 @@ jobs: - name: Force LTO if: matrix.force-lto == true run: | - echo "C2_ENABLE_LTO=ON" >> "$GITHUB_ENV" + echo "C2_ENABLE_LTO=ON" >> "$GITHUB_ENV" shell: bash - name: Set environment variables for windows-latest if: matrix.os == 'windows-latest' run: | - echo "vs_version=2022" >> "$GITHUB_ENV" + echo "vs_version=2022" >> "$GITHUB_ENV" shell: bash - uses: actions/checkout@v3 with: submodules: true - fetch-depth: 0 # allows for tags access + fetch-depth: 0 # allows for tags access - name: Install Qt uses: jurplel/install-qt-action@v3.0.0 @@ -63,7 +63,7 @@ jobs: uses: actions/cache@v3 with: key: ${{ runner.os }}-conan-user-${{ hashFiles('**/conanfile.txt') }} - path: ~/.conan/ + path: ~/.conan/ - name: Cache conan packages part 2 if: startsWith(matrix.os, 'windows') @@ -79,7 +79,7 @@ jobs: - name: Install dependencies (Windows) if: startsWith(matrix.os, 'windows') run: | - choco install conan -y + choco install conan -y - name: Enable Developer Command Prompt if: startsWith(matrix.os, 'windows') @@ -88,21 +88,21 @@ jobs: - name: Build (Windows) if: startsWith(matrix.os, 'windows') run: | - mkdir build - cd build - conan install .. -b missing - cmake ` - -G"NMake Makefiles" ` - -DCMAKE_BUILD_TYPE=Release ` - -DUSE_CONAN=ON ` - -DCHATTERINO_LTO="$Env:C2_ENABLE_LTO" ` - .. - set cl=/MP - nmake /S /NOLOGO - windeployqt bin/chatterino.exe --release --no-compiler-runtime --no-translations --no-opengl-sw --dir Chatterino2/ - cp bin/chatterino.exe Chatterino2/ - echo nightly > Chatterino2/modes - 7z a chatterino-windows-x86-64.zip Chatterino2/ + mkdir build + cd build + conan install .. -b missing + cmake ` + -G"NMake Makefiles" ` + -DCMAKE_BUILD_TYPE=Release ` + -DUSE_CONAN=ON ` + -DCHATTERINO_LTO="$Env:C2_ENABLE_LTO" ` + .. + set cl=/MP + nmake /S /NOLOGO + windeployqt bin/chatterino.exe --release --no-compiler-runtime --no-translations --no-opengl-sw --dir Chatterino2/ + cp bin/chatterino.exe Chatterino2/ + echo nightly > Chatterino2/modes + 7z a chatterino-windows-x86-64.zip Chatterino2/ - name: Upload artifact (Windows) if: startsWith(matrix.os, 'windows') @@ -120,42 +120,42 @@ jobs: - name: Install dependencies (Ubuntu) if: startsWith(matrix.os, 'ubuntu') run: | - sudo apt-get update - sudo apt-get -y install \ - cmake \ - virtualenv \ - rapidjson-dev \ - libfuse2 \ - libssl-dev \ - libboost-dev \ - libxcb-randr0-dev \ - libboost-system-dev \ - libboost-filesystem-dev \ - libpulse-dev \ - libxkbcommon-x11-0 \ - libgstreamer-plugins-base1.0-0 \ - build-essential \ - libgl1-mesa-dev \ - libxcb-icccm4 \ - libxcb-image0 \ - libxcb-keysyms1 \ - libxcb-render-util0 \ - libxcb-xinerama0 + sudo apt-get update + sudo apt-get -y install \ + cmake \ + virtualenv \ + rapidjson-dev \ + libfuse2 \ + libssl-dev \ + libboost-dev \ + libxcb-randr0-dev \ + libboost-system-dev \ + libboost-filesystem-dev \ + libpulse-dev \ + libxkbcommon-x11-0 \ + libgstreamer-plugins-base1.0-0 \ + build-essential \ + libgl1-mesa-dev \ + libxcb-icccm4 \ + libxcb-image0 \ + libxcb-keysyms1 \ + libxcb-render-util0 \ + libxcb-xinerama0 - name: Build (Ubuntu) if: startsWith(matrix.os, 'ubuntu') run: | - mkdir build - cd build - cmake \ - -DCMAKE_INSTALL_PREFIX=appdir/usr/ \ - -DCMAKE_BUILD_TYPE=Release \ - -DPAJLADA_SETTINGS_USE_BOOST_FILESYSTEM=On \ - -DUSE_PRECOMPILED_HEADERS=${{ matrix.pch }} \ - -DCMAKE_EXPORT_COMPILE_COMMANDS=On \ - -DCHATTERINO_LTO="$C2_ENABLE_LTO" \ - .. - make -j"$(nproc)" + mkdir build + cd build + cmake \ + -DCMAKE_INSTALL_PREFIX=appdir/usr/ \ + -DCMAKE_BUILD_TYPE=Release \ + -DPAJLADA_SETTINGS_USE_BOOST_FILESYSTEM=On \ + -DUSE_PRECOMPILED_HEADERS=${{ matrix.pch }} \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=On \ + -DCHATTERINO_LTO="$C2_ENABLE_LTO" \ + .. + make -j"$(nproc)" shell: bash - name: clang-tidy review @@ -164,7 +164,7 @@ jobs: id: review with: build_dir: build - config_file: '.clang-tidy' + config_file: ".clang-tidy" split_workflow: true - uses: actions/upload-artifact@v3 @@ -178,15 +178,15 @@ jobs: - name: Package - AppImage (Ubuntu) if: startsWith(matrix.os, 'ubuntu') run: | - cd build - sh ./../.CI/CreateAppImage.sh + cd build + sh ./../.CI/CreateAppImage.sh shell: bash - name: Package - .deb (Ubuntu) if: startsWith(matrix.os, 'ubuntu') run: | - cd build - sh ./../.CI/CreateUbuntuDeb.sh + cd build + sh ./../.CI/CreateUbuntuDeb.sh shell: bash - name: Upload artifact - AppImage (Ubuntu) @@ -207,32 +207,32 @@ jobs: - name: Install dependencies (MacOS) if: startsWith(matrix.os, 'macos') run: | - brew install boost openssl rapidjson p7zip create-dmg cmake tree + brew install boost openssl rapidjson p7zip create-dmg cmake tree shell: bash - name: Build (MacOS) if: startsWith(matrix.os, 'macos') run: | - mkdir build - cd build - cmake \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \ - -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \ - -DUSE_PRECOMPILED_HEADERS=${{ matrix.pch }} \ - -DCHATTERINO_LTO="$C2_ENABLE_LTO" \ - .. - make -j"$(sysctl -n hw.logicalcpu)" + mkdir build + cd build + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 \ + -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \ + -DUSE_PRECOMPILED_HEADERS=${{ matrix.pch }} \ + -DCHATTERINO_LTO="$C2_ENABLE_LTO" \ + .. + make -j"$(sysctl -n hw.logicalcpu)" shell: bash - name: Package (MacOS) if: startsWith(matrix.os, 'macos') run: | - ls -la - pwd - ls -la build || true - cd build - sh ./../.CI/CreateDMG.sh + ls -la + pwd + ls -la build || true + cd build + sh ./../.CI/CreateDMG.sh shell: bash - name: Upload artifact (MacOS) diff --git a/.github/workflows/changelog-check.yml b/.github/workflows/changelog-check.yml index 70298141c..4681d687c 100644 --- a/.github/workflows/changelog-check.yml +++ b/.github/workflows/changelog-check.yml @@ -2,8 +2,8 @@ name: Changelog Check on: pull_request: - branches: [ master ] - types: [ opened, synchronize, reopened, ready_for_review, labeled, unlabeled ] + branches: [master] + types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled] jobs: check-changelog: @@ -13,5 +13,5 @@ jobs: - name: Changelog check uses: dangoslen/changelog-enforcer@v3 with: - changeLogPath: 'CHANGELOG.md' - skipLabels: 'no changelog entry needed, ci, submodules' + changeLogPath: "CHANGELOG.md" + skipLabels: "no changelog entry needed, ci, submodules" diff --git a/.github/workflows/check-formatting.yml b/.github/workflows/check-formatting.yml index 19b54c6ee..f4e024507 100644 --- a/.github/workflows/check-formatting.yml +++ b/.github/workflows/check-formatting.yml @@ -7,7 +7,7 @@ on: - master pull_request: -concurrency: +concurrency: group: check-formatting-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/homebrew.yml b/.github/workflows/homebrew.yml index 2d1a69372..a0a5195ec 100644 --- a/.github/workflows/homebrew.yml +++ b/.github/workflows/homebrew.yml @@ -1,9 +1,9 @@ -name: 'Publish Homebrew Cask on Release' +name: "Publish Homebrew Cask on Release" on: push: tags: # Should match semver for mainline releases (not including -beta) - - 'v2.[0-9]+.[0-9]+' + - "v2.[0-9]+.[0-9]+" # TODO: handle beta and nightly releases # Need to make those casks manually first # - v2.[0-9]+.[0-9]+-beta(?:[0-9]+) @@ -16,8 +16,8 @@ env: jobs: update_stable_homebrew_cask: - name: 'Update the stable homebrew cask' - runs-on: 'macos-latest' + name: "Update the stable homebrew cask" + runs-on: "macos-latest" steps: # Pulls out the version from the ref (e.g. refs/tags/v2.3.1 -> 2.3.1) - name: Execute brew bump-cask-pr with version diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index af82fdc0c..63f371885 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,7 +7,7 @@ on: - master pull_request: -concurrency: +concurrency: group: lint-${{ github.ref }} cancel-in-progress: true @@ -18,8 +18,8 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Lint Markdown files + - name: Check formatting with Prettier uses: actionsx/prettier@v2 with: # prettier CLI arguments. - args: --check '**/*.md' + args: --check . diff --git a/.github/workflows/post-clang-tidy-review.yml b/.github/workflows/post-clang-tidy-review.yml index a5f63b84a..cd02e5937 100644 --- a/.github/workflows/post-clang-tidy-review.yml +++ b/.github/workflows/post-clang-tidy-review.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - - name: 'Download artifact' + - name: "Download artifact" uses: actions/github-script@v6 with: script: | @@ -32,7 +32,7 @@ jobs: }); const fs = require('fs'); fs.writeFileSync('${{github.workspace}}/clang-tidy-review.zip', Buffer.from(download.data)); - - name: 'Unzip artifact' + - name: "Unzip artifact" run: unzip clang-tidy-review.zip - uses: ZedThree/clang-tidy-review/post@v0.10.1 diff --git a/.github/workflows/push-aur.yml b/.github/workflows/push-aur.yml index 16902ecd7..4323e0987 100644 --- a/.github/workflows/push-aur.yml +++ b/.github/workflows/push-aur.yml @@ -6,7 +6,7 @@ on: branches: - master -concurrency: +concurrency: group: build-archlinux-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1ac031223..1c848b1b6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ on: env: TWITCH_PUBSUB_SERVER_IMAGE: ghcr.io/chatterino/twitch-pubsub-server-test:v1.0.5 -concurrency: +concurrency: group: test-${{ github.ref }} cancel-in-progress: true @@ -45,46 +45,46 @@ jobs: - name: Install dependencies (Ubuntu) if: startsWith(matrix.os, 'ubuntu') run: | - sudo apt-get update - sudo apt-get -y install \ - cmake \ - rapidjson-dev \ - libssl-dev \ - libboost-dev \ - libboost-system-dev \ - libboost-filesystem-dev \ - libpulse-dev \ - libxkbcommon-x11-0 \ - libgstreamer-plugins-base1.0-0 \ - build-essential \ - libgl1-mesa-dev \ - libxcb-icccm4 \ - libxcb-image0 \ - libxcb-keysyms1 \ - libxcb-render-util0 \ - libxcb-xinerama0 + sudo apt-get update + sudo apt-get -y install \ + cmake \ + rapidjson-dev \ + libssl-dev \ + libboost-dev \ + libboost-system-dev \ + libboost-filesystem-dev \ + libpulse-dev \ + libxkbcommon-x11-0 \ + libgstreamer-plugins-base1.0-0 \ + build-essential \ + libgl1-mesa-dev \ + libxcb-icccm4 \ + libxcb-image0 \ + libxcb-keysyms1 \ + libxcb-render-util0 \ + libxcb-xinerama0 - name: Create build directory (Ubuntu) if: startsWith(matrix.os, 'ubuntu') run: | - mkdir build-test + mkdir build-test shell: bash - name: Build (Ubuntu) if: startsWith(matrix.os, 'ubuntu') run: | - cmake -DBUILD_TESTS=On -DBUILD_APP=OFF .. - cmake --build . --config Release + cmake -DBUILD_TESTS=On -DBUILD_APP=OFF .. + cmake --build . --config Release working-directory: build-test shell: bash - name: Test (Ubuntu) if: startsWith(matrix.os, 'ubuntu') run: | - docker pull kennethreitz/httpbin - docker pull ${{ env.TWITCH_PUBSUB_SERVER_IMAGE }} - docker run --network=host --detach ${{ env.TWITCH_PUBSUB_SERVER_IMAGE }} - docker run -p 9051:80 --detach kennethreitz/httpbin - ./bin/chatterino-test --platform minimal || ./bin/chatterino-test --platform minimal || ./bin/chatterino-test --platform minimal + docker pull kennethreitz/httpbin + docker pull ${{ env.TWITCH_PUBSUB_SERVER_IMAGE }} + docker run --network=host --detach ${{ env.TWITCH_PUBSUB_SERVER_IMAGE }} + docker run -p 9051:80 --detach kennethreitz/httpbin + ./bin/chatterino-test --platform minimal || ./bin/chatterino-test --platform minimal || ./bin/chatterino-test --platform minimal working-directory: build-test shell: bash diff --git a/.prettierignore b/.prettierignore index f5fc58936..df4877b88 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,6 +1,23 @@ +# emoji.json should remain minified +resources/emoji.json + # Ignore submodule files lib/*/ conan-pkgs/*/ cmake/sanitizers-cmake/ -.github/ +# Build folders +*build-*/ +[bB]uild +/_build/ + +# Editors +.vscode +.vs +.idea +dependencies +.cache +.editorconfig + +# vcpkg +vcpkg_installed/ diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..b73da844a --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +trailingComma: es5 +endOfLine: auto +overrides: + - files: "*.md" + options: + proseWrap: preserve diff --git a/.prettierrc.toml b/.prettierrc.toml deleted file mode 100644 index 004dabdab..000000000 --- a/.prettierrc.toml +++ /dev/null @@ -1,6 +0,0 @@ -trailingComma = "es5" - -[[overrides]] -files = ["*.md"] -[overrides.options] -proseWrap = "preserve" diff --git a/CHANGELOG.md b/CHANGELOG.md index 13eb05824..15238f70a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ - Dev: Fixed `inconsistent-missing-override` warnings. (#4296) - Dev: Fixed `final-dtor-non-final-class` warnings. (#4296) - Dev: Fixed `ambiguous-reversed-operator` warnings. (#4296) +- Dev: Format YAML and JSON files with prettier. (#4304) ## 2.4.0 diff --git a/benchmarks/.clang-format b/benchmarks/.clang-format index f34c1465b..7bae09f2c 100644 --- a/benchmarks/.clang-format +++ b/benchmarks/.clang-format @@ -9,14 +9,13 @@ AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: false AlwaysBreakBeforeMultilineStrings: false BasedOnStyle: Google -BraceWrapping: { - AfterClass: 'true' - AfterControlStatement: 'true' - AfterFunction: 'true' - AfterNamespace: 'false' - BeforeCatch: 'true' - BeforeElse: 'true' -} +BraceWrapping: + AfterClass: "true" + AfterControlStatement: "true" + AfterFunction: "true" + AfterNamespace: "false" + BeforeCatch: "true" + BeforeElse: "true" BreakBeforeBraces: Custom BreakConstructorInitializersBeforeComma: true ColumnLimit: 80 @@ -27,7 +26,28 @@ IndentCaseLabels: true IndentWidth: 4 IndentWrappedFunctionNames: true IndentPPDirectives: AfterHash -IncludeBlocks: Preserve +SortIncludes: CaseInsensitive +IncludeBlocks: Regroup +IncludeCategories: + # Project includes + - Regex: '^"[a-zA-Z\._-]+(/[a-zA-Z0-9\._-]+)*"$' + Priority: 1 + # Third party library includes + - Regex: '<[[:alnum:].]+/[a-zA-Z0-9\._\/-]+>' + Priority: 3 + # Qt includes + - Regex: '^$' + Priority: 3 + CaseSensitive: true + # LibCommuni includes + - Regex: "^$" + Priority: 3 + # Misc libraries + - Regex: '^<[a-zA-Z_0-9]+\.h(pp)?>$' + Priority: 3 + # Standard library includes + - Regex: "^<[a-zA-Z_]+>$" + Priority: 4 NamespaceIndentation: Inner PointerBindsToType: false SpacesBeforeTrailingComments: 2 diff --git a/src/.clang-format b/src/.clang-format index 49f126a1a..7bae09f2c 100644 --- a/src/.clang-format +++ b/src/.clang-format @@ -9,14 +9,13 @@ AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: false AlwaysBreakBeforeMultilineStrings: false BasedOnStyle: Google -BraceWrapping: { - AfterClass: 'true' - AfterControlStatement: 'true' - AfterFunction: 'true' - AfterNamespace: 'false' - BeforeCatch: 'true' - BeforeElse: 'true' -} +BraceWrapping: + AfterClass: "true" + AfterControlStatement: "true" + AfterFunction: "true" + AfterNamespace: "false" + BeforeCatch: "true" + BeforeElse: "true" BreakBeforeBraces: Custom BreakConstructorInitializersBeforeComma: true ColumnLimit: 80 @@ -30,24 +29,24 @@ IndentPPDirectives: AfterHash SortIncludes: CaseInsensitive IncludeBlocks: Regroup IncludeCategories: -# Project includes - - Regex: '^"[a-zA-Z\._-]+(/[a-zA-Z0-9\._-]+)*"$' + # Project includes + - Regex: '^"[a-zA-Z\._-]+(/[a-zA-Z0-9\._-]+)*"$' Priority: 1 -# Third party library includes - - Regex: '<[[:alnum:].]+/[a-zA-Z0-9\._\/-]+>' + # Third party library includes + - Regex: '<[[:alnum:].]+/[a-zA-Z0-9\._\/-]+>' Priority: 3 -# Qt includes - - Regex: '^$' + # Qt includes + - Regex: '^$' Priority: 3 CaseSensitive: true -# LibCommuni includes - - Regex: '^$' + # LibCommuni includes + - Regex: "^$" Priority: 3 -# Misc libraries - - Regex: '^<[a-zA-Z_0-9]+\.h(pp)?>$' + # Misc libraries + - Regex: '^<[a-zA-Z_0-9]+\.h(pp)?>$' Priority: 3 -# Standard library includes - - Regex: '^<[a-zA-Z_]+>$' + # Standard library includes + - Regex: "^<[a-zA-Z_]+>$" Priority: 4 NamespaceIndentation: Inner PointerBindsToType: false diff --git a/tests/.clang-format b/tests/.clang-format index 49f126a1a..7bae09f2c 100644 --- a/tests/.clang-format +++ b/tests/.clang-format @@ -9,14 +9,13 @@ AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: false AlwaysBreakBeforeMultilineStrings: false BasedOnStyle: Google -BraceWrapping: { - AfterClass: 'true' - AfterControlStatement: 'true' - AfterFunction: 'true' - AfterNamespace: 'false' - BeforeCatch: 'true' - BeforeElse: 'true' -} +BraceWrapping: + AfterClass: "true" + AfterControlStatement: "true" + AfterFunction: "true" + AfterNamespace: "false" + BeforeCatch: "true" + BeforeElse: "true" BreakBeforeBraces: Custom BreakConstructorInitializersBeforeComma: true ColumnLimit: 80 @@ -30,24 +29,24 @@ IndentPPDirectives: AfterHash SortIncludes: CaseInsensitive IncludeBlocks: Regroup IncludeCategories: -# Project includes - - Regex: '^"[a-zA-Z\._-]+(/[a-zA-Z0-9\._-]+)*"$' + # Project includes + - Regex: '^"[a-zA-Z\._-]+(/[a-zA-Z0-9\._-]+)*"$' Priority: 1 -# Third party library includes - - Regex: '<[[:alnum:].]+/[a-zA-Z0-9\._\/-]+>' + # Third party library includes + - Regex: '<[[:alnum:].]+/[a-zA-Z0-9\._\/-]+>' Priority: 3 -# Qt includes - - Regex: '^$' + # Qt includes + - Regex: '^$' Priority: 3 CaseSensitive: true -# LibCommuni includes - - Regex: '^$' + # LibCommuni includes + - Regex: "^$" Priority: 3 -# Misc libraries - - Regex: '^<[a-zA-Z_0-9]+\.h(pp)?>$' + # Misc libraries + - Regex: '^<[a-zA-Z_0-9]+\.h(pp)?>$' Priority: 3 -# Standard library includes - - Regex: '^<[a-zA-Z_]+>$' + # Standard library includes + - Regex: "^<[a-zA-Z_]+>$" Priority: 4 NamespaceIndentation: Inner PointerBindsToType: false