Skip to content

Commit c53156d

Browse files
author
Vladimir Kotal
committed
use flake8
1 parent c10487c commit c53156d

File tree

15 files changed

+29
-52
lines changed

15 files changed

+29
-52
lines changed

opengrok-indexer/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ Portions Copyright (c) 2017-2018, Chris Fraire <[email protected]>.
463463
</execution>
464464
</executions>
465465
<configuration>
466-
<executable>pep8</executable>
466+
<executable>flake8</executable>
467467
<arguments>
468468
<argument>-v</argument>
469469
<argument>--exclude=filelock.py,test_command.py,test_commands.py</argument>

scripts/before_install

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
#!/bin/bash
22

3-
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -qq; fi
43
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
5-
sudo apt-get install -qq exuberant-ctags cvs git mercurial cssc bzr subversion monotone rcs pep8;
4+
sudo apt-get update -qq
5+
sudo apt-get install -qq exuberant-ctags cvs git mercurial cssc bzr subversion monotone rcs python3 python3-pip pep8;
6+
sudo ./scripts/install-bitkeeper.sh
7+
sudo pip3 install --upgrade pip
8+
sudo pip3 install flake8
9+
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
10+
brew update
11+
brew install ctags cvs
12+
brew upgrade python
13+
pip3 install pep8 flake8
614
fi
7-
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo ./scripts/install-bitkeeper.sh; fi
8-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
9-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install ctags cvs; fi
10-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then pip install pep8; fi

tools/command.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import os
2525
import logging
2626
import subprocess
27-
import string
2827
import threading
2928
import time
3029
import resource

tools/commands.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
#
2323

2424
import logging
25-
import os
26-
import command
2725
from command import Command
2826
from opengrok import put, post, delete
2927
from utils import is_web_uri

tools/deploy.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@
2525
import os
2626
import sys
2727
import argparse
28-
from utils import get_command, is_exe
28+
from utils import get_command
2929
from command import Command
30-
import string
3130
import tempfile
32-
from shutil import copyfile, rmtree
31+
from shutil import copyfile
3332
import logging
3433

3534

@@ -57,7 +56,7 @@ def repack_war(logger, sourceWar, targetWar, configFile, defaultConfigFile):
5756
if not unzip_cmd:
5857
raise "unzip not found"
5958

60-
extract_cmd = [unzip]
59+
extract_cmd = [unzip_cmd]
6160
compress_cmd = [zip_cmd, '-rf']
6261

6362
# Resolve the full path. This is needed if sourceWar is specified as

tools/hook.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2222
#
2323

24-
import os
2524
from command import Command
26-
import logging
2725

2826

2927
def run_hook(logger, script, path, env, timeout):

tools/indexer.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,8 @@
2525
import os
2626
import sys
2727
import argparse
28-
from utils import get_command, is_exe
28+
from utils import get_command
2929
from command import Command
30-
import string
31-
import tempfile
32-
from shutil import copyfile, rmtree
33-
import platform
3430
from java import Java, get_javaparser
3531
import logging
3632

tools/mirror.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,18 @@
3131

3232

3333
import argparse
34-
import subprocess
35-
import time
3634
import os
3735
import sys
38-
from os import path
3936
import filelock
4037
from filelock import Timeout
41-
import command
42-
from command import Command
4338
import logging
4439
from logging.handlers import RotatingFileHandler
4540
import tempfile
46-
import commands
47-
from repository import Repository
48-
from mercurial import MercurialRepository
4941
from repofactory import get_repository
5042
from utils import is_exe, check_create_dir, get_int, diff_list
5143
from hook import run_hook
5244
from readconfig import read_config
5345
from opengrok import get_repos, get_config_value, get_repo_type
54-
from shutil import which
5546
import re
5647

5748

@@ -113,7 +104,7 @@
113104
# Make sure the log directory exists.
114105
logdir = config.get("logdir")
115106
if logdir:
116-
check_create_dir(logdir)
107+
check_create_dir(logger, logdir)
117108

118109
uri = args.uri
119110
if not uri:

tools/opengrok.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2222
#
2323

24-
import logging
2524
import requests
2625
import urllib.parse
2726
import traceback
@@ -32,7 +31,7 @@ def get(logger, uri, params=None, headers=None):
3231
try:
3332
proxies = get_proxies(uri)
3433
return requests.get(uri, params=params, proxies=proxies)
35-
except Exception as e:
34+
except Exception:
3635
logger.debug(traceback.format_exc())
3736
return None
3837

@@ -41,7 +40,7 @@ def delete(logger, uri, params=None, headers=None):
4140
try:
4241
proxies = get_proxies(uri)
4342
return requests.delete(uri, params=params, proxies=proxies)
44-
except Exception as e:
43+
except Exception:
4544
logger.debug(traceback.format_exc())
4645
return None
4746

@@ -51,7 +50,7 @@ def post(logger, uri, headers=None, data=None):
5150
try:
5251
proxies = get_proxies(uri)
5352
rv = requests.post(uri, data=data, headers=headers, proxies=proxies)
54-
except Exception as e:
53+
except Exception:
5554
logger.debug(traceback.format_exc())
5655
return None
5756

@@ -63,7 +62,7 @@ def put(logger, uri, headers=None, data=None):
6362
try:
6463
proxies = get_proxies(uri)
6564
rv = requests.put(uri, data=data, headers=headers, proxies=proxies)
66-
except Exception as e:
65+
except Exception:
6766
logger.debug(traceback.format_exc())
6867
return None
6968

tools/readconfig.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def read_config(logger, inputfile):
4343
try:
4444
logger.debug("trying JSON")
4545
cfg = json.loads(data)
46-
except:
46+
except json.decoder.JSONDecodeError:
4747
# Not a valid JSON file.
4848
logger.debug("got exception {}".format(sys.exc_info()[0]))
4949
pass
@@ -53,13 +53,13 @@ def read_config(logger, inputfile):
5353
try:
5454
logger.debug("trying YAML")
5555
cfg = yaml.load(data)
56-
except:
56+
except AttributeError:
5757
# Not a valid YAML file.
5858
logger.debug("got exception {}".format(sys.exc_info()[0]))
5959
pass
6060
else:
6161
return cfg
62-
except IOError as e:
62+
except IOError:
6363
logger.error("cannot open '{}'".format(inputfile))
6464

6565
return cfg

0 commit comments

Comments
 (0)