diff --git a/.coafile b/.coafile index 9742deea91..f6256180b5 100644 --- a/.coafile +++ b/.coafile @@ -15,6 +15,14 @@ language = python default_actions = *: ApplyPatchAction preferred_quotation = ' +[flakes] +# Do not set default_action to ApplyPatchAction as it may lead to some +# required imports being removed which might result in coala behaving weirdly. +default_action: *: ShowPatchAction +bears = PyUnusedCodeBear +language = Python +remove_all_unused_imports = true + [autopep8] bears = PEP8Bear, PycodestyleBear default_actions = PEP8Bear: ApplyPatchAction diff --git a/bears/Constants.py b/bears/Constants.py index 2a5216b4d2..9c9ad32f0a 100644 --- a/bears/Constants.py +++ b/bears/Constants.py @@ -1,6 +1,8 @@ import os +# Start ignoring PyUnusedCodeBear from bears import VERSION +# Stop ignoring PyUnusedCodeBear # Path to the bears directory bears_root = os.path.dirname(__file__) diff --git a/bears/c_languages/ClangBear.py b/bears/c_languages/ClangBear.py index 69749b33a1..ab28375057 100644 --- a/bears/c_languages/ClangBear.py +++ b/bears/c_languages/ClangBear.py @@ -1,7 +1,6 @@ from clang.cindex import Index, LibclangError from coalib.bears.LocalBear import LocalBear -from dependency_management.requirements.PipRequirement import PipRequirement from coalib.results.Diff import Diff from coalib.results.Result import Result from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY diff --git a/bears/css/StyleLintBear.py b/bears/css/StyleLintBear.py index 42aae579bc..86864d7b39 100644 --- a/bears/css/StyleLintBear.py +++ b/bears/css/StyleLintBear.py @@ -1,4 +1,3 @@ -import os import json from coalib.bearlib.abstractions.Linter import linter from dependency_management.requirements.NpmRequirement import NpmRequirement diff --git a/bears/perl/PerlCriticBear.py b/bears/perl/PerlCriticBear.py index 502062102f..ce00776860 100644 --- a/bears/perl/PerlCriticBear.py +++ b/bears/perl/PerlCriticBear.py @@ -1,5 +1,3 @@ -import platform - from coalib.bearlib.abstractions.Linter import linter from dependency_management.requirements.DistributionRequirement import ( DistributionRequirement) diff --git a/bears/ruby/RubySyntaxBear.py b/bears/ruby/RubySyntaxBear.py index 406b689c9c..53aee8991a 100644 --- a/bears/ruby/RubySyntaxBear.py +++ b/bears/ruby/RubySyntaxBear.py @@ -1,5 +1,4 @@ from coalib.bearlib.abstractions.Linter import linter -from dependency_management.requirements.GemRequirement import GemRequirement from dependency_management.requirements.DistributionRequirement import ( DistributionRequirement) diff --git a/tests/css/StyleLintBearTest.py b/tests/css/StyleLintBearTest.py index 72b37b0162..30c286d3f3 100644 --- a/tests/css/StyleLintBearTest.py +++ b/tests/css/StyleLintBearTest.py @@ -1,5 +1,4 @@ import os -import re from queue import Queue from shutil import which from unittest.case import skipIf @@ -7,7 +6,6 @@ from bears.css.StyleLintBear import StyleLintBear from coalib.testing.LocalBearTestHelper import LocalBearTestHelper from coalib.settings.Section import Section -from coalib.settings.Setting import Setting @skipIf(which('stylelint') is None, 'Stylelint is not installed') diff --git a/tests/haskell/GhcModBearTest.py b/tests/haskell/GhcModBearTest.py index 2ef88242ea..b52c59f789 100644 --- a/tests/haskell/GhcModBearTest.py +++ b/tests/haskell/GhcModBearTest.py @@ -2,10 +2,8 @@ from bears.haskell.GhcModBear import GhcModBear from coalib.testing.LocalBearTestHelper import LocalBearTestHelper -from coalib.testing.LocalBearTestHelper import verify_local_bear from coalib.testing.BearTestHelper import generate_skip_decorator from coalib.settings.Section import Section -from coalib.settings.Setting import Setting # A simple hello world program! diff --git a/tests/haskell/HaskellLintBearTest.py b/tests/haskell/HaskellLintBearTest.py index 0dfd21201d..d0b40c9a35 100644 --- a/tests/haskell/HaskellLintBearTest.py +++ b/tests/haskell/HaskellLintBearTest.py @@ -2,10 +2,9 @@ from bears.haskell.HaskellLintBear import HaskellLintBear from coalib.testing.LocalBearTestHelper import LocalBearTestHelper -from coalib.testing.LocalBearTestHelper import verify_local_bear from coalib.testing.BearTestHelper import generate_skip_decorator from coalib.settings.Section import Section -from coalib.settings.Setting import Setting + good_single_line_file = """ myconcat = (++)