From 4fcc04e4d8143658a9b3eef46a690fa1712d9866 Mon Sep 17 00:00:00 2001 From: Pavel Studenik Date: Wed, 21 Mar 2018 23:18:19 +0100 Subject: [PATCH] pylint and coala checks --- .coafile | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++ .pylintrc | 33 +++++++++++++++++++++++ .travis.yml | 4 ++- README.md | 14 +++++++--- 4 files changed, 124 insertions(+), 5 deletions(-) create mode 100644 .coafile create mode 100644 .pylintrc diff --git a/.coafile b/.coafile new file mode 100644 index 0000000..287ef18 --- /dev/null +++ b/.coafile @@ -0,0 +1,78 @@ +[Default] +files = **.(py|md|rst|yml), tox.ini, .coafile +ignore = (.tox|env|.env|venv)/**, docs/conf.py + +indent_size = 4 +use_spaces = True +max_line_length = 120 +max_lines_per_file = 1000 +file_naming_convention = snake + +space_between_ending_comma_and_closing_bracket = yes +dedent_closing_brackets = yes +coalesce_brackets = yes +blank_line_before_nested_class_or_def = yes + +[filenames] +bears = FilenameBear + +[long-files] +bears = LineCountBear + +[spacing] +ignore = (.tox|env|.env|venv)/**, **.yml, tox.ini, .coafile +bears = SpaceConsistencyBear + +[config-spacing] +files = **.yml, tox.ini, .coafile +bears = SpaceConsistencyBear +indent_size = 2 + +[python-spacing] # Own section needed, otherwise conflicts occur +files = **.py +bears = YapfBear + +[python-docs] +files = **.py +bears = PyDocStyleBear +pydocstyle_ignore = + D100, D101, D102, D103, D104, D105, # Missing docstrings + D203, # 1 blank line required before class docstring + D213, # Multi-line docstring summary should start at the second line + +[python-semantic] +files = **.py +bears = RadonBear, PyUnusedCodeBear +language = python + +[yaml] +files = **.(yml|yaml) +bears = YAMLLintBear +yamllint_config = .yamllint + +[markdown] +files = **.md +bears = MarkdownBear + +[long-lines] # After YapfBear as it might be able to autofix some of those occurrences +bears = LineLengthBear + +[commit] +bears = GitCommitBear +shortlog_length = 72 +ignore_length_regex = https?:// + +[keywords] +files = **.py +bears = KeywordBear +language = python +keywords = TODO, FIXME, pdb.set_trace() # Ignore KeywordBear + +[links] +bears = InvalidLinkBear +# We ignore: +# - example.com (coala default) +# - {}-style formatting (coala default) +# - %s-style formatting +# - gitlab.skypicker.com since it requires auth +link_ignore_regex = ([./]example.com|{|%(?:\(\w+?\))?s|gitlab\.skypicker\.com) diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000..7530e14 --- /dev/null +++ b/.pylintrc @@ -0,0 +1,33 @@ +[MASTER] +# jobs=0 means 'use all CPUs' +jobs=0 + +[MESSAGES CONTROL] +disable = + missing-docstring, + line-too-long, + invalid-name, + no-value-for-parameter, + no-member, + unused-argument, + broad-except, + relative-import, + wrong-import-position, + bare-except, + locally-disabled, + protected-access, + abstract-method, + no-self-use, + fixme, + too-few-public-methods, + super-init-not-called, + too-many-ancestors, + redefined-outer-name, + +[REPORTS] +output-format=colorized + +[FORMAT] +logging-modules= + logging, + structlog, diff --git a/.travis.yml b/.travis.yml index 4bfc42b..f79ba01 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,10 @@ language: python python: - "2.7" env: - - DJANGO=1.10 + - DJANGO=1.11 install: - pip install -r requirement/requirement.txt + - pip install pylint before_script: - git ls-files | grep .sh$ | xargs -l1 bash -n - git ls-files | grep .py$ | xargs python -m py_compile @@ -13,4 +14,5 @@ before_script: - python manage.py collectstatic --noinput - python manage.py migrate --noinput script: + - pylint . apps tttt - python manage.py test apps.core.tests.SimpleTest diff --git a/README.md b/README.md index 1e876a6..0a849f6 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Easy way to run Green Tea is using docker https://registry.hub.docker.com/u/paji ``` docker pull pajinek/greentea -docker run -i -t -p 80:8000 pajinek/greentea +docker run -i -t -p 80:8000 pajinek/greentea ``` If you test project with gained systems from Beaker, then you must fill Beaker's authentication values. @@ -23,7 +23,7 @@ docker run -i -t -p 80:8000 \ -e BEAKER_SERVER= \ -e BEAKER_USER= \ -e BEAKER_PASS= \ -pajinek/greentea +pajinek/greentea ``` or @@ -36,8 +36,8 @@ sudo docker run -i -t -p 80:8000 \ -e BEAKER_SERVER= \ -e BEAKER_USER= \ -e BEAKER_PASS= \ -greentea -``` +greentea +``` Service runs on default port 80 (link on your system is http://localhost/) @@ -69,3 +69,9 @@ Easer way is deploy project by docker by following script: ``` ansible-playbook -i config/hosts.ini docker.yaml ``` + +## Code analysis + +``` +docker run -v=$(pwd):/app -v=/tmp/coala:/cache --workdir=/app coala/base coala --ci +```