prepare_report: Make error/missing data placeholders actually look like placeholders

This commit is contained in:
Kamil Śliwak 2020-12-22 02:10:10 +01:00
parent fe7cc2097b
commit 887497a406
2 changed files with 6 additions and 6 deletions

View File

@ -30,15 +30,15 @@ for (const optimize of [false, true])
Object.keys(result['contracts']).every(file => Object.keys(result['contracts'][file]).length === 0)
)
// NOTE: do not exit here because this may be run on source which cannot be compiled
console.log(filename + ': ERROR')
console.log(filename + ': <ERROR>')
else
for (const contractFile in result['contracts'])
for (const contractName in result['contracts'][contractFile])
{
const contractResults = result['contracts'][contractFile][contractName]
let bytecode = 'NO BYTECODE'
let metadata = 'NO METADATA'
let bytecode = '<NO BYTECODE>'
let metadata = '<NO METADATA>'
if ('evm' in contractResults && 'bytecode' in contractResults['evm'] && 'object' in contractResults['evm']['bytecode'])
bytecode = contractResults.evm.bytecode.object

View File

@ -35,12 +35,12 @@ for optimize in [False, True]:
len(result['contracts']) == 0 or
all(len(file_results) == 0 for file_name, file_results in result['contracts'].items())
):
REPORT_FILE.write(f + ": ERROR\n")
REPORT_FILE.write(f + ": <ERROR>\n")
else:
for filename in sorted(result['contracts'].keys()):
for contractName in sorted(result['contracts'][filename].keys()):
bytecode = result['contracts'][filename][contractName].get('evm', {}).get('bytecode', {}).get('object', 'NO BYTECODE')
metadata = result['contracts'][filename][contractName].get('metadata', 'NO METADATA')
bytecode = result['contracts'][filename][contractName].get('evm', {}).get('bytecode', {}).get('object', '<NO BYTECODE>')
metadata = result['contracts'][filename][contractName].get('metadata', '<NO METADATA>')
REPORT_FILE.write(filename + ':' + contractName + ' ' + bytecode + '\n')
REPORT_FILE.write(filename + ':' + contractName + ' ' + metadata + '\n')