bomquote/transistor

View on GitHub

Showing 220 of 220 total issues

Missing whitespace around operator
Open

        self.items['number']=self.spider.number
Severity: Minor
Found in transistor/persistence/loader.py by pep8

Surround operators with a single space on either side.

- Always surround these binary operators with a single space on
  either side: assignment (=), augmented assignment (+=, -= etc.),
  comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
  Booleans (and, or, not).

- If operators with different priorities are used, consider adding
  whitespace around the operators with the lowest priorities.

Okay: i = i + 1
Okay: submitted += 1
Okay: x = x * 2 - 1
Okay: hypot2 = x * x + y * y
Okay: c = (a + b) * (a - b)
Okay: foo(bar, key='word', *args, **kwargs)
Okay: alpha[:-i]

E225: i=i+1
E225: submitted +=1
E225: x = x /2 - 1
E225: z = x **y
E225: z = 1and 1
E226: c = (a+b) * (a-b)
E226: hypot2 = x*x + y*y
E227: c = a|b
E228: msg = fmt%(errno, errmsg)

Continuation line over-indented for visual indent
Open

                                     and self.indent > 0 else None

Continuation lines indentation.

Continuation lines should align wrapped elements either vertically
using Python's implicit line joining inside parentheses, brackets
and braces, or using a hanging indent.

When using a hanging indent these considerations should be applied:
- there should be no arguments on the first line, and
- further indentation should be used to clearly distinguish itself
  as a continuation line.

Okay: a = (\n)
E123: a = (\n    )

Okay: a = (\n    42)
E121: a = (\n   42)
E122: a = (\n42)
E123: a = (\n    42\n    )
E124: a = (24,\n     42\n)
E125: if (\n    b):\n    pass
E126: a = (\n        42)
E127: a = (24,\n      42)
E128: a = (24,\n    42)
E129: if (a or\n    b):\n    pass
E131: a = (\n    42\n 24)

Expected 2 blank lines, found 1
Open

class BaseWorker:
Severity: Minor
Found in transistor/workers/baseworker.py by pep8

Separate top-level function and class definitions with two blank lines.

Method definitions inside a class are separated by a single blank
line.

Extra blank lines may be used (sparingly) to separate groups of
related functions.  Blank lines may be omitted between a bunch of
related one-liners (e.g. a set of dummy implementations).

Use blank lines in functions, sparingly, to indicate logical
sections.

Okay: def a():\n    pass\n\n\ndef b():\n    pass
Okay: def a():\n    pass\n\n\nasync def b():\n    pass
Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
Okay: default = 1\nfoo = 1
Okay: classify = 1\nfoo = 1

E301: class Foo:\n    b = 0\n    def bar():\n        pass
E302: def a():\n    pass\n\ndef b(n):\n    pass
E302: def a():\n    pass\n\nasync def b(n):\n    pass
E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
E303: def a():\n\n\n\n    pass
E304: @decorator\n\ndef a():\n    pass
E305: def a():\n    pass\na()
E306: def a():\n    def b():\n        pass\n    def c():\n        pass

No newline at end of file
Open

__copyright__ = 'Copyright (C) 2018 by BOM Quote Limited'
Severity: Minor
Found in transistor/__version__.py by pep8

Trailing blank lines are superfluous.

Okay: spam(1)
W391: spam(1)\n

However the last line should end with a new line (warning W292).

Missing whitespace around parameter equals
Open

    def __init__(self, file_name: str=None, trackers: list=None, autorun=True,  **kwargs):

Don't use spaces around the '=' sign in function arguments.

Don't use spaces around the '=' sign when used to indicate a
keyword argument or a default parameter value, except when
using a type annotation.

Okay: def complex(real, imag=0.0):
Okay: return magic(r=real, i=imag)
Okay: boolean(a == b)
Okay: boolean(a != b)
Okay: boolean(a <= b)
Okay: boolean(a >= b)
Okay: def foo(arg: int = 42):
Okay: async def foo(arg: int = 42):

E251: def complex(real, imag = 0.0):
E251: return magic(r = real, i = imag)
E252: def complex(real, image: float=0.0):

Missing whitespace after ':'
Open

    def __init__(self, name:str, to_do=None):

Each comma, semicolon or colon should be followed by whitespace.

Okay: [a, b]
Okay: (3,)
Okay: a[1:4]
Okay: a[:4]
Okay: a[1:]
Okay: a[1:4:2]
E231: ['a','b']
E231: foo(bar,baz)
E231: [{'a':'b'}]

Missing whitespace around operator
Open

        self.items['cookies']=self.spider.cookies
Severity: Minor
Found in transistor/persistence/loader.py by pep8

Surround operators with a single space on either side.

- Always surround these binary operators with a single space on
  either side: assignment (=), augmented assignment (+=, -= etc.),
  comparisons (==, <, >, !=, <=, >=, in, not in, is, is not),
  Booleans (and, or, not).

- If operators with different priorities are used, consider adding
  whitespace around the operators with the lowest priorities.

Okay: i = i + 1
Okay: submitted += 1
Okay: x = x * 2 - 1
Okay: hypot2 = x * x + y * y
Okay: c = (a + b) * (a - b)
Okay: foo(bar, key='word', *args, **kwargs)
Okay: alpha[:-i]

E225: i=i+1
E225: submitted +=1
E225: x = x /2 - 1
E225: z = x **y
E225: z = 1and 1
E226: c = (a+b) * (a-b)
E226: hypot2 = x*x + y*y
E227: c = a|b
E228: msg = fmt%(errno, errmsg)

No newline at end of file
Open

from .newt_crud import get_job_results, delete_job

Trailing blank lines are superfluous.

Okay: spam(1)
W391: spam(1)\n

However the last line should end with a new line (warning W292).

Missing whitespace around parameter equals
Open

                 exchange_type: str='direct'):

Don't use spaces around the '=' sign in function arguments.

Don't use spaces around the '=' sign when used to indicate a
keyword argument or a default parameter value, except when
using a type annotation.

Okay: def complex(real, imag=0.0):
Okay: return magic(r=real, i=imag)
Okay: boolean(a == b)
Okay: boolean(a != b)
Okay: boolean(a <= b)
Okay: boolean(a >= b)
Okay: def foo(arg: int = 42):
Okay: async def foo(arg: int = 42):

E251: def complex(real, imag = 0.0):
E251: return magic(r = real, i = imag)
E252: def complex(real, image: float=0.0):

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Open

                gevent.sleep(random.randint(12, 20))

Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Open

        os.system('twine upload dist/*')
Severity: Info
Found in setup.py by bandit

Starting a process with a partial executable path
Open

        os.system('twine upload dist/*')
Severity: Info
Found in setup.py by bandit

Consider possible security implications associated with pickle module.
Open

import pickle

Starting a process with a shell, possible injection detected, security issue.
Open

        os.system('git tag v{0}'.format(about['__version__']))
Severity: Major
Found in setup.py by bandit

Using XMLGenerator to parse untrusted XML data is known to be vulnerable to XML attacks. Replace XMLGenerator with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called.
Open

from xml.sax.saxutils import XMLGenerator

Starting a process with a shell, possible injection detected, security issue.
Open

        os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
Severity: Major
Found in setup.py by bandit

Starting a process with a partial executable path
Open

        os.system('git push --tags')
Severity: Info
Found in setup.py by bandit

Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
Open

        os.system('git push --tags')
Severity: Info
Found in setup.py by bandit

Use of exec detected.
Open

    exec(f.read(), about)
Severity: Minor
Found in setup.py by bandit

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
Open

                gevent.sleep(random.randint(12, 20))
Severity
Category
Status
Source
Language