Improve .coafile rules using inheritance 58/5658/2
authorThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 28 Jul 2017 01:55:28 +0000 (21:55 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Fri, 28 Jul 2017 01:55:30 +0000 (21:55 -0400)
Fix linting where appropriate.

Change-Id: Ife5f944bd3819858486d323ed91a80df7f075d88
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
.coafile
setup.py
tests/test_version.py

index 3b8ea51..f3678c3 100644 (file)
--- 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
index bf6bd58..c96443e 100644 (file)
--- 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
 
index a343f17..10678e4 100644 (file)
@@ -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)