Skip to content

Commit

Permalink
chg: Execute ore-commit on all the project.
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricbonhomme committed Aug 1, 2024
1 parent cceff81 commit bc88e16
Show file tree
Hide file tree
Showing 10 changed files with 213 additions and 45 deletions.
21 changes: 21 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## Generic requirements in order to contribute:

* One Pull Request per fix/feature/change/...
* Keep the amount of commits per PR as small as possible: if for any reason, you need to fix your commit after the pull request, please squash the changes in one single commit (or tell us why not)
* Always make sure it is mergeable in the default branch
* Any major changes adding a functionality should be disabled by default in the configuration.


#### What does it do?

If it fixes an existing issue, please use GitHub syntax: `#<IssueID>`

#### Questions

- [ ] Does it require a DB change?
- [ ] Are you using it in production?

#### Release Type:
- [ ] Major
- [ ] Minor
- [X] Patch
19 changes: 19 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: pre-commit
on:
pull_request:
push:
branches: [master]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: |
pip install reorder-python-imports
pip install pyupgrade
pip install black
pip install pip-audit
- uses: pre-commit/[email protected]
41 changes: 41 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
ci:
autoupdate_schedule: monthly
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
hooks:
- id: pyupgrade
args: ["--py37-plus"]
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
hooks:
- id: reorder-python-imports
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
rev: 1.13.0
hooks:
- id: blacken-docs
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
- flake8-implicit-str-concat
args: ["--max-line-length=125"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: fix-byte-order-marker
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
args: ['--maxkb=800']
- repo: https://github.com/pypa/pip-audit
rev: v2.7.3
hooks:
- id: pip-audit
16 changes: 7 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,29 @@
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'RSTORE'
project = "RSTORE"
copyright = "Computer Incident Response Center Luxembourg (CIRCL) <[email protected]>"
author = "Cédric Bonhomme <[email protected]>"
release = '0.1.0'
release = "0.1.0"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = []

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_book_theme'
html_static_path = ['_static']
html_title = 'RSTORE'
html_theme = "sphinx_book_theme"
html_static_path = ["_static"]
html_title = "RSTORE"
html_theme_options = {
"path_to_docs": "docs",
"repository_url": "https://github.com/scandale-project/RSTORE",
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ In order to compile kvrocks, you will need a few packages:
.. code-block:: bash
git clone --recursive https://github.com/apache/incubator-kvrocks.git kvrocks
git clone --recursive https://github.com/apache/kvrocks.git
cd kvrocks
git checkout v2.9.0
./x.py build
Expand Down
6 changes: 1 addition & 5 deletions instance/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,4 @@
API_URL = "http://127.0.0.1:8000"

AUTHENTICATION_REQUIRED = True
USERS = {
"admin": {
"password": "Password1234!"
}
}
USERS = {"admin": {"password": "Password1234!"}}
119 changes: 118 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ homepage = "https://github.com/scandale-project/RSTORE"
repository = "https://github.com/scandale-project/RSTORE"
documentation = "https://rstore.readthedocs.io"

keywords = ["observations", "evidences", "kvrocks", "api"]
keywords = ["observations", "evidences", "kvrocks", "api", "scanning", "csirt"]

classifiers = [
"Environment :: Console",
Expand All @@ -35,6 +35,7 @@ uvicorn = "^0.30.4"
[tool.poetry.group.dev.dependencies]
mypy = "^1.11.1"
flake8 = "^7.1.0"
pre-commit = "^3.8.0"

[tool.poetry.group.docs]
optional = true
Expand Down
3 changes: 3 additions & 0 deletions rstore/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

http_security = Depends(security)


def verification(creds: HTTPBasicCredentials = http_security):
"""Verify the credentials via HTTP Basic Authentication method."""
if not config.AUTHENTICATION_REQUIRED:
Expand All @@ -38,6 +39,7 @@ def verification(creds: HTTPBasicCredentials = http_security):
headers={"WWW-Authenticate": "Basic"},
)


def custom_openapi() -> Dict[str, Any]:
if app.openapi_schema:
return app.openapi_schema
Expand All @@ -64,6 +66,7 @@ def custom_openapi() -> Dict[str, Any]:
app.openapi_schema = openapi_schema
return app.openapi_schema


app.openapi = custom_openapi


Expand Down
28 changes: 0 additions & 28 deletions rstore/schemas.py
Original file line number Diff line number Diff line change
@@ -1,28 +0,0 @@
import uuid

from pydantic import BaseModel

class Payload(BaseModel):
raw: str


class Meta(BaseModel):
uuid: str
ts: int
type: str


class ScanData(BaseModel):
version: str
format: str
meta: Meta
payload: Payload

class Config:
from_attributes = True

class ItemBase(ScanData):
scan_data: ScanData

class Config:
from_attributes = True

0 comments on commit bc88e16

Please sign in to comment.