Skip to content

Commit 66a1d2d

Browse files
authored
Merge pull request #3 from acdha/packaging-updates
Packaging updates
2 parents 5197dc4 + f4b9170 commit 66a1d2d

File tree

7 files changed

+51
-7
lines changed

7 files changed

+51
-7
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git
2+
.eggs

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# See http://editorconfig.org for format details and
2+
# http://editorconfig.org/#download for editor / IDE integration
3+
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 4
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
end_of_line = lf
12+
charset = utf-8
13+
14+
# Makefiles always use tabs for indentation
15+
[Makefile]
16+
indent_style = tab

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Run this exposing the directory of your choice as the /code volume:
22
# docker run -i --rm --volume "$(pwd)":/code flake8-codeclimate > codeclimate.json
33

4-
FROM pypi/flake8
5-
MAINTAINER cadams@loc.gov
4+
FROM python:slim
5+
LABEL maintainer="cadams@loc.gov"
66

77
RUN pip install --upgrade pip
88
RUN pip install flake8-codeclimate

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
GIT_VERSION := $(shell python setup.py --version)
2+
3+
all: docker
4+
5+
docker:
6+
docker build -t flake8-codeclimate:latest .
7+
@if [[ "${GIT_VERSION}" != *"+"* ]]; then \
8+
docker tag flake8-codeclimate:latest flake8-codeclimate:${GIT_VERSION}; \
9+
fi

flake8_codeclimate.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@
77
88
"""
99

10+
import json
11+
12+
from flake8.formatting import base
13+
from pkg_resources import DistributionNotFound, get_distribution
14+
1015
__author__ = 'Ben Lopatin'
11-
__version__ = '0.1.0'
1216
__license__ = 'MIT'
1317

14-
15-
import json
16-
from flake8.formatting import base
18+
try:
19+
__version__ = get_distribution(__name__).version
20+
except DistributionNotFound:
21+
# package is not installed
22+
pass
1723

1824

1925
category_complexity = "Complexity"
@@ -72,6 +78,7 @@ def error_category(error):
7278

7379
class JSONFormatter(base.BaseFormatter):
7480
"""Formatter for Code Climate JSON reporting"""
81+
7582
def format(self, error):
7683
return json.dumps({
7784
"type": "issue",

setup.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
11
[bdist_wheel]
22
universal = 1
3+
4+
[pycodestyle]
5+
max-line-length=110
6+
7+
[isort]
8+
default_section=THIRDPARTY

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import with_statement
2+
23
import setuptools
34

45
requires = [
@@ -10,13 +11,16 @@
1011
setuptools.setup(
1112
name="flake8_codeclimate",
1213
license="MIT",
13-
version="0.1.3",
14+
use_scm_version=True,
1415
description="Code Climate reporting formatter plugin for Flake8",
1516
long_description=readme,
1617
author="Ben Lopatin",
1718
author_email="ben@benlopatin.com",
1819
url="https://github.com/bennylope/flake8-codeclimate",
1920
py_modules=['flake8_codeclimate'],
21+
setup_requires=[
22+
'setuptools_scm',
23+
],
2024
install_requires=requires,
2125
entry_points={
2226
'flake8.report': [

0 commit comments

Comments
 (0)