mirror of
https://github.com/kristoferssolo/FOSSDB.git
synced 2026-02-04 14:52:11 +00:00
Changed flake8 to ruff
This commit is contained in:
25
.github/workflows/lint.yml
vendored
25
.github/workflows/lint.yml
vendored
@@ -1,25 +0,0 @@
|
|||||||
name: Lint
|
|
||||||
on:
|
|
||||||
- push
|
|
||||||
- pull_request
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest]
|
|
||||||
python-version: ["3.10"]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
|
||||||
uses: actions/setup-python@v2
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install mypy flake8
|
|
||||||
- name: Lint with mypy
|
|
||||||
run: mypy FOSSDB_web
|
|
||||||
- name: Lint with flake8
|
|
||||||
run: flake8 FOSSDB_web
|
|
||||||
8
.github/workflows/ruff.yml
vendored
Normal file
8
.github/workflows/ruff.yml
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
name: Ruff
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
ruff:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- uses: chartboost/ruff-action@v1
|
||||||
23
.github/workflows/test.yml
vendored
23
.github/workflows/test.yml
vendored
@@ -1,23 +1,18 @@
|
|||||||
name: Test
|
name: Django Test
|
||||||
on:
|
on: [push, pull_request]
|
||||||
- push
|
|
||||||
- pull_request
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ubuntu-latest]
|
|
||||||
python-version: ["3.10"]
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout code
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
uses: actions/checkout@v2
|
||||||
uses: actions/setup-python@v2
|
- name: Set up Python
|
||||||
|
uses: actions/setup_python@v2
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: "3.10"
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
- name: Test with django test
|
- name: Run tests
|
||||||
run: python manage.py test
|
run: python manage.py test
|
||||||
|
|||||||
@@ -14,13 +14,16 @@ User = settings.AUTH_USER_MODEL
|
|||||||
|
|
||||||
|
|
||||||
class Project(models.Model):
|
class Project(models.Model):
|
||||||
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
uuid = models.UUIDField(
|
||||||
|
primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
author = models.ForeignKey(User, on_delete=models.CASCADE, db_index=True)
|
author = models.ForeignKey(User, on_delete=models.CASCADE, db_index=True)
|
||||||
name = models.CharField(max_length=255)
|
name = models.CharField(max_length=255)
|
||||||
description = models.TextField(blank=True, default="")
|
description = models.TextField(blank=True, default="")
|
||||||
licenses = models.ManyToManyField(License)
|
licenses = models.ManyToManyField(License)
|
||||||
programming_languages = models.ManyToManyField(ProgrammingLanguage, through="ProjectProgrammingLanguage", related_name="projects")
|
programming_languages = models.ManyToManyField(
|
||||||
hosting_platform = models.ManyToManyField(HostingPlatform, through="ProjectHostingPlatform", related_name="projects")
|
ProgrammingLanguage, through="ProjectProgrammingLanguage", related_name="projects")
|
||||||
|
hosting_platform = models.ManyToManyField(
|
||||||
|
HostingPlatform, through="ProjectHostingPlatform", related_name="projects")
|
||||||
tag = models.ManyToManyField(Tag)
|
tag = models.ManyToManyField(Tag)
|
||||||
os = models.ManyToManyField(OperatingSystem)
|
os = models.ManyToManyField(OperatingSystem)
|
||||||
star = models.ManyToManyField(Star, related_name="projects_star")
|
star = models.ManyToManyField(Star, related_name="projects_star")
|
||||||
@@ -38,5 +41,6 @@ class Project(models.Model):
|
|||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
if not self.uuid:
|
if not self.uuid:
|
||||||
self.uuid = uuid.uuid3(uuid.uuid4(), f"{self.author.username}-{self.name}")
|
self.uuid = uuid.uuid3(
|
||||||
|
uuid.uuid4(), f"{self.author.username}-{self.name}")
|
||||||
super().save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
|
|||||||
@@ -15,3 +15,6 @@ warn_redundant_casts = true
|
|||||||
warn_return_any = true
|
warn_return_any = true
|
||||||
warn_unreachable = true
|
warn_unreachable = true
|
||||||
warn_unused_configs = true
|
warn_unused_configs = true
|
||||||
|
|
||||||
|
[tool.ruff]
|
||||||
|
line-length = 160
|
||||||
|
|||||||
@@ -1,5 +1,2 @@
|
|||||||
flake8==6.0.0
|
|
||||||
mypy==0.991
|
mypy==0.991
|
||||||
pytest-cov==4.0.0
|
ruff==0.0.262
|
||||||
pytest==7.2.0
|
|
||||||
tox==3.27.1
|
|
||||||
|
|||||||
35
setup.cfg
35
setup.cfg
@@ -1,35 +0,0 @@
|
|||||||
[metadata]
|
|
||||||
name = FOSSDB
|
|
||||||
description = Free and Open-Source Software Database Website
|
|
||||||
author = Kristofers Solo
|
|
||||||
license = GPL3
|
|
||||||
license_files = LICENSE
|
|
||||||
platforms = unix, linux, osx, cygwin, win32
|
|
||||||
classifiers =
|
|
||||||
Programming Language :: Python :: 3.10
|
|
||||||
|
|
||||||
[options]
|
|
||||||
packages = FOSSDB
|
|
||||||
install_requires =
|
|
||||||
Django>=4.1
|
|
||||||
Pillow>=9.4.0
|
|
||||||
fontawesomefree>=6.2.1
|
|
||||||
mysqlclient>=2.1.1
|
|
||||||
|
|
||||||
python_requires = >=3.10
|
|
||||||
package_dir = =.
|
|
||||||
zip_safe = no
|
|
||||||
|
|
||||||
[options.extras_require]
|
|
||||||
testing =
|
|
||||||
flake8>=6.0.0
|
|
||||||
mypy>=0.991
|
|
||||||
pytest-cov>=4.0.0
|
|
||||||
pytest>=7.2.0
|
|
||||||
tox>=3.27.1
|
|
||||||
|
|
||||||
[options.package_data]
|
|
||||||
detector = py.typed
|
|
||||||
|
|
||||||
[flake8]
|
|
||||||
max-line-length = 160
|
|
||||||
4
setup.py
4
setup.py
@@ -1,4 +0,0 @@
|
|||||||
from setuptools import setup
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
setup()
|
|
||||||
25
tox.ini
25
tox.ini
@@ -1,25 +0,0 @@
|
|||||||
[tox]
|
|
||||||
minversion = 3.8.0
|
|
||||||
envlist = django, flake8, mypy
|
|
||||||
isolated_build = true
|
|
||||||
|
|
||||||
[gh-actions]
|
|
||||||
python =
|
|
||||||
3.10: django, mypy, flake8
|
|
||||||
|
|
||||||
|
|
||||||
[testenv:django]
|
|
||||||
basepython = python3.10
|
|
||||||
deps = django
|
|
||||||
commands = python manage.py test
|
|
||||||
|
|
||||||
[testenv:flake8]
|
|
||||||
basepython = python3.10
|
|
||||||
deps = flake8
|
|
||||||
commands = flake8 FOSSDB
|
|
||||||
|
|
||||||
[testenv:mypy]
|
|
||||||
basepython = python3.10
|
|
||||||
deps =
|
|
||||||
-r{toxinidir}/requirements_dev.txt
|
|
||||||
commands = mypy FOSSDB
|
|
||||||
Reference in New Issue
Block a user