pbrod/numdifftools

View on GitHub
build_package.py

Summary

Maintainability
A
25 mins
Test Coverage

Function build_main has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def build_main(version):
        """Build and update {} version, documentation and package.

        The script remove the previous built binaries and generated documentation
        before it generate the documentation and build the binaries
Severity: Minor
Found in build_package.py - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Consider using '{help_option_names: ['-h', '--help']}' instead of a call to 'dict'.
Open

    @click.command(context_settings=dict(help_option_names=['-h', '--help']))
Severity: Info
Found in build_package.py by pylint

Emitted when using dict() to create a dictionary instead of a literal '{ ... }'. The literal is faster as it avoids an additional function call.

Using open without explicitly specifying an encoding
Open

        with open(filename, "w") as fid:
Severity: Minor
Found in build_package.py by pylint

It is better to specify an encoding when opening documents. Using the system default implicitly can create problems on other operating systems. See https://peps.python.org/pep-0597/

Using open without explicitly specifying an encoding
Open

    with open(filename, "w") as fid:
Severity: Minor
Found in build_package.py by pylint

It is better to specify an encoding when opening documents. Using the system default implicitly can create problems on other operating systems. See https://peps.python.org/pep-0597/

Using open without explicitly specifying an encoding
Open

    with open(filename, "w") as fid:
Severity: Minor
Found in build_package.py by pylint

It is better to specify an encoding when opening documents. Using the system default implicitly can create problems on other operating systems. See https://peps.python.org/pep-0597/

Catching too general exception Exception
Open

    except Exception as error:  # subprocess.CalledProcessError:
Severity: Minor
Found in build_package.py by pylint

If you use a naked except Exception: clause, you might end up catching exceptions other than the ones you expect to catch. This can hide bugs or make it harder to debug programs when unrelated errors are hidden.

Using open without explicitly specifying an encoding
Open

        with open(filename, "r") as fid:
Severity: Minor
Found in build_package.py by pylint

It is better to specify an encoding when opening documents. Using the system default implicitly can create problems on other operating systems. See https://peps.python.org/pep-0597/

No value for argument 'version' in function call
Open

    build_main()
Severity: Critical
Found in build_package.py by pylint

Used when a function call passes too few arguments.

Too many blank lines (2)
Open

    build_main()
Severity: Minor
Found in build_package.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

Missing whitespace around arithmetic operator
Open

""".format(PACKAGE_NAME, '='*len(PACKAGE_NAME)), """{1}
Severity: Minor
Found in build_package.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)

Missing whitespace around arithmetic operator
Open

INFO = importlib.import_module(PACKAGE_NAME+'.info', './src')
Severity: Minor
Found in build_package.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)

Missing whitespace around arithmetic operator
Open

""".format(PACKAGE_NAME, '='*len(PACKAGE_NAME)))
Severity: Minor
Found in build_package.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)

Missing whitespace around arithmetic operator
Open

LICENSE = importlib.import_module(PACKAGE_NAME+'.license', './src')
Severity: Minor
Found in build_package.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)

Missing function or method docstring
Open

def update_readme():
Severity: Info
Found in build_package.py by pylint

Used when a function or method has no docstring. Some special methods like init do not require a docstring.

Missing function or method docstring
Open

def update_license():
Severity: Info
Found in build_package.py by pylint

Used when a function or method has no docstring. Some special methods like init do not require a docstring.

Formatting a regular string which could be a f-string
Open

        print("Version: {}".format(version))
Severity: Info
Found in build_package.py by pylint

Used when we detect a string that is being formatted with format() or % which could potentially be a f-string. The use of f-strings is preferred. Requires Python 3.6 and py-version >= 3.6.

Formatting a regular string which could be a f-string
Open

    """Removes ./dist, ./build, ./docs/_build, and ./src/{}.egg-info directories.
Severity: Info
Found in build_package.py by pylint

Used when we detect a string that is being formatted with format() or % which could potentially be a f-string. The use of f-strings is preferred. Requires Python 3.6 and py-version >= 3.6.

Formatting a regular string which could be a f-string
Open

                          '__version__ = "{}"'.format(version),
Severity: Info
Found in build_package.py by pylint

Used when we detect a string that is being formatted with format() or % which could potentially be a f-string. The use of f-strings is preferred. Requires Python 3.6 and py-version >= 3.6.

Formatting a regular string which could be a f-string
Open

        """Introduction to {}
Severity: Info
Found in build_package.py by pylint

Used when we detect a string that is being formatted with format() or % which could potentially be a f-string. The use of f-strings is preferred. Requires Python 3.6 and py-version >= 3.6.

Formatting a regular string which could be a f-string
Open

""".format(PACKAGE_NAME, '='*len(PACKAGE_NAME)), """{1}
Severity: Info
Found in build_package.py by pylint

Used when we detect a string that is being formatted with format() or % which could potentially be a f-string. The use of f-strings is preferred. Requires Python 3.6 and py-version >= 3.6.

Formatting a regular string which could be a f-string
Open

    """Set version of {} package""".format(PACKAGE_NAME)
Severity: Info
Found in build_package.py by pylint

Used when we detect a string that is being formatted with format() or % which could potentially be a f-string. The use of f-strings is preferred. Requires Python 3.6 and py-version >= 3.6.

Formatting a regular string which could be a f-string
Open

        """Build and update {} version, documentation and package.
Severity: Info
Found in build_package.py by pylint

Used when we detect a string that is being formatted with format() or % which could potentially be a f-string. The use of f-strings is preferred. Requires Python 3.6 and py-version >= 3.6.

Formatting a regular string which could be a f-string
Open

    print("Running {}".format(' '.join(cmd_opts)))
Severity: Info
Found in build_package.py by pylint

Used when we detect a string that is being formatted with format() or % which could potentially be a f-string. The use of f-strings is preferred. Requires Python 3.6 and py-version >= 3.6.

Formatting a regular string which could be a f-string
Open

    egginfo_path = os.path.join('src', '{}.egg-info'.format(PACKAGE_NAME))
Severity: Info
Found in build_package.py by pylint

Used when we detect a string that is being formatted with format() or % which could potentially be a f-string. The use of f-strings is preferred. Requires Python 3.6 and py-version >= 3.6.

There are no issues that match your filters.

Category
Status