Skip to content

Commit

Permalink
Merge pull request #27 from soda480/0.3.2
Browse files Browse the repository at this point in the history
Add pybuilder build plugins
  • Loading branch information
soda480 authored Mar 24, 2021
2 parents f1ab2a2 + 7c64f29 commit 9294ef4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 41 deletions.
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,7 @@ rest GET /rate_limit --raw
### Development ###
Ensure the latest version of Docker is installed on your development server.
Clone the repository:
```bash
cd
git clone https://github.com/soda480/rest3client.git
cd rest3client
```
Ensure the latest version of Docker is installed on your development server. Fork and clone the repository.
Build the Docker image:
```sh
Expand Down
45 changes: 12 additions & 33 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,27 @@
from pybuilder.core import use_plugin
from pybuilder.core import init
from pybuilder.core import Author
from pybuilder.core import task
from pybuilder.pluginhelper.external_command import ExternalCommandBuilder

use_plugin('python.core')
use_plugin('python.unittest')
use_plugin('python.install_dependencies')
use_plugin('python.flake8')
use_plugin('python.coverage')
use_plugin('python.distutils')
use_plugin('pypi:pybuilder_radon', '~=0.1.2')
use_plugin('pypi:pybuilder_bandit', '~=0.1.3')

name = 'rest3client'
authors = [
Author('Emilio Reyes', 'emilio.reyes@intel.com')
]
authors = [Author('Emilio Reyes', 'emilio.reyes@intel.com')]
summary = 'An abstraction of the requests library providing a simpler API for consuming HTTP REST APIs'
url = 'https://github.com/soda480/rest3client'
version = '0.3.1'
version = '0.3.2'
default_task = [
'clean',
'analyze',
'cyclomatic_complexity',
'package'
]
'radon',
'bandit',
'package']
license = 'Apache License, Version 2.0'
description = summary

Expand All @@ -58,8 +56,7 @@ def set_properties(project):
project.set_property('distutils_readme_description', True)
project.set_property('distutils_description_overwrite', True)
project.set_property('distutils_upload_skip_existing', True)
project.set_property('distutils_console_scripts',
['rest = rest3client.rest:main'])
project.set_property('distutils_console_scripts', ['rest = rest3client.rest:main'])
project.set_property('distutils_classifiers', [
'Development Status :: 4 - Beta',
'Environment :: Console',
Expand All @@ -73,25 +70,7 @@ def set_properties(project):
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: System :: Networking',
'Topic :: System :: Systems Administration'
])


@task('cyclomatic_complexity', description='calculates and publishes cyclomatic complexity')
def cyclomatic_complexity(project, logger):
try:
command = ExternalCommandBuilder('radon', project)
command.use_argument('cc')
command.use_argument('-a')
result = command.run_on_production_source_files(logger)
if len(result.error_report_lines) > 0:
logger.error(f'Errors while running radon, see {result.error_report_file}')
for line in result.report_lines[:-1]:
logger.debug(line.strip())
if not result.report_lines:
return
average_complexity_line = result.report_lines[-1].strip()
logger.info(average_complexity_line)

except Exception as exception:
print(f'Unable to execute cyclomatic complexity due to ERROR: {exception}')
'Topic :: System :: Systems Administration'])
project.set_property('radon_break_build_average_complexity_threshold', 3.6)
project.set_property('radon_break_build_complexity_threshold', 14)
project.set_property('bandit_break_build', True)

0 comments on commit 9294ef4

Please sign in to comment.