mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-13 18:07:00 +00:00
Add tox.ini for python linting
Base file from:c4790b589b/tox.ini
Most failing rules disabled, rather than fixing now Bug: T355090 Change-Id: Ie0f499809d84b94b95dddac9abd433c8f81e04ce (cherry picked from commit28f297f1f7
)
This commit is contained in:
parent
ab98badbb6
commit
333663f443
|
@ -33,7 +33,6 @@ import os
|
|||
import sys
|
||||
import re
|
||||
import multiprocessing
|
||||
import time
|
||||
|
||||
try:
|
||||
from PIL import Image
|
||||
|
@ -198,13 +197,13 @@ def run_in_thread(object):
|
|||
fontsize = object[5]
|
||||
|
||||
for i in range(count):
|
||||
word = pick_word(words, badwordlist, verbose, opts.number_words, opts.min_length, opts.max_length)
|
||||
word = pick_word(words, badwordlist, opts.verbose, opts.number_words, opts.min_length, opts.max_length)
|
||||
salt = "%08x" % random.randrange(2**32)
|
||||
# 64 bits of hash is plenty for this purpose
|
||||
md5hash = hashlib.md5((key+salt+word+key+salt).encode('utf-8')).hexdigest()[:16]
|
||||
filename = "image_%s_%s.png" % (salt, md5hash)
|
||||
if opts.dirs:
|
||||
subdir = gen_subdir(opts.output, md5hash, dirs)
|
||||
subdir = gen_subdir(opts.output, md5hash, opts.dirs)
|
||||
filename = os.path.join(subdir, filename)
|
||||
if opts.verbose:
|
||||
print(filename)
|
||||
|
|
|
@ -33,7 +33,6 @@ import os
|
|||
import sys
|
||||
import re
|
||||
import multiprocessing
|
||||
import time
|
||||
|
||||
try:
|
||||
from PIL import Image
|
||||
|
@ -215,13 +214,13 @@ def run_in_thread(object):
|
|||
fontsize = object[5]
|
||||
|
||||
for i in range(count):
|
||||
word = pick_word(words, badwordlist, verbose, opts.number_words, opts.min_length, opts.max_length)
|
||||
word = pick_word(words, badwordlist, opts.verbose, opts.number_words, opts.min_length, opts.max_length)
|
||||
salt = "%08x" % random.randrange(2**32)
|
||||
# 64 bits of hash is plenty for this purpose
|
||||
md5hash = hashlib.md5((key+salt+word+key+salt).encode('utf-8')).hexdigest()[:16]
|
||||
filename = "image_%s_%s.png" % (salt, md5hash)
|
||||
if opts.dirs:
|
||||
subdir = gen_subdir(opts.output, md5hash, dirs)
|
||||
subdir = gen_subdir(opts.output, md5hash, opts.dirs)
|
||||
filename = os.path.join(subdir, filename)
|
||||
if opts.verbose:
|
||||
print(filename)
|
||||
|
|
34
tox.ini
Normal file
34
tox.ini
Normal file
|
@ -0,0 +1,34 @@
|
|||
[tox]
|
||||
|
||||
# Ensure 1.6+ is used to support 'skipsdist'
|
||||
minversion = 1.6
|
||||
|
||||
# Do not run install command
|
||||
skipsdist = True
|
||||
|
||||
# Environements to execute when invoking 'tox'
|
||||
envlist = flake8
|
||||
|
||||
[testenv:flake8]
|
||||
commands = flake8
|
||||
deps = flake8
|
||||
basepython = python3
|
||||
|
||||
[flake8]
|
||||
exclude = .tox
|
||||
max_line_length = 80
|
||||
; E128 continuation line under-indented for visual indent
|
||||
; E201 whitespace after '('
|
||||
; E202 whitespace before ')'
|
||||
; E225 missing whitespace around operator
|
||||
; E226 missing whitespace around arithmetic operator
|
||||
; E231 missing whitespace after ','
|
||||
; E261 at least two spaces before inline comment
|
||||
; E302 expected 2 blank lines, found 1
|
||||
; E305 expected 2 blank lines after class or function definition, found 1
|
||||
; E501 line too long (X > 80 characters)
|
||||
; E711 comparison to None should be 'if cond is None:'
|
||||
; E722 do not use bare 'except'
|
||||
; W191 indentation contains tabs
|
||||
; W503 line break before binary operator
|
||||
ignore = E128,E201,E202,E225,E226,E302,E305,E231,E261,E501,E711,E722,W191,W503
|
Loading…
Reference in a new issue