Skip to content

Commit d0c7458

Browse files
authored
maint: Add prettier pre-commit hook (#3663)
1 parent 30546a3 commit d0c7458

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+6047
-6400
lines changed

.clang-format

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,61 @@ BasedOnStyle: Mozilla
22
Language: Cpp
33
Standard: c++17
44

5-
AccessModifierOffset: '-4'
5+
AccessModifierOffset: "-4"
66
AlignAfterOpenBracket: BlockIndent
7-
AlignEscapedNewlinesLeft: 'false'
7+
AlignEscapedNewlinesLeft: "false"
88
AllowAllArgumentsOnNextLine: false
99
AllowAllParametersOfDeclarationOnNextLine: false
10-
AllowShortBlocksOnASingleLine: 'false'
11-
AllowShortCaseLabelsOnASingleLine: 'false'
12-
AllowShortFunctionsOnASingleLine: 'false'
13-
AllowShortIfStatementsOnASingleLine: 'false'
14-
AllowShortLoopsOnASingleLine: 'false'
15-
AlwaysBreakTemplateDeclarations: 'true'
10+
AllowShortBlocksOnASingleLine: "false"
11+
AllowShortCaseLabelsOnASingleLine: "false"
12+
AllowShortFunctionsOnASingleLine: "false"
13+
AllowShortIfStatementsOnASingleLine: "false"
14+
AllowShortLoopsOnASingleLine: "false"
15+
AlwaysBreakTemplateDeclarations: "true"
1616
BinPackArguments: false
1717
BinPackParameters: false
1818
BreakAfterAttributes: Leave
1919
BreakBeforeBinaryOperators: All
2020
BreakBeforeBraces: Allman
21-
BreakBeforeTernaryOperators: 'true'
22-
BreakConstructorInitializersBeforeComma: 'true'
23-
BreakStringLiterals: 'false'
24-
ColumnLimit: '100'
25-
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
26-
ConstructorInitializerIndentWidth: '4'
27-
ContinuationIndentWidth: '4'
28-
Cpp11BracedListStyle: 'false'
29-
DerivePointerAlignment: 'false'
30-
DisableFormat: 'false'
21+
BreakBeforeTernaryOperators: "true"
22+
BreakConstructorInitializersBeforeComma: "true"
23+
BreakStringLiterals: "false"
24+
ColumnLimit: "100"
25+
ConstructorInitializerAllOnOneLineOrOnePerLine: "false"
26+
ConstructorInitializerIndentWidth: "4"
27+
ContinuationIndentWidth: "4"
28+
Cpp11BracedListStyle: "false"
29+
DerivePointerAlignment: "false"
30+
DisableFormat: "false"
3131
EmptyLineAfterAccessModifier: Always
3232
EmptyLineBeforeAccessModifier: Always
33-
ExperimentalAutoDetectBinPacking: 'true'
33+
ExperimentalAutoDetectBinPacking: "true"
3434
IncludeBlocks: Regroup
3535
IncludeCategories:
36-
- Regex: <[^.]+>
37-
Priority: -3
38-
- Regex: <mamba/.+>
39-
Priority: -1
40-
- Regex: <.+>
41-
Priority: -2
42-
- Regex: '"mamba/.+"'
43-
Priority: 0
44-
- Regex: '"solv-cpp/.+"'
45-
Priority: 0
46-
- Regex: '".+/.+"'
47-
Priority: 1
48-
- Regex: '".+"'
49-
Priority: 2
50-
IndentCaseLabels: 'true'
51-
IndentWidth: '4'
52-
IndentWrappedFunctionNames: 'false'
53-
InsertBraces: true # Experimental
54-
KeepEmptyLinesAtTheStartOfBlocks: 'false'
55-
MaxEmptyLinesToKeep: '2'
36+
- Regex: <[^.]+>
37+
Priority: -3
38+
- Regex: <mamba/.+>
39+
Priority: -1
40+
- Regex: <.+>
41+
Priority: -2
42+
- Regex: '"mamba/.+"'
43+
Priority: 0
44+
- Regex: '"solv-cpp/.+"'
45+
Priority: 0
46+
- Regex: '".+/.+"'
47+
Priority: 1
48+
- Regex: '".+"'
49+
Priority: 2
50+
IndentCaseLabels: "true"
51+
IndentWidth: "4"
52+
IndentWrappedFunctionNames: "false"
53+
InsertBraces: true # Experimental
54+
KeepEmptyLinesAtTheStartOfBlocks: "false"
55+
MaxEmptyLinesToKeep: "2"
5656
NamespaceIndentation: All
57-
ObjCBlockIndentWidth: '4'
58-
ObjCSpaceAfterProperty: 'false'
59-
ObjCSpaceBeforeProtocolList: 'false'
57+
ObjCBlockIndentWidth: "4"
58+
ObjCSpaceAfterProperty: "false"
59+
ObjCSpaceBeforeProtocolList: "false"
6060
PackConstructorInitializers: Never
6161
PenaltyBreakAssignment: 100000
6262
PenaltyBreakBeforeFirstCallParameter: 0
@@ -67,22 +67,22 @@ PenaltyExcessCharacter: 10
6767
PenaltyIndentedWhitespace: 0
6868
PenaltyReturnTypeOnItsOwnLine: 10
6969
PointerAlignment: Left
70-
QualifierAlignment: Custom # Experimental
70+
QualifierAlignment: Custom # Experimental
7171
QualifierOrder: [inline, static, constexpr, const, volatile, type]
72-
ReflowComments: 'true'
72+
ReflowComments: "true"
7373
SeparateDefinitionBlocks: Always
7474
SortIncludes: CaseInsensitive
7575
SortUsingDeclarations: Never
76-
SpaceAfterCStyleCast: 'true'
77-
SpaceAfterTemplateKeyword: 'true'
78-
SpaceBeforeAssignmentOperators: 'true'
76+
SpaceAfterCStyleCast: "true"
77+
SpaceAfterTemplateKeyword: "true"
78+
SpaceBeforeAssignmentOperators: "true"
7979
SpaceBeforeParens: ControlStatements
80-
SpaceInEmptyParentheses: 'false'
81-
SpacesBeforeTrailingComments: '2'
82-
SpacesInAngles: 'false'
83-
SpacesInCStyleCastParentheses: 'false'
84-
SpacesInContainerLiterals: 'false'
85-
SpacesInParentheses: 'false'
86-
SpacesInSquareBrackets: 'false'
87-
TabWidth: '4'
80+
SpaceInEmptyParentheses: "false"
81+
SpacesBeforeTrailingComments: "2"
82+
SpacesInAngles: "false"
83+
SpacesInCStyleCastParentheses: "false"
84+
SpacesInContainerLiterals: "false"
85+
SpacesInParentheses: "false"
86+
SpacesInSquareBrackets: "false"
87+
TabWidth: "4"
8888
UseTab: Never

.github/actions/workspace/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: workspace
2-
description: 'A action to persist your workspace across different jobs'
2+
description: "A action to persist your workspace across different jobs"
33
branding:
4-
icon: 'box'
5-
color: 'green'
4+
icon: "box"
5+
color: "green"
66
inputs:
77
action:
88
required: true
@@ -18,7 +18,7 @@ inputs:
1818
required: true
1919
default: ${{ github.workflow }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.sha }}
2020
key_suffix:
21-
default: ''
21+
default: ""
2222
token:
2323
required: false
2424
default: ${{ github.token }}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
22
title: Bot failure
33
---
4+
45
There was a problem with the **{{ workflow }}** workflow, please investigate.

