Navigation Menu

Skip to content

Commit

Permalink
Compiler random folder support and solium checks
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfranblanco committed Mar 15, 2019
1 parent 043e32b commit 6b4f44e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
10 changes: 3 additions & 7 deletions package.json
Expand Up @@ -8,7 +8,7 @@
"compiler",
"solhint"
],
"version": "0.0.49",
"version": "0.0.50",
"publisher": "JuanBlanco",
"engines": {
"vscode": "^1.28.0"
Expand Down Expand Up @@ -55,11 +55,11 @@
"fs-extra": "^4.0.3",
"nethereum-codegen": "^1.0.6",
"read-yaml": "^1.1.0",
"solc": "^0.5.0",
"solc": "^0.5.2",
"solhint": "^1.4.0",
"solium": "^1.1.8",
"solparse": "^2.2.5",
"truffle-artifactor": "^2.1.4",
"truffle-artifactor": "^3.0.7",
"vscode-languageclient": "^5.1.1",
"vscode-languageserver": "^5.1.0",
"solidity-parser-antlr": "^0.3.2",
Expand Down Expand Up @@ -123,10 +123,6 @@
"default": {
"imports-on-top": 0,
"variable-declarations": 0,
"indentation": [
"error",
4
],
"quotes": [
"error",
"double"
Expand Down
11 changes: 11 additions & 0 deletions src/compiler.ts
Expand Up @@ -91,6 +91,15 @@ function processCompilationOuput(outputString: any, outputChannel: vscode.Output
}
}

function ensureDirectoryExistence(filePath) {
const dirname = path.dirname(filePath);
if (fs.existsSync(dirname)) {
return true;
}
ensureDirectoryExistence(dirname);
fs.mkdirSync(dirname);
}

function writeCompilationOutputToBuildDirectory(output: any, buildDir: string, sourceDir: string,
excludePath?: string, singleContractFilePath?: string) {
const binPath = path.join(vscode.workspace.rootPath, buildDir);
Expand All @@ -103,10 +112,12 @@ function writeCompilationOutputToBuildDirectory(output: any, buildDir: string, s
const relativePath = path.relative(vscode.workspace.rootPath, singleContractFilePath);
const dirName = path.dirname(path.join(binPath, relativePath));
const outputCompilationPath = path.join(dirName, path.basename(singleContractFilePath, '.sol') + '-sol-output' + '.json');
ensureDirectoryExistence(outputCompilationPath);
fs.writeFileSync(outputCompilationPath, JSON.stringify(output, null, 4));
} else {
const dirName = binPath;
const outputCompilationPath = path.join(dirName, 'compile-all-output' + '.json');
ensureDirectoryExistence(outputCompilationPath);
if (fs.existsSync(outputCompilationPath)) {
fs.unlinkSync(outputCompilationPath);
}
Expand Down
4 changes: 4 additions & 0 deletions src/linter/solium.ts
Expand Up @@ -29,6 +29,10 @@ export default class SoliumService implements Linter {
this.soliumRules = soliumRules;
}

if (typeof this.soliumRules['indentation'] === 'undefined' || this.soliumRules['indentation'] === null) {
this.soliumRules['indentation'] = 'false';
}

if (process.platform === 'win32') {
if (typeof this.soliumRules['linebreak-style'] === 'undefined' || this.soliumRules['linebreak-style'] === null) {
this.soliumRules['linebreak-style'] = 'off';
Expand Down
2 changes: 1 addition & 1 deletion tslint.json
Expand Up @@ -34,7 +34,7 @@
"no-eval": true,
"no-inferrable-types": true,
"no-shadowed-variable": true,
"no-string-literal": true,
"no-string-literal": false,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unused-expression": true,
Expand Down

0 comments on commit 6b4f44e

Please sign in to comment.