Skip to content

Commit 29720e4

Browse files
authored
Merge pull request #4 from c-p-schmidt/add-first-checks
First checks are added based on fourcipp
2 parents a708379 + 00b73df commit 29720e4

File tree

18 files changed

+343
-161
lines changed

18 files changed

+343
-161
lines changed

.github/workflows/check_code.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Code quality
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types:
9+
- opened
10+
- reopened
11+
- synchronize
12+
13+
jobs:
14+
fourc-webviewer-code-check:
15+
name: Code check
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v3
21+
- name: Set up virtual environment
22+
uses: conda-incubator/setup-miniconda@v3
23+
with:
24+
auto-update-conda: true
25+
conda-remove-defaults: true
26+
activate-environment: 4c-webviewer
27+
python-version: 3.12
28+
- name: Install requirements
29+
shell: bash -el {0}
30+
run: |
31+
conda activate 4c-webviewer
32+
pip install -e .
33+
pip install pre-commit
34+
- name: Run code-checks
35+
shell: bash -el {0}
36+
run: |
37+
conda activate 4c-webviewer
38+
if [ "${GITHUB_REF}" = "refs/heads/main" ]; then
39+
SKIP=no-commit-to-branch pre-commit run --all-files
40+
else
41+
pre-commit run --all-files
42+
fi

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,4 @@ cython_debug/
157157
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158158
# and can be added to the global gitignore or merged into this file. For a more nuclear
159159
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160-
#.idea/
160+
#.idea/

.pre-commit-config.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: check-added-large-files
6+
name: Check for added large files
7+
- id: check-ast
8+
name: Check Python files for parse errors
9+
- id: check-case-conflict
10+
name: Check files for case conflicts on case-insensitive filesystems
11+
- id: check-docstring-first
12+
name: Check that no code is placed prior to docstrings
13+
- id: check-merge-conflict
14+
name: Check for files that contain merge conflict strings
15+
- id: check-toml
16+
name: Check valid TOML syntax
17+
- id: check-yaml
18+
name: Check valid YAML syntax
19+
- id: end-of-file-fixer
20+
name: Check for newline at end of file
21+
exclude: '^LICENSE$'
22+
- id: debug-statements
23+
name: Check for debugger imports
24+
- id: trailing-whitespace
25+
name: Check for trailing whitespaces
26+
- repo: https://github.com/PyCQA/bandit
27+
rev: 1.8.3
28+
hooks:
29+
- id: bandit
30+
name: Run bandit (security linter for python)
31+
args: ["-c", "pyproject.toml", "-r", "-ll", "src/fourc_webviewer/", "tests/"]
32+
additional_dependencies: ["bandit[toml]"]
33+
- repo: https://github.com/PyCQA/docformatter
34+
rev: "eb1df347edd128b30cd3368dddc3aa65edcfac38" # change back to version once bug is fixed in latest version to be compatible with pre-commit
35+
hooks:
36+
- id: docformatter
37+
name: Run docformatter (formatter for docstrings)
38+
args: ["--in-place", "--config=./pyproject.toml", "-r", "src/fourc_webviewer/", "test/"]
39+
- repo: https://github.com/econchick/interrogate
40+
rev: 1.7.0
41+
hooks:
42+
- id: interrogate
43+
name: Run interrogate (linter for docstrings)
44+
args: [--fail-under=100, --ignore-init-module, --style=google, -vv]
45+
- repo: https://github.com/pre-commit/mirrors-mypy
46+
rev: v1.15.0
47+
hooks:
48+
- id: mypy
49+
name: Run mypy (static type checker for python)
50+
args: ["--install-types", "--non-interactive", "--ignore-missing-imports", "--follow-imports=silent"]
51+
- repo: https://github.com/asmeurer/removestar
52+
rev: "1.5.2"
53+
hooks:
54+
- id: removestar
55+
name: Run removestar (remove wildcard imports)
56+
- repo: https://github.com/astral-sh/ruff-pre-commit
57+
rev: v0.11.1
58+
hooks:
59+
- id: ruff # linter
60+
name: Run ruff (linter for Python)
61+
args: ["--fix", "--select", "I,TID252"] # "I => sort imports, TID252 => ban relative imports
62+
- id: ruff-format # formatter
63+
name: Run ruff (formatter for Python)
64+
- repo: https://github.com/crate-ci/typos
65+
rev: v1.30.2
66+
hooks:
67+
- id: typos
68+
name: Run typo checker
69+
- repo: https://github.com/google/yamlfmt
70+
rev: v0.16.0
71+
hooks:
72+
- id: yamlfmt
73+
name: Run yamlfmt
74+
args: ["-formatter", "retain_line_breaks_single=true"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ We encourage you to test the current state and provide feedback on what function
8282
8383
## License
8484
85-
This project is licensed under a MIT license. For further information check [`LICENSE`](./LICENSE).
85+
This project is licensed under a MIT license. For further information check [`LICENSE`](./LICENSE).

images/4C-logo/negative-white/4C-logo-landscape_negative.svg

Lines changed: 1 addition & 1 deletion
Loading

images/4C-logo/standard-color/4C-logo-landscape_rgb.svg

Lines changed: 1 addition & 1 deletion
Loading

src/fourc_webviewer/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Module to initialize and run the webviewer application."""

0 commit comments

Comments
 (0)