.github/workflows/linters.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ jobs:
2020
env:
2121
PRE_COMMIT_USE_MICROMAMBA: 1
2222
steps:
23-
- uses: actions/checkout@v4
24-
- name: Install pre-commit
25-
uses: mamba-org/setup-micromamba@v2
26-
with:
27-
environment-name: linters
28-
create-args: pre-commit
29-
- name: Add micromamba to GITHUB_PATH
30-
run: echo "${HOME}/micromamba-bin" >> $GITHUB_PATH
31-
- name: Run all linters
32-
shell: micromamba-shell {0}
33-
run: |
34-
pre-commit run --all-files --verbose --show-diff-on-failure
23+
- uses: actions/checkout@v4
24+
- name: Install pre-commit
25+
uses: mamba-org/setup-micromamba@v2
26+
with:
27+
environment-name: linters
28+
create-args: pre-commit
29+
- name: Add micromamba to GITHUB_PATH
30+
run: echo "${HOME}/micromamba-bin" >> $GITHUB_PATH
31+
- name: Run all linters
32+
shell: micromamba-shell {0}
33+
run: |
34+
pre-commit run --all-files --verbose --show-diff-on-failure

.github/workflows/static_build.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ on:
88
branches:
99
- main
1010
paths-ignore:
11-
- 'docs/**'
12-
- 'mamba/**'
13-
- 'libmambapy/**'
14-
- '**.md'
11+
- "docs/**"
12+
- "mamba/**"
13+
- "libmambapy/**"
14+
- "**.md"
1515
merge_group:
1616
types: [checks_requested]
1717

