Skip to content

Commit c13d755

Browse files
Merge pull request #37 from lauraengelhardt/add-pre-commit
Add pre-commit hooks and format codebase
2 parents 0067bc4 + 2a1100e commit c13d755

File tree

132 files changed

+6028
-6057
lines changed

Some content is hidden

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

132 files changed

+6028
-6057
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@ concurrency:
1313
cancel-in-progress: true
1414

1515
jobs:
16+
checkcode:
17+
runs-on: ubuntu-latest
18+
env:
19+
SKIP: no-commit-to-branch
20+
steps:
21+
- uses: actions/checkout@v6
22+
- name: Run pre-commit
23+
run: |
24+
./utilities/set_up_dev_env.sh
25+
source ./utilities/python-venv/bin/activate
26+
pre-commit clean
27+
pre-commit run --all-files --show-diff-on-failure
28+
1629
build:
1730
runs-on: ubuntu-latest
1831
container:

.github/workflows/deploy.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ jobs:
3131
sudo apt-get install -y lftp
3232
cd $LOCAL_DIR
3333
lftp -u $USERNAME --env-password $SERVER -e "set ftp:ssl-protect-data true; set ssl:verify-certificate false; set ftp:list-options -a; cd $SERVER_DIR; mirror -R --delete . .; exit"
34-
env:
34+
env:
3535
SERVER: ${{ vars.FOUR_C_WEBSITE_SERVER }}
3636
USERNAME: ${{ secrets.FOUR_C_WEBSITE_USERNAME }}
3737
LFTP_PASSWORD: ${{ secrets.FOUR_C_WEBSITE_PASSWORD }}
3838
SERVER_DIR: ${{ secrets.FOUR_C_WEBSITE_BASE_PATH }}
3939
LOCAL_DIR: ${{ github.workspace }}/website/
40-

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ vendor/
88
website/
99
_drafts/
1010
Gemfile.lock
11+
12+
# Python
13+
*.pyc
14+
utilities/python-venv/*
15+
*.egg-info/

.pre-commit-config.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: no-commit-to-branch
7+
8+
- repo: https://github.com/google/yamlfmt
9+
rev: v0.16.0
10+
hooks:
11+
- id: yamlfmt
12+
name: Format yaml
13+
args: [-conf, utilities/code_checks/.yamlfmt.yaml]
14+
15+
- repo: https://github.com/pre-commit/mirrors-prettier
16+
rev: v4.0.0-alpha.8
17+
hooks:
18+
- id: prettier
19+
additional_dependencies:
20+
- prettier@4.0.0-alpha.8
21+
- prettier-plugin-liquid
22+
files: \.(js|scss|json|md|html|liquid)$
23+
24+
- repo: https://github.com/FlamingTempura/bibtex-tidy
25+
rev: v1.14.0
26+
hooks:
27+
- id: bibtex-tidy

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ Based on this site generator it is easy for everybody to include some new inform
1010

1111
## How to add a new example to the website?
1212

13-
Examples are collected in the file `<source_dir>/_data/examples.json`. Each example is an entry in the dictionary, which has the following shape
13+
Examples are collected in the file `<source_dir>/_data/examples.json`. Each example is an entry in the dictionary, which has the following shape
1414

1515
```json
16-
{
17-
"title": "Here comes the title",
18-
"image": {
19-
"url": "/images/capabilities/<image-name>",
20-
"width": 400,
21-
"height": "auto"
22-
},
23-
"featured": false,
24-
"description": "Here an explanatory sentence about the project should be given",
25-
"link": "<url_pointing_to_more_information.html",
26-
"author": "N. N."
27-
}
16+
{
17+
"title": "Here comes the title",
18+
"image": {
19+
"url": "/images/capabilities/<image-name>",
20+
"width": 400,
21+
"height": "auto"
22+
},
23+
"featured": false,
24+
"description": "Here an explanatory sentence about the project should be given",
25+
"link": "<url_pointing_to_more_information.html",
26+
"author": "N. N."
27+
}
2828
```
2929

3030
The `featured` flag may be set to true if the examples should be shown on the home page.
@@ -66,15 +66,15 @@ To propose a change to the website, follow these steps:
6666

6767
1. Open an issue to announce and discuss upcoming changes (optional, but recommended).
6868
1. Fork and clone the repository.
69+
1. Run `./<source_dir>/set_up_dev_env.sh` to set up the development environment and pre-commit hooks.
6970
1. Create a feature branch, where you will make any change.
7071
1. To inspect your changes, navigate into the website source code directory and
71-
1. for setup: run `bundle install`
72-
**Remark:** You might set the a path to not install the dependencies into the system installation: `bundle install --path vendor/bundle`
73-
1. run `bundle exec jekyll serve` from the terminal and follow the instructions there.
72+
1. for setup: run `bundle install`
73+
**Remark:** You might set the a path to not install the dependencies into the system installation: `bundle install --path vendor/bundle`
74+
1. run `bundle exec jekyll serve` from the terminal and follow the instructions there.
7475
1. Commit changes. Push the branch to your fork on GitHub.
7576
1. Open a pull request.
7677

7778
> Note: You might want to do a quick internet search for more details on `jekyll`, in case that these instructions are not sufficient.
7879
79-
Since this website represents 4C publicly,
80-
merging of PRs (i.e. actually publishing changes) always requires another set of eyes.
80+
Since this website represents 4C publicly, merging of PRs (i.e. actually publishing changes) always requires another set of eyes.

0 commit comments

Comments
 (0)