Skip to content

Commit

Permalink
Merge pull request #27 from Pavel-Sushko/refactor
Browse files Browse the repository at this point in the history
Refactor
  • Loading branch information
Pavel-Sushko committed May 26, 2023
2 parents f1cc788 + e8b20a6 commit 6aad7cf
Show file tree
Hide file tree
Showing 17 changed files with 91 additions and 76 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[run]
source =
cve_tracker
cve-py
tests
omit =
*/__init__.py
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ name: 'Dependency Review'
on: [pull_request]

permissions:
contents: read
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: 'Dependency Review'
uses: actions/dependency-review-action@v2
dependency-review:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
- name: 'Dependency Review'
uses: actions/dependency-review-action@v2
51 changes: 25 additions & 26 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,33 @@
name: Python application

on:
pull_request:
branches: [ "main" ]
pull_request:
branches: ['main']

permissions:
contents: read
contents: read

jobs:
build:
build:
runs-on: ubuntu-latest

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install flake8 pytest
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install flake8 pytest pytest-cov
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
44 changes: 22 additions & 22 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: main",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/src/cve_tracker/main.py",
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
}
]
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: main",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/src/cve_py/main.py",
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
}
]
}
16 changes: 13 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"python.testing.pytestArgs": ["-ra", "-s", "-v", "--strict-markers", "--no-cov"],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false
"python.testing.pytestArgs": [
"-ra",
"-s",
"-v",
"--strict-markers",
"--no-cov"
],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
},
"python.formatting.provider": "none"
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["setuptools>=42", "wheel"]
requires = ["setuptools>=42"]
build-backend = "setuptools.build_meta"
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[pytest]
addopts = -ra -s -v --strict-markers --cov=cve_tracker --cov-config=.coveragerc
addopts = -ra -s -v --strict-markers --cov=cve_py --cov-config=.coveragerc
markers =
slow: mark a test as slow (deselect with '-m "not slow"')
integration: mark a test as an integration test
Expand Down
24 changes: 15 additions & 9 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
[metadata]
name = cve_tracker
name = cve-py
version = 1.2.0
description = Tracks CVEs, stores them in a local database, and sends email reports
long_description = file: README.md
long_description_content_type = text/markdown
author = Pavel Sushko
license = MIT
license_file = LICENSE
platforms = unix, linux, osx, cygwin, win32
license_files = LICENSE

classifiers =
Development Status :: 5 - Production/Stable
Environment :: Console
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Operating System :: MacOS :: MacOS X
Operating System :: Microsoft :: Windows
Operating System :: POSIX :: Linux
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Expand All @@ -18,19 +26,17 @@ classifiers =
Programming Language :: Python :: 3.11

[options]
packages =
cve_tracker
packages = find:
package_dir =
=src
install_requires =
defusedxml >= 0.7.1
requests >= 2.28.2
pytest-cov >= 4.0.0
google-api-core >= 2.11.0
google-api-python-client >= 2.82.0
google-auth >= 2.16.3
google-auth-httplib2 >= 0.1.0
google-auth-oauthlib >= 1.0.0
googleapis-common-protos >= 1.59.0
python_requires = >= 3.6
package_dir =
=src
python_requires = >=3.6,<3.12
zip_safe = no
File renamed without changes.
4 changes: 2 additions & 2 deletions src/cve_tracker/main.py → src/cve_py/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import cve_tracker.api as api
import cve_tracker.database as database
import cve_py.api as api
import cve_py.database as database


def main():
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/cve_tracker/args.py → src/cve_py/args.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import argparse
from modules.version import __version__
from cve_py.version import __version__


def init():
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/database_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import glob
import copy
import cve_tracker.api as api
import cve_tracker.database as database
import cve_py.api as api
import cve_py.database as database
import distutils
import json
import os
Expand Down

0 comments on commit 6aad7cf

Please sign in to comment.