@@ -27,11 +27,11 @@ jobs:
2727
fail-fast: false
2828
matrix:
2929
include:
30-
- {os: ubuntu-latest, platform: linux, arch: "64"}
31-
- {os: ubuntu-latest, platform: linux, arch: aarch64}
32-
- {os: ubuntu-latest, platform: linux, arch: ppc64le}
33-
- {os: macos-latest, platform: osx, arch: "64"}
34-
- {os: macos-latest, platform: osx, arch: arm64}
30+
- { os: ubuntu-latest, platform: linux, arch: "64" }
31+
- { os: ubuntu-latest, platform: linux, arch: aarch64 }
32+
- { os: ubuntu-latest, platform: linux, arch: ppc64le }
33+
- { os: macos-latest, platform: osx, arch: "64" }
34+
- { os: macos-latest, platform: osx, arch: arm64 }
3535
steps:
3636
- name: Checkout micromamba-feedstock
3737
uses: actions/checkout@v4

.github/workflows/tests.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ on:
88
branches:
99
- main
1010
paths-ignore:
11-
- 'docs/**'
12-
- '**.md'
11+
- "docs/**"
12+
- "**.md"
1313
merge_group:
1414
types: [checks_requested]
1515

16-
1716
concurrency:
1817
group: ${{ github.workflow }}-${{ github.ref }}
1918
cancel-in-progress: true

.pre-commit-config.yaml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,20 @@ repos:
55
hooks:
66
- id: trailing-whitespace
77
- id: end-of-file-fixer
8-
- id: fix-encoding-pragma
9-
args: [--remove]
10-
- id: check-yaml
11-
exclude: ^.+(/tests/|/recipe/).+$
12-
- id: check-toml
13-
- id: check-json
148
- id: check-merge-conflict
15-
- id: pretty-format-json
16-
args: [--autofix]
179
- id: debug-statements
1810
language_version: python3
11+
# Autoformat: YAML, JSON, Markdown, etc.
12+
- repo: https://github.com/rbubley/mirrors-prettier
13+
rev: v3.4.2
14+
hooks:
15+
- id: prettier
1916
- repo: https://github.com/pre-commit/pygrep-hooks
2017
rev: v1.10.0
2118
hooks:
22-
- id: rst-backticks
23-
- id: rst-directive-colons
24-
- id: rst-inline-touching-normal
19+
- id: rst-backticks
20+
- id: rst-directive-colons
21+
- id: rst-inline-touching-normal
2522
- repo: https://github.com/asottile/pyupgrade
2623
rev: v3.19.0
2724
hooks:
@@ -31,7 +28,7 @@ repos:
3128
rev: v0.8.2
3229
hooks:
3330
- id: ruff
34-
args: [ --fix ]
31+
args: [--fix]
3532
- id: ruff-format
3633
- repo: https://github.com/asottile/blacken-docs
3734
rev: 1.19.1
@@ -55,4 +52,4 @@ repos:
5552
exclude: (CHANGELOG.md)
5653
# In case of ambiguity (multiple possible corrections), `typos` will just report it to the user and move on without applying/writing any changes.
5754
# cf. https://github.com/crate-ci/typos
58-
args: [ --write-changes ]
55+
args: [--write-changes]

0 commit comments

Comments
 (0)