mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9031 from ethereum/extend-check-srcipt
Add check for 0000_error to script
This commit is contained in:
commit
9f407fe0e7
@ -316,6 +316,15 @@ jobs:
|
||||
name: checking shell scripts
|
||||
command: ./scripts/chk_shellscripts/chk_shellscripts.sh
|
||||
|
||||
chk_errorcodes:
|
||||
docker:
|
||||
- image: circleci/python:3.6
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Check for error codes
|
||||
command: ./scripts/correct_error_ids.py --noconfirm
|
||||
|
||||
chk_pylint:
|
||||
docker:
|
||||
- image: buildpack-deps:eoan
|
||||
@ -845,6 +854,7 @@ workflows:
|
||||
- chk_buglist: *workflow_trigger_on_tags
|
||||
- chk_proofs: *workflow_trigger_on_tags
|
||||
- chk_pylint: *workflow_trigger_on_tags
|
||||
- chk_errorcodes: *workflow_trigger_on_tags
|
||||
- chk_antlr_grammar: *workflow_trigger_on_tags
|
||||
- chk_docs_pragma_min_version: *workflow_trigger_on_tags
|
||||
|
||||
|
38
scripts/correct_error_ids.py
Normal file → Executable file
38
scripts/correct_error_ids.py
Normal file → Executable file
@ -1,6 +1,9 @@
|
||||
#! /usr/bin/env python3
|
||||
import random
|
||||
import re
|
||||
import os
|
||||
import getopt
|
||||
import sys
|
||||
from os import path
|
||||
|
||||
ENCODING = "utf-8"
|
||||
@ -115,19 +118,28 @@ def find_source_files(top_dir):
|
||||
return source_file_names
|
||||
|
||||
|
||||
def main():
|
||||
def main(argv):
|
||||
noconfirm = False
|
||||
opts, args = getopt.getopt(argv, "", ["noconfirm"])
|
||||
|
||||
for opt, arg in opts:
|
||||
if opt == '--noconfirm':
|
||||
noconfirm = True
|
||||
|
||||
random.seed()
|
||||
cwd = os.getcwd()
|
||||
answer = input(
|
||||
f"This script checks and corrects *_error literals in .h and .cpp files\n"
|
||||
f"in {cwd}, recursively.\n\n"
|
||||
f"Please commit current changes first, and review the results when the script finishes.\n\n"
|
||||
f"Do you want to start [Y/N]? "
|
||||
)
|
||||
while len(answer) == 0 or answer not in "YNyn":
|
||||
answer = input("[Y/N]? ")
|
||||
if answer not in "yY":
|
||||
return
|
||||
|
||||
if not noconfirm:
|
||||
answer = input(
|
||||
f"This script checks and corrects *_error literals in .h and .cpp files\n"
|
||||
f"in {cwd}, recursively.\n\n"
|
||||
f"Please commit current changes first, and review the results when the script finishes.\n\n"
|
||||
f"Do you want to start [Y/N]? "
|
||||
)
|
||||
while len(answer) == 0 or answer not in "YNyn":
|
||||
answer = input("[Y/N]? ")
|
||||
if answer not in "yY":
|
||||
exit(0)
|
||||
|
||||
source_file_names = find_source_files(cwd)
|
||||
|
||||
@ -147,10 +159,12 @@ def main():
|
||||
|
||||
if ok:
|
||||
print("No incorrect IDs found")
|
||||
exit(0)
|
||||
else:
|
||||
fix_ids(used_ids, source_file_names)
|
||||
print("Fixing completed")
|
||||
exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main(sys.argv[1:])
|
||||
|
Loading…
Reference in New Issue
Block a user