Skip to content

Commit

Permalink
chore: linting and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hairmare committed Jan 31, 2022
1 parent a05ec55 commit 979785c
Show file tree
Hide file tree
Showing 18 changed files with 406 additions and 321 deletions.
33 changes: 33 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[flake8]
ignore =
# whitespace before ':'
E203,
# too many leading ### in a block comment
E266,
# line too long (managed by black)
E501,
# Line break occurred before a binary operator (this is not PEP8 compatible)
W503,
# Missing docstring in public module
D100,
# Missing docstring in public class
D101,
# Missing docstring in public method
D102,
# Missing docstring in public function
D103,
# Missing docstring in public package
D104,
# Missing docstring in magic method
D105,
# Missing docstring in public package
D106,
# Missing docstring in __init__
D107,
# needed because of https://github.com/ambv/black/issues/144
D202,
# other string does contain unindexed parameters
P103
max-line-length = 80
exclude = migrations snapshots
max-complexity = 10
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 2
updates:
# Update pip dependencies
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "feat(deps): "
prefix-development: "chore(deps): "
open-pull-requests-limit: 20
# Update Dockerfile
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "feat: "
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "chore(ci): "
open-pull-requests-limit: 10
36 changes: 36 additions & 0 deletions .github/workflows/lint-and-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Lint and Test

on:
push:
branches-ignore:
- main
- gh-pages
pull_request:

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]

- name: Setup Python
uses: actions/setup-python@v2

- run: pip install -r requirements-dev.txt

- name: Run pre-commit
uses: pre-commit/[email protected]

pytest:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]

- name: Setup Python
uses: actions/setup-python@v2

- run: pip install -r requirements-dev.txt

- run: pytest
7 changes: 7 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[settings]
known_first_party=nowplaying
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
combine_as_imports=True
line_length=88
32 changes: 32 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
repos:
- repo: local
hooks:
- id: black
name: black
language: system
entry: black
types: [python]
- id: isort
name: isort
language: system
entry: isort
types: [python]
- id: flake8
name: flake8
language: system
entry: flake8
types: [python]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: trailing-whitespace
exclude: ^src/api/client.js$
- id: end-of-file-fixer
exclude: ^src/api/client.js$
- id: check-symlinks
- id: check-merge-conflict
- id: check-case-conflict
- id: detect-aws-credentials
args:
- --allow-missing-credentials
- id: detect-private-key
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

11 changes: 0 additions & 11 deletions .travis/rpm.sh

This file was deleted.

3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.formatting.provider": "black"
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018
Copyright (c) 2018

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
15 changes: 1 addition & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,6 @@ ACRCloud client that fetches data on our playout history and formats them in a C

## Installation

### [Open Build Service](https://openbuildservice.org/)

There are pre-built binary packages for CentOS 7 available on [Radio RaBe's OBS sendemeldungs package repository](https://build.opensuse.org/project/show/home:radiorabe:sendemeldung), which can be installed as follows:

```bash
curl -o /etc/yum.repos.d/home:radiorabe:sendemeldung.repo \
http://download.opensuse.org/repositories/home:/radiorabe:/sendemeldung/CentOS_7/home:radiorabe:sendemeldung.repo

yum install suisa_sendemeldung
```

### Docker

You can build a Docker image using the included [Dockerfile](Dockerfile):

```bash
Expand Down Expand Up @@ -89,7 +76,7 @@ optional arguments:
--filename FILENAME file to write to (default: <script_name>_<start_date>.csv) [env var: FILENAME]
--stdout also print to stdout [env var: STDOUT]
```

## Configuration

You can configure this script either with a configuration file (default is `suisa_sendemeldung.conf`), environment variables or command line arguments as shown above.
Expand Down
5 changes: 0 additions & 5 deletions renovate.json

This file was deleted.

17 changes: 17 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-r requirements.txt
black==22.1.0
flake8==4.0.1
flake8-debugger==4.0.0
flake8-docstrings==1.6.0
flake8-isort==4.1.1
flake8-string-format==0.3.0
flake8-tuple==0.4.1
isort==5.10.1
mock==4.0.3
pytest==6.2.5
pytest-cov==3.0.0
pytest-env==0.6.2
pytest-pylint==0.18.0
twine==3.7.1
types-requests==2.27.7
wheel==0.37.1
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ConfigArgParse
pytz
requests
ConfigArgParse==1.5.3
pytz==2021.3
requests==2.27.1
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[metadata]
description-file = README.md

[tool:pytest]
addopts = --doctest-modules --cov=suisa_sendemeldung --pylint
33 changes: 19 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
from setuptools import setup
"""Set up suisa_sendemeldung."""

from setuptools import setup

with open('requirements.txt') as f:
with open("requirements.txt", encoding="utf-8") as f:
requirements = f.read().splitlines()


setup(name='suisa_sendemeldung',
description='ACRCloud client for SUISA reporting',
url='http://github.com/radiorabe/suisa_reporting',
author='RaBe IT-Reaktion',
author_email='[email protected]',
license='MIT',
install_requires=requirements,
packages=['suisa_sendemeldung'],
entry_points = {
'console_scripts': ['suisa_sendemeldung=suisa_sendemeldung.suisa_sendemeldung:main'],
},
zip_safe=True)
setup(
name="suisa_sendemeldung",
description="ACRCloud client for SUISA reporting",
url="http://github.com/radiorabe/suisa_reporting",
author="RaBe IT-Reaktion",
author_email="[email protected]",
license="MIT",
install_requires=requirements,
packages=["suisa_sendemeldung"],
entry_points={
"console_scripts": [
"suisa_sendemeldung=suisa_sendemeldung.suisa_sendemeldung:main"
],
},
zip_safe=True,
)
108 changes: 0 additions & 108 deletions suisa_sendemeldung.spec

This file was deleted.

Loading

0 comments on commit 979785c

Please sign in to comment.