Skip to content

Commit

Permalink
feat: add pre-commit and dependabot
Browse files Browse the repository at this point in the history
  • Loading branch information
agusmakmun committed Mar 31, 2024
1 parent 763d9eb commit aa53c5e
Show file tree
Hide file tree
Showing 39 changed files with 329 additions and 299 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
ignore:
# Ignore all patch releases as we can manually
# upgrade if we run into a bug and need a fix.
- dependency-name: "*"
update-types: ["version-update:semver-patch"]
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Run tests

on:
push:
branches:
branches:
- master
pull_request:
branches:
Expand Down
33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
exclude: 'docs/|.etc/'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: ["--profile", "black"]

- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
exclude: tests/test_lowlevel.py

- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
hooks:
- id: pyupgrade
args: [--py37-plus]

- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ RUN apk add --no-cache python3 py3-pip tini; \
USER appuser
EXPOSE 8000/tcp
ENTRYPOINT [ "tini", "--" ]
CMD [ "python3", "/app/martor_demo/manage.py", "runserver", "0.0.0.0:8000" ]
CMD [ "python3", "/app/martor_demo/manage.py", "runserver", "0.0.0.0:8000" ]
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.5'
services:
web:
build: .
ports:
ports:
- "8000:8000"
container_name: martor_demo
restart: unless-stopped
restart: unless-stopped
2 changes: 0 additions & 2 deletions martor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

__VERSION__ = "1.6.43"
__RELEASE_DATE__ = "30-Mar-2024"
__AUTHOR__ = "Agus Makmun (Summon Agus)"
Expand Down
6 changes: 1 addition & 5 deletions martor/admin.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.contrib import admin

from .widgets import AdminMartorWidget
from .models import MartorField
from .widgets import AdminMartorWidget


class MartorModelAdmin(admin.ModelAdmin):

formfield_overrides = {
MartorField: {"widget": AdminMartorWidget},
}
3 changes: 0 additions & 3 deletions martor/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import base64
import json

Expand Down
2 changes: 1 addition & 1 deletion martor/extensions/emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ def handleMatch(self, m):
if emoji not in EMOJIS:
return emoji

url = "{0}{1}.png".format(EMOJI_URL, emoji.replace(":", ""))
url = "{}{}.png".format(EMOJI_URL, emoji.replace(":", ""))
el = ElementTree.Element("img")
el.set("src", url)
el.set("class", "marked-emoji")
Expand Down
2 changes: 1 addition & 1 deletion martor/extensions/mention.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def handleMatch(self, m):

"""Makesure `username` is registered and activated."""
if MARTOR_ENABLE_CONFIGS["mention"] == "true" and users.exists():
url = "{0}{1}/".format(
url = "{}{}/".format(
MARTOR_MARKDOWN_BASE_MENTION_URL, username
) # noqa: E501
el = ElementTree.Element("a")
Expand Down
6 changes: 1 addition & 5 deletions martor/fields.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django import forms

from .settings import MARTOR_ENABLE_LABEL
Expand All @@ -9,12 +6,11 @@

class MartorFormField(forms.CharField):
def __init__(self, *args, **kwargs):

# to setup the editor without label
if not MARTOR_ENABLE_LABEL:
kwargs["label"] = ""

super(MartorFormField, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)

if not issubclass(self.widget.__class__, MartorWidget):
self.widget = MartorWidget()
5 changes: 1 addition & 4 deletions martor/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models

from .fields import MartorFormField
Expand All @@ -10,4 +7,4 @@ class MartorField(models.TextField):
def formfield(self, **kwargs):
defaults = {"form_class": MartorFormField}
defaults.update(kwargs)
return super(MartorField, self).formfield(**defaults)
return super().formfield(**defaults)
3 changes: 0 additions & 3 deletions martor/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.conf import settings

# Choices are: "semantic", "bootstrap"
Expand Down
2 changes: 1 addition & 1 deletion martor/static/martor/css/martor-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,4 @@ fieldset .form-row .main-martor {
.martor-toolbar .ui.basic.buttons .button {
color: #fff !important;
}
}
}
2 changes: 1 addition & 1 deletion martor/static/martor/css/martor-admin.min.css
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@ fieldset .form-row .main-martor {
.martor-toolbar .ui.basic.buttons .button {
color: #fff !important
}
}
}
2 changes: 1 addition & 1 deletion martor/static/martor/css/martor.bootstrap.min.css
Original file line number Diff line number Diff line change
Expand Up @@ -596,4 +596,4 @@ div.martor-preview pre tt {
padding: 0;
background-color: transparent;
border: none
}
}
2 changes: 1 addition & 1 deletion martor/static/martor/css/martor.semantic.min.css
Original file line number Diff line number Diff line change
Expand Up @@ -534,4 +534,4 @@ div.enable-living .martor-preview {

div.enable-living .tab-martor-menu a.item {
display: none !important
}
}
2 changes: 1 addition & 1 deletion martor/static/plugins/css/bootstrap.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion martor/static/plugins/fonts/brand-icons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit aa53c5e

Please sign in to comment.