mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8239 from ethereum/unrevertpylintstuff
Re-add reverted pylint changes
This commit is contained in:
commit
56a3e434d9
@ -267,8 +267,8 @@ jobs:
|
|||||||
command: apt -q update && apt install -y python3-pip
|
command: apt -q update && apt install -y python3-pip
|
||||||
- run:
|
- run:
|
||||||
name: Install pylint
|
name: Install pylint
|
||||||
command: python3 -m pip install pylint z3-solver
|
command: python3 -m pip install pylint z3-solver pygments-lexer-solidity
|
||||||
# also z3-solver to make sure pylint knows about this module
|
# also z3-solver to make sure pylint knows about this module, pygments-lexer-solidity for docs
|
||||||
- run:
|
- run:
|
||||||
name: Linting Python Scripts
|
name: Linting Python Scripts
|
||||||
command: ./scripts/pylint_all.py
|
command: ./scripts/pylint_all.py
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#! /usr/bin/env python3
|
#! /usr/bin/env python3
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Performs pylint on all python files in the project repo's test directory recursively.
|
Performs pylint on all python files in the project repo's {test,script,docs} directory recursively.
|
||||||
|
|
||||||
This script is meant to be run from the CI but can also be easily in local dev environment,
|
This script is meant to be run from the CI but can also be easily in local dev environment,
|
||||||
where you can optionally pass `-d` as command line argument to let this script abort on first error.
|
where you can optionally pass `-d` as command line argument to let this script abort on first error.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from os import path, walk, system
|
from os import path, walk, system
|
||||||
from sys import argv, exit as brexit
|
from sys import argv, exit as exitwith
|
||||||
|
|
||||||
PROJECT_ROOT = path.dirname(path.realpath(__file__))
|
PROJECT_ROOT = path.dirname(path.realpath(__file__))
|
||||||
PYLINT_RCFILE = "{}/pylintrc".format(PROJECT_ROOT)
|
PYLINT_RCFILE = "{}/pylintrc".format(PROJECT_ROOT)
|
||||||
@ -36,19 +36,20 @@ def pylint_all_filenames(dev_mode, rootdirs):
|
|||||||
if exit_code != 0:
|
if exit_code != 0:
|
||||||
if dev_mode:
|
if dev_mode:
|
||||||
return 1, checked_count
|
return 1, checked_count
|
||||||
else:
|
failed.append(filename)
|
||||||
failed.append(filename)
|
|
||||||
|
|
||||||
return len(failed), len(filenames)
|
return len(failed), len(filenames)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""" Collects all python script root dirs and runs pylint on them. """
|
""" Collects all python script root dirs and runs pylint on them. You can optionally
|
||||||
|
pass `-d` as command line argument to let this script abort on first error. """
|
||||||
dev_mode = len(argv) == 2 and argv[1] == "-d"
|
dev_mode = len(argv) == 2 and argv[1] == "-d"
|
||||||
failed_count, total_count = pylint_all_filenames(dev_mode, [
|
failed_count, total_count = pylint_all_filenames(dev_mode, [
|
||||||
|
path.abspath(path.dirname(__file__) + "/../docs"),
|
||||||
path.abspath(path.dirname(__file__) + "/../scripts"),
|
path.abspath(path.dirname(__file__) + "/../scripts"),
|
||||||
path.abspath(path.dirname(__file__) + "/../test")])
|
path.abspath(path.dirname(__file__) + "/../test")])
|
||||||
if failed_count != 0:
|
if failed_count != 0:
|
||||||
brexit("pylint failed on {}/{} files.".format(failed_count, total_count))
|
exitwith("pylint failed on {}/{} files.".format(failed_count, total_count))
|
||||||
else:
|
else:
|
||||||
print("Successfully tested {} files.".format(total_count))
|
print("Successfully tested {} files.".format(total_count))
|
||||||
|
|
||||||
|
@ -71,4 +71,4 @@ good-names=
|
|||||||
expected-line-ending-format=LF
|
expected-line-ending-format=LF
|
||||||
|
|
||||||
# Maximum number of characters on a single line.
|
# Maximum number of characters on a single line.
|
||||||
max-line-length=110
|
max-line-length=130
|
||||||
|
Loading…
Reference in New Issue
Block a user