From: Thanh Ha Date: Fri, 28 Jul 2017 01:55:28 +0000 (-0400) Subject: Improve .coafile rules using inheritance X-Git-Tag: v0.7.0~12 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F58%2F5658%2F2;p=releng%2Flftools.git Improve .coafile rules using inheritance Fix linting where appropriate. Change-Id: Ife5f944bd3819858486d323ed91a80df7f075d88 Signed-off-by: Thanh Ha --- diff --git a/.coafile b/.coafile index 3b8ea51c..f3678c3a 100644 --- a/.coafile +++ b/.coafile @@ -1,4 +1,12 @@ -[Git] +[all] +ignore = .tox/**, + .git/**, + .gitignore, + .gitreview, + .gitmodules, + node_modules/** + +[all.Git] bears = GitCommitBear ignore_length_regex = Signed-off-by, Also-by, @@ -6,27 +14,28 @@ ignore_length_regex = Signed-off-by, http://, https:// -[Documentation] +[all.Documentation] bears = WriteGoodLintBear files = docs/**/*.rst -[Python] +[all.Python] bears = BanditBear, PEP8Bear, PyCommentedCodeBear, PyDocStyleBear, PyFlakesBear, PyImportSortBear -files = lftools/**/*.py +files = **.py +ignore += docs/conf.py known_first_party_imports = lftools known_third_party_imports = pytest, six pydocstyle_ignore = D203, D213, D301 max_line_length = 120 -[Shell] +[all.Shell] bears = ShellCheckBear, SpaceConsistencyBear -files = shell/* +files = **.sh, shell/* shell = bash indent_size = 4 use_spaces = yeah diff --git a/setup.py b/setup.py index bf6bd581..c96443ed 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,15 @@ +# -*- coding: utf-8 -*- +# SPDX-License-Identifier: EPL-1.0 +############################################################################## +# Copyright (c) 2017 The Linux Foundation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +############################################################################## +"""Setup.py.""" + from setuptools import find_packages from setuptools import setup diff --git a/tests/test_version.py b/tests/test_version.py index a343f17b..10678e4c 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -8,18 +8,15 @@ # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html ############################################################################## +"""Unit tests for the version command.""" -import difflib -from distutils import dir_util import filecmp import os -import click import pytest from lftools import cli - FIXTURE_DIR = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'fixtures', @@ -30,12 +27,14 @@ FIXTURE_DIR = os.path.join( os.path.join(FIXTURE_DIR, 'version_bump'), ) def test_version_bump(cli_runner, datafiles): + """Test version bump command.""" os.chdir(str(datafiles)) - result = cli_runner.invoke(cli.cli, ['version', 'bump', 'TestRelease']) + cli_runner.invoke(cli.cli, ['version', 'bump', 'TestRelease']) for _file in datafiles.listdir(): pom = str(_file) + '/pom.xml' expected_pom = str(_file) + '/pom.xml.expected' + # noqa: B101 . assert filecmp.cmp(pom, expected_pom) @@ -43,10 +42,12 @@ def test_version_bump(cli_runner, datafiles): os.path.join(FIXTURE_DIR, 'version_release'), ) def test_version_release(cli_runner, datafiles): + """Test version release command.""" os.chdir(str(datafiles)) - result = cli_runner.invoke(cli.cli, ['version', 'release', 'TestRelease']) + cli_runner.invoke(cli.cli, ['version', 'release', 'TestRelease']) for _file in datafiles.listdir(): pom = str(_file) + '/pom.xml' expected_pom = str(_file) + '/pom.xml.expected' + # noqa: B101 . assert filecmp.cmp(pom, expected_pom)