Skip to content

Commit

Permalink
[pylint] Fix pylint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
csordasmarton committed Nov 6, 2019
1 parent f5a7bf6 commit 730fc0f
Show file tree
Hide file tree
Showing 17 changed files with 19 additions and 41 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ clean_travis:

PYLINT_CMD = $(MAKE) -C $(CC_ANALYZER) pylint && \
$(MAKE) -C $(CC_WEB) pylint && \
pylint ./bin ./codechecker_common ./scripts
pylint ./bin/** ./codechecker_common \
./scripts/** ./scripts/build/** ./scripts/debug_tools/** \
./scripts/gerrit_jenkins/** ./scripts/resources/** \
./scripts/test/** \
--rcfile=$(ROOT)/.pylintrc

pylint:
$(PYLINT_CMD)
Expand Down
2 changes: 1 addition & 1 deletion analyzer/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pycodestyle:
pycodestyle_in_env: venv_dev
$(ACTIVATE_DEV_VENV) && $(PYCODESTYLE_TEST_CMD)

PYLINT_TEST_CMD = pylint ./bin ./cmd ./codechecker_analyzer ./tests \
PYLINT_TEST_CMD = pylint ./bin/** ./codechecker_analyzer ./tests/** \
--rcfile=$(ROOT)/.pylintrc

pylint:
Expand Down
8 changes: 4 additions & 4 deletions analyzer/tests/functional/analyze/test_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ def test_robustness_for_dependencygen_failure(self):
process = subprocess.Popen(
analyze_cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, cwd=self.test_dir)
out, err = process.communicate()
process.communicate()

errcode = process.returncode
self.assertEquals(errcode, 0)
Expand Down Expand Up @@ -554,7 +554,7 @@ def test_invalid_enabled_checker_name(self):
process = subprocess.Popen(
analyze_cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, cwd=self.test_dir)
out, err = process.communicate()
out, _ = process.communicate()

match = self.missing_checker_regex.search(out)
self.assertIsNotNone(match)
Expand Down Expand Up @@ -583,7 +583,7 @@ def test_invalid_disabled_checker_name(self):
process = subprocess.Popen(
analyze_cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, cwd=self.test_dir)
out, err = process.communicate()
out, _ = process.communicate()

match = self.missing_checker_regex.search(out)
self.assertIsNotNone(match)
Expand Down Expand Up @@ -615,7 +615,7 @@ def test_multiple_invalid_checker_names(self):
process = subprocess.Popen(
analyze_cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, cwd=self.test_dir)
out, err = process.communicate()
out, _ = process.communicate()

match = self.missing_checker_regex.search(out)
self.assertIsNotNone(match)
Expand Down
5 changes: 0 additions & 5 deletions analyzer/tests/unit/test_buildcmd_escaping.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
import tempfile
import unittest

try:
from StringIO import StringIO
except ImportError:
from io import BytesIO as StringIO

from codechecker_analyzer.analyzers import analyzer_base
from codechecker_analyzer.buildlog import build_manager
from codechecker_analyzer.buildlog import log_parser
Expand Down
3 changes: 0 additions & 3 deletions analyzer/tests/unit/test_option_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ def test_link_only_multiple_files(self):
"""
Should be link if only object files are in the command.
"""
build_cmd = "g++ -o fubar foo.o main.o bar.o -lm"
action = {
'file': '',
'command': 'g++ -o fubar foo.o main.o bar.o -m',
Expand Down Expand Up @@ -354,8 +353,6 @@ def test_compiler_toolchain(self):
self.assertEqual(BuildAction.COMPILE, res.action_type)

def test_ccache_compiler(self):
action = {'file': 'main.cpp', 'directory': ''}

compiler_action = shlex.split('ccache g++ main.cpp')
res = log_parser.determine_compiler(compiler_action,
self.is_compiler_executable_fun)
Expand Down
1 change: 0 additions & 1 deletion scripts/build/extend_version_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Extend CodeChecker version file with some extra information.
"""
import argparse
import io
import json
import logging
import os
Expand Down
2 changes: 1 addition & 1 deletion scripts/debug_tools/failure_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def get_resource_dir(clang_bin):
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
out, err = proc.communicate()
out, _ = proc.communicate()

if proc.returncode == 0:
return out.decode("utf-8").rstrip()
Expand Down
4 changes: 2 additions & 2 deletions scripts/test/run_server_performance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def parse_arguments():
return parser.parse_args()


class StatManager:
class StatManager(object):
"""
This class stores the statistics of the single user events and prints them
in CSV format. To produce a nice output the users should do the same tasks
Expand Down Expand Up @@ -156,7 +156,7 @@ def print_stats(self, file_name):
writer.writerow([user_id] + map(lambda x: x[1], durations))


class UserSimulator:
class UserSimulator(object):
"""
This class simulates a user who performs actions one after the other. The
durations of the single actions are stored in the statistics.
Expand Down
9 changes: 4 additions & 5 deletions web/tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ pycodestyle:
pycodestyle_in_env: venv_dev
$(ACTIVATE_DEV_VENV) && $(PYCODESTYLE_TEST_CMD)

PYLINT_TEST_CMD = pylint ./bin/codechecker-web-version \
PYLINT_TEST_CMD = pylint ./bin/** \
./codechecker_web \
./client/bin/codechecker-cmd ./client/bin/codechecker-store \
./client/codechecker_client \
./server/bin/codechecker-server ./server/codechecker_server \
./server/tests/unit \
./client/bin/** ./client/codechecker_client \
./server/bin/** ./server/codechecker_server ./server/tests/unit \
./tests/functional ./tests/libtest ./tests/tools \
--rcfile=$(ROOT)/.pylintrc

pylint:
Expand Down
1 change: 0 additions & 1 deletion web/tests/functional/authentication/test_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import json
import os
import re
import subprocess
import unittest

Expand Down
2 changes: 1 addition & 1 deletion web/tests/functional/cmdline/test_cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def test_results_multiple_runs(self):
res_cmd = [self._codechecker_cmd, 'cmd', 'results', 'test_files1*',
'test_files1*', '-o', 'json', '--url', str(self.server_url)]

ret, res, _ = run_cmd(res_cmd, env=check_env)
ret, _, _ = run_cmd(res_cmd, env=check_env)
self.assertEqual(0, ret)

def test_stderr_results(self):
Expand Down
1 change: 0 additions & 1 deletion web/tests/functional/db_cleanup/test_db_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import os
import unittest
from shutil import copyfile, rmtree
import time

from codeCheckerDBAccess_v6.ttypes import *

Expand Down
5 changes: 0 additions & 5 deletions web/tests/functional/diff_local/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ def setup_package():
# Set the TEST_WORKSPACE used by the tests.
os.environ['TEST_WORKSPACE'] = TEST_WORKSPACE

# Get the clang version which is used for testing.
# Important because different clang releases might
# find different errors.
clang_version = env.clang_to_test()

test_config = {}

test_project = 'cpp'
Expand Down
5 changes: 0 additions & 5 deletions web/tests/functional/diff_local_remote/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ def setup_package():
# Set the TEST_WORKSPACE used by the tests.
os.environ['TEST_WORKSPACE'] = TEST_WORKSPACE

# Get the clang version which is used for testing.
# Important because different clang releases might
# find different errors.
clang_version = env.clang_to_test()

test_config = {}

test_project = 'cpp'
Expand Down
2 changes: 0 additions & 2 deletions web/tests/functional/products/test_config_db_share.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import multiprocessing
import os
import shutil
import subprocess
import time
import unittest

from codechecker_api_shared.ttypes import Permission
Expand Down
2 changes: 0 additions & 2 deletions web/tests/functional/ssl/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import subprocess
import unittest

from thrift.protocol.TProtocol import TProtocolException

from codechecker_api_shared.ttypes import RequestFailed

from libtest import codechecker
Expand Down
2 changes: 1 addition & 1 deletion web/tests/libtest/thrift_client_to_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def get_all_run_results(client, run_id, sort_mode=None, filters=None):
False)

offset += len(partial_res)
if len(partial_res) == 0:
if not partial_res:
break
results.extend(partial_res)

Expand Down

0 comments on commit 730fc0f

Please sign in to comment.