Skip to content

Commit 13480b7

Browse files
authored
Merge branch 'master' into feat/allow-uppercase-uuids
2 parents 8370d43 + d79f027 commit 13480b7

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ MYTHX_USERNAME="<mythx-username>"
1616
MYTHX_PASSWORD="<password>"
1717
```
1818

19-
> **NOTE:** `MYTHX_ETH_ADDRESS` in favour of `MYTHX_USERNAME` and will be removed in future versions. Please update your .env file or your environment variables accordingly.
19+
> **NOTE:** `MYTHX_ETH_ADDRESS` has been deprecated in favour of `MYTHX_USERNAME` and will be removed in future versions. Please update your .env file or your environment variables accordingly.
2020
2121
`MYTHX_USERNAME` may be either of:
2222
* MythX User ID (assigned by MythX API to any registered user);

lib/mythXUtil.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ const cleanAnalyzeDataEmptyProps = (data, debug, logger) => {
162162
}
163163

164164
if (debug && unusedFields.length > 0) {
165-
logger(`${props.contractName}: Empty JSON data fields from compilation - ${unusedFields.join(', ')}`);
165+
logger.debug(`${props.contractName}: Empty JSON data fields from compilation - ${unusedFields.join(', ')}`);
166166
}
167167

168168
return result;

mythx.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,40 +40,40 @@ async function analyse(contracts, cfg, embark) {
4040
checkEnvVariables(embark);
4141

4242
const armletClient = new armlet.Client(
43-
{
44-
clientToolName: "embark-mythx",
45-
password: process.env.MYTHX_PASSWORD,
46-
ethAddress: process.env.MYTHX_USERNAME,
47-
})
48-
43+
{
44+
clientToolName: "embark-mythx",
45+
password: process.env.MYTHX_PASSWORD,
46+
ethAddress: process.env.MYTHX_USERNAME,
47+
})
48+
4949
// Filter contracts based on parameter choice
5050
let toSubmit = { "contracts": {}, "sources": contracts.sources };
51-
if(!("ignore" in embark.pluginConfig)) {
51+
if (!("ignore" in embark.pluginConfig)) {
5252
embark.pluginConfig.ignore = []
5353
}
5454

5555
for (let [filename, contractObjects] of Object.entries(contracts.contracts)) {
5656
for (let [contractName, contract] of Object.entries(contractObjects)) {
57-
if(!("contracts" in cfg)) {
57+
if (!("contracts" in cfg)) {
5858
if (embark.pluginConfig.ignore.indexOf(contractName) == -1) {
59-
if(!toSubmit.contracts[filename]) {
59+
if (!toSubmit.contracts[filename]) {
6060
toSubmit.contracts[filename] = {}
6161
}
6262
toSubmit.contracts[filename][contractName] = contract;
6363
}
6464
} else {
6565
if (cfg.contracts.indexOf(contractName) >= 0 && embark.pluginConfig.ignore.indexOf(contractName) == -1) {
66-
if(!toSubmit.contracts[filename]) {
66+
if (!toSubmit.contracts[filename]) {
6767
toSubmit.contracts[filename] = {}
6868
}
6969
toSubmit.contracts[filename][contractName] = contract;
7070
}
7171
}
7272
}
7373
}
74-
74+
7575
// Stop here if no contracts are left
76-
if(Object.keys(toSubmit.contracts).length === 0) {
76+
if (Object.keys(toSubmit.contracts).length === 0) {
7777
embark.logger.info("No contracts to submit.");
7878
return 0;
7979
}
@@ -114,7 +114,7 @@ const doAnalysis = async (armletClient, config, contracts, contractNames = null,
114114
const initialDelay = ('initial-delay' in config) ? config['initial-delay'] * 1000 : undefined;
115115

116116
const results = await asyncPool(limit, contracts, async buildObj => {
117-
117+
118118
const obj = new MythXIssues(buildObj, config);
119119

120120
let analyzeOpts = {
@@ -123,25 +123,25 @@ const doAnalysis = async (armletClient, config, contracts, contractNames = null,
123123
initialDelay
124124
};
125125

126-
analyzeOpts.data = mythXUtil.cleanAnalyzeDataEmptyProps(obj.buildObj, config.debug, config.logger.debug);
126+
analyzeOpts.data = mythXUtil.cleanAnalyzeDataEmptyProps(obj.buildObj, config.debug, config.logger);
127127
analyzeOpts.data.analysisMode = config.full ? "full" : "quick";
128128
if (config.debug > 1) {
129-
config.logger.debug("analyzeOpts: " + `${util.inspect(analyzeOpts, {depth: null})}`);
129+
config.logger.debug("analyzeOpts: " + `${util.inspect(analyzeOpts, { depth: null })}`);
130130
}
131131

132132
// request analysis to armlet.
133133
try {
134134
//TODO: Call analyze/analyzeWithStatus asynchronously
135135
config.logger.info("Submitting '" + obj.contractName + "' for " + analyzeOpts.data.analysisMode + " analysis...")
136-
const {issues, status} = await armletClient.analyzeWithStatus(analyzeOpts);
136+
const { issues, status } = await armletClient.analyzeWithStatus(analyzeOpts);
137137
obj.uuid = status.uuid;
138138

139139
if (status.status === 'Error') {
140140
return [status, null];
141141
} else {
142142
obj.setIssues(issues);
143143
}
144-
144+
145145
return [null, obj];
146146
} catch (err) {
147147
//console.log("catch", JSON.stringify(err));
@@ -155,7 +155,7 @@ const doAnalysis = async (armletClient, config, contracts, contractNames = null,
155155
}
156156

157157
if (errStr.includes('User or default timeout reached after')
158-
|| errStr.includes('Timeout reached after')) {
158+
|| errStr.includes('Timeout reached after')) {
159159
return [(buildObj.contractName + ": ").yellow + errStr, null];
160160
} else {
161161
return [(buildObj.contractName + ": ").red + errStr, null];
@@ -165,7 +165,7 @@ const doAnalysis = async (armletClient, config, contracts, contractNames = null,
165165
});
166166

167167
return results.reduce((accum, curr) => {
168-
const [ err, obj ] = curr;
168+
const [err, obj] = curr;
169169
if (err) {
170170
accum.errors.push(err);
171171
} else if (obj) {
@@ -180,15 +180,15 @@ function ghettoReport(logger, results) {
180180
results.forEach(ele => {
181181
issuesCount += ele.issues.length;
182182
});
183-
183+
184184
if (issuesCount === 0) {
185185
logger.info('No issues found');
186186
return 0;
187187
}
188188
for (const group of results) {
189189
logger.info(group.sourceList.join(', ').underline);
190190
for (const issue of group.issues) {
191-
logger.info(yaml.safeDump(issue, {'skipInvalid': true}));
191+
logger.info(yaml.safeDump(issue, { 'skipInvalid': true }));
192192
}
193193
}
194194
return 1;

0 commit comments

Comments
 (0)