Skip to content

Commit 2b6540a

Browse files
committed
init commit
0 parents  commit 2b6540a

17 files changed

Lines changed: 1112 additions & 0 deletions

.cpa/flake8.cfg

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[flake8]
2+
ignore = E203,E231,E501,I100,I201,I202,D102,D100,C901,D104,D101,D105,D107,D400,D103,D205,W503,E402,E266,F841
3+
# E203 whitespace before ':'. Conflicts with how Black formats slicing.
4+
# E231 missing whitespace after ',', ';', or ':'. Conflicts with Black.
5+
# E501 line too long (82 > 79 characters). Ignored because max-line-length is set.
6+
# I100 Import statements are in the wrong order.
7+
# I201 Missing newline between import groups.
8+
# I202 Additional newline in a group of imports.
9+
# D102 Missing docstring in public method.
10+
# D100 Missing docstring in public module.
11+
# C901 function is too complex. Ignored because max-complexity is set.
12+
# D104 Missing docstring in public package.
13+
# D101 Missing docstring in public class.
14+
# D105 Missing docstring in magic method.
15+
# D107 Missing docstring in __init__.
16+
# D400 First line should end with a period.
17+
# D103 Missing docstring in public function.
18+
# D205 1 blank line required between summary line and description.
19+
# W503 line break before binary operator. This is no longer PEP 8 compliant.
20+
# E402 module level import not at top of file.
21+
# E266 too many leading '#' for block comment.
22+
# F841 local variable is assigned to but never used.
23+
24+
exclude =
25+
.cache,
26+
.coverage.*,
27+
.env, # Environment directory used by some tools
28+
.git, # Version control directory
29+
.github, # GitHub metadata directory
30+
.gradle,
31+
.hg, # Mercurial directory
32+
.mypy_cache, # MyPy cache directory
33+
.pytest_cache, # PyTest cache directory
34+
.svn, # Subversion directory
35+
.tox,
36+
.venv, # Common virtual environment directory
37+
.vscode, # VS Code configuration directory
38+
*__pycache__, # Python cache directory
39+
*.egg-info,
40+
*.pyc,
41+
build,
42+
dist,
43+
htmlcov.*,
44+
45+
application-import-names = flake8 # List of application-specific import names.
46+
import-order-style = google # Import statement format style.
47+
max-complexity = 18 # The maximum McCabe complexity allowed.
48+
max-line-length = 120 # The maximum allowed line length.
49+
# per-file-ignores = # Per-file-ignores setting can be used to ignore specific errors in specific files.

.cpa/prettier.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"bracketSpacing": true,
3+
"singleQuote": false,
4+
"useTabs": false,
5+
"tabWidth": 2,
6+
"trailingComma": "all"
7+
}

.gitignore

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
##########################################################################################
2+
# Python
3+
# From: https://github.com/github/gitignore/blob/main/Python.gitignore
4+
##########################################################################################
5+
# Byte-compiled / optimized / DLL files
6+
__pycache__/
7+
*.py[cod]
8+
*$py.class
9+
10+
# C extensions
11+
*.so
12+
13+
# Distribution / packaging
14+
.Python
15+
build/
16+
develop-eggs/
17+
dist/
18+
downloads/
19+
eggs/
20+
.eggs/
21+
lib/
22+
lib64/
23+
parts/
24+
sdist/
25+
var/
26+
wheels/
27+
share/python-wheels/
28+
*.egg-info/
29+
.installed.cfg
30+
*.egg
31+
MANIFEST
32+
33+
# PyInstaller
34+
# Usually these files are written by a python script from a template
35+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
36+
*.manifest
37+
*.spec
38+
39+
# Installer logs
40+
pip-log.txt
41+
pip-delete-this-directory.txt
42+
43+
# Unit test / coverage reports
44+
htmlcov/
45+
.tox/
46+
.nox/
47+
.coverage
48+
.coverage.*
49+
.cache
50+
nosetests.xml
51+
coverage.xml
52+
*.cover
53+
*.py,cover
54+
.hypothesis/
55+
.pytest_cache/
56+
cover/
57+
58+
# Translations
59+
*.mo
60+
*.pot
61+
62+
# Django stuff:
63+
*.log
64+
local_settings.py
65+
db.sqlite3
66+
db.sqlite3-journal
67+
68+
# Flask stuff:
69+
instance/
70+
.webassets-cache
71+
72+
# Scrapy stuff:
73+
.scrapy
74+
75+
# Sphinx documentation
76+
docs/_build/
77+
78+
# PyBuilder
79+
.pybuilder/
80+
target/
81+
82+
# Jupyter Notebook
83+
.ipynb_checkpoints
84+
85+
# IPython
86+
profile_default/
87+
ipython_config.py
88+
89+
# pyenv
90+
# For a library or package, you might want to ignore these files since the code is
91+
# intended to run in multiple environments; otherwise, check them in:
92+
# .python-version
93+
94+
# pipenv
95+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
97+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
98+
# install all needed dependencies.
99+
#Pipfile.lock
100+
101+
# poetry
102+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
103+
# This is especially recommended for binary packages to ensure reproducibility, and is more
104+
# commonly ignored for libraries.
105+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
106+
#poetry.lock
107+
108+
# pdm
109+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
110+
#pdm.lock
111+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
112+
# in version control.
113+
# https://pdm.fming.dev/#use-with-ide
114+
.pdm.toml
115+
116+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
117+
__pypackages__/
118+
119+
# Celery stuff
120+
celerybeat-schedule
121+
celerybeat.pid
122+
123+
# SageMath parsed files
124+
*.sage.py
125+
126+
# Environments
127+
.env
128+
.venv
129+
env/
130+
venv/
131+
ENV/
132+
env.bak/
133+
venv.bak/
134+
135+
# Spyder project settings
136+
.spyderproject
137+
.spyproject
138+
139+
# Rope project settings
140+
.ropeproject
141+
142+
# mkdocs documentation
143+
/site
144+
145+
# mypy
146+
.mypy_cache/
147+
.dmypy.json
148+
dmypy.json
149+
150+
# Pyre type checker
151+
.pyre/
152+
153+
# pytype static type analyzer
154+
.pytype/
155+
156+
# Cython debug symbols
157+
cython_debug/
158+
159+
# PyCharm
160+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
161+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
162+
# and can be added to the global gitignore or merged into this file. For a more nuclear
163+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
164+
#.idea/
165+
166+
##########################################################################################
167+
# Rust
168+
# From: https://github.com/github/gitignore/blob/main/Rust.gitignore
169+
##########################################################################################
170+
# Generated by Cargo
171+
# will have compiled files and executables
172+
debug/
173+
target/
174+
175+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
176+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
177+
Cargo.lock
178+
179+
# These are backup files generated by rustfmt
180+
**/*.rs.bk
181+
182+
# MSVC Windows builds of rustc generate these, which store debugging information
183+
*.pdb
184+
185+
tmp*

.pre-commit-config.yaml

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
default_language_version:
2+
python: python3
3+
4+
repos:
5+
#############################################################################
6+
# Misc
7+
#############################################################################
8+
- repo: https://github.com/pre-commit/pre-commit-hooks
9+
rev: v4.5.0
10+
hooks:
11+
- id: check-ast # Validates the syntax of Python files.
12+
- id: check-case-conflict # Identifies potential case-insensitive file name conflicts.
13+
- id: check-merge-conflict # Searches for merge conflict markers within files.
14+
- id: check-symlinks # Detects broken symlinks.
15+
- id: check-added-large-files # Blocks commits that add large files. Default limit is 500kB.
16+
# Can be configured with args, e.g., '--maxkb=1000' to change the limit.
17+
# Files in 'your_dir/' can be excluded.
18+
# exclude: 'your_dir/.*'
19+
# args: ['--maxkb=5000']
20+
- id: end-of-file-fixer # Ensures files end with a single newline or are empty.
21+
- id: trailing-whitespace # Removes any trailing whitespace at the end of lines.
22+
23+
#############################################################################
24+
# JSON, TOML
25+
#############################################################################
26+
- repo: https://github.com/pre-commit/pre-commit-hooks
27+
rev: v4.5.0
28+
hooks:
29+
- id: check-json # Validates JSON files to ensure they are properly formatted and syntactically correct.
30+
types: [json]
31+
- id: check-toml # Checks TOML files for errors and format issues to ensure valid syntax.
32+
types: [toml]
33+
34+
#############################################################################
35+
# Shell
36+
#############################################################################
37+
- repo: https://github.com/jumanjihouse/pre-commit-hooks
38+
rev: 3.0.0
39+
hooks:
40+
- id: shfmt # Formats shell scripts to a standard convention using shfmt.
41+
- id: shellcheck # Lints shell scripts to identify syntax and usage errors, with a specified severity of 'warning'.
42+
args:
43+
- --severity=warning
44+
45+
#############################################################################
46+
# Python
47+
#############################################################################
48+
- repo: https://github.com/PyCQA/autoflake
49+
rev: v2.2.1
50+
hooks:
51+
- id: autoflake # Removes unused imports and unused variables from Python code
52+
args:
53+
- --in-place
54+
- --remove-all-unused-imports
55+
56+
- repo: https://github.com/pycqa/isort
57+
rev: 5.12.0
58+
hooks:
59+
- id: isort # Sorts Python imports into sections and by alphabetical order
60+
args:
61+
- --settings-path
62+
- .cpa/pyproject.toml
63+
types:
64+
- python
65+
66+
- repo: https://github.com/psf/black
67+
rev: 23.10.1
68+
hooks:
69+
- id: black # Formats Python code to conform to the Black code style
70+
args:
71+
- --config
72+
- .cpa/pyproject.toml
73+
types:
74+
- python
75+
76+
- repo: https://github.com/pycqa/flake8
77+
rev: 6.1.0
78+
hooks:
79+
- id: flake8 # Lints Python code for errors and code style issues based on PEP8
80+
args:
81+
- --config=.cpa/flake8.cfg
82+
types:
83+
- python
84+
85+
# - repo: https://github.com/astral-sh/ruff-pre-commit
86+
# # Ruff version.
87+
# rev: v0.0.270
88+
# hooks:
89+
# - id: ruff
90+
91+
# - repo: https://github.com/python-poetry/poetry
92+
# rev: '1.4.0'
93+
# hooks:
94+
# # https://python-poetry.org/docs/master/pre-commit-hooks/
95+
# # These hooks ensure that our dependencies are being updated only thru poetry.
96+
# - id: poetry-check # Makes sure the poetry configuration does not get committed in a broken state.
97+
# # - id: poetry-lock # Makes sure the lock file is up-to-date when committing changes.
98+
99+
#############################################################################
100+
# CSS, Markdown, JavaScript, TypeScript, YAML style formatter
101+
#############################################################################
102+
- repo: https://github.com/pre-commit/mirrors-prettier
103+
rev: v3.0.3
104+
hooks:
105+
- id: prettier
106+
name: prettier
107+
entry: prettier
108+
args: [--config, .cpa/prettier.json, --write]
109+
types_or:
110+
- javascript
111+
- ts
112+
- tsx
113+
- scss
114+
- css
115+
- yaml
116+
- markdown
117+
exclude: templates/.pre-commit-config.yaml
118+
119+
##
120+
# Rust
121+
##
122+
- repo: https://github.com/doublify/pre-commit-rust
123+
rev: v1.0
124+
hooks:
125+
- id: fmt # Formats Rust code using rustfmt
126+
- id: cargo-check # Checks Rust code for compilation errors and warnings
127+
- id: clippy # Lints Rust code with clippy for common mistakes and style issues

Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[package]
2+
name = "cpa"
3+
version = "0.0.1"
4+
edition = "2018"
5+
6+
[dependencies]
7+
askama = "0.12.1"
8+
clap = { version = "4.4.6", features = ["derive"] }
9+
regex = "1.10.2"
10+
serde = { version = "1", features = ["derive"] }
11+
serde_yaml = "0.8"

0 commit comments

Comments
 (0)