Socket
Socket
Sign inDemoInstall

solium

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solium - npm Package Compare versions

Comparing version 1.1.7 to 1.1.8

.gitattributes

3

config/rulesets/solium-all.js

@@ -23,2 +23,3 @@ /**

"quotes": "error",
"linebreak-style": "error",

@@ -40,2 +41,4 @@ "mixedcase": "warning",

"max-len": "warning",
"error-reason": "warning",
"visibility-first": "warning",

@@ -42,0 +45,0 @@ // Turn OFF all deprecated rules

6

config/rulesets/solium-recommended.js

@@ -17,2 +17,3 @@ /**

"value-in-payable": "error",
"linebreak-style": "error",

@@ -30,5 +31,4 @@ "no-empty-blocks": "warning",

"no-constant": "warning",
"no-experimental": "warning",
"max-len": "warning",
"error-reason": "warning",
"lbrace": "off",

@@ -42,2 +42,4 @@ "mixedcase": "off",

"conditionals-whitespace": "off",
"no-experimental": "off",
"visibility-first": "warning",

@@ -44,0 +46,0 @@ // Disable deprecated rules

@@ -205,5 +205,25 @@ {

"description": "Ensure that a line of code doesn't exceed the specified number of characters"
}
},
"error-reason": {
"enabled": true,
"recommended": true,
"type": "warning",
"description": "Ensure that error message is provided for revert and require statements"
},
"visibility-first": {
"enabled": true,
"recommended": true,
"type": "warning",
"description": "Ensure that the visibility modifier for a function should come before any custom modifiers"
},
"linebreak-style": {
"enabled": true,
"recommended": true,
"type": "error",
"description": "Ensure consistent linebreak style"
}
}
}

@@ -206,12 +206,17 @@ /**

function createCliOptions(cliObject) {
function collect(val, memo) {
memo.push(val);
return memo;
}
cliObject
.version(`Solium version ${version}`)
.description("Style and Security checker for Solidity")
.description("Linter to find & fix style and security issues in Solidity smart contracts.")
.usage("[options] <keyword>")
.option("-i, --init", "Create default rule configuration files")
.option("-f, --file [filename]", "Solidity file to lint")
.option("-d, --dir [dirname]", "Directory containing Solidity files to lint")
.option("-R, --reporter [name]", "Format to report lint issues in (pretty | gcc)")
.option("-c, --config [path]", "Path to the .soliumrc configuration file")
.option("-f, --file [filepath::String]", "Solidity file to lint")
.option("-d, --dir [dirpath::String]", "Directory containing Solidity files to lint")
.option("-R, --reporter [name::String]", "Format to report lint issues in (pretty | gcc)")
.option("-c, --config [filepath::String]", "Path to the .soliumrc configuration file")
.option("-, --stdin", "Read input file from stdin")

@@ -221,3 +226,17 @@ .option("--fix", "Fix Lint issues where possible")

.option("--watch", "Watch for file changes")
.option("--hot", "(Deprecated) Same as --watch");
.option("--hot", "(Deprecated) Same as --watch")
.option("--no-soliumignore", "Do not look for .soliumignore file")
.option("--no-soliumrc", "Do not look for soliumrc configuration file")
.option(
"--rule [rule]",
"Rule to execute. This overrides the specified rule's configuration in soliumrc if present",
collect,
[]
)
.option(
"--plugin [plugin]",
"Plugin to execute. This overrides the specified plugin's configuration in soliumrc if present",
collect,
[]
);
}

@@ -248,3 +267,3 @@

let userConfig, ignore, errorReporter;
let userConfig = {}, ignore, errorReporter;

@@ -265,27 +284,29 @@ createCliOptions(cli);

/**
* If cli.config option is NOT specified, then resort to .soliumrc in current dir.
* Else,
* If path is absolute, assign as-it-is.
* Else (relative pathing) join path with current dir.
*/
const soliumrcAbsPath = cli.config ?
(path.isAbsolute(cli.config) ? cli.config : path.join(CWD, cli.config)) :
SOLIUMRC_FILENAME_ABSOLUTE;
if (cli.soliumrc) {
/**
* If cli.config option is NOT specified, then resort to .soliumrc in current dir.
* Else,
* If path is absolute, assign as-it-is.
* Else (relative pathing) join path with current dir.
*/
const soliumrcAbsPath = cli.config ?
(path.isAbsolute(cli.config) ? cli.config : path.join(CWD, cli.config)) :
SOLIUMRC_FILENAME_ABSOLUTE;
try {
userConfig = require(soliumrcAbsPath);
} catch (e) {
// Check if soliumrc file exists. If yes, then the file is in an invalid format.
if (fs.existsSync(soliumrcAbsPath)) {
errorReporter.reportFatal(`An invalid ${SOLIUMRC_FILENAME} was provided. ${e.message}`);
} else {
if (cli.config) {
errorReporter.reportFatal(`${soliumrcAbsPath} does not exist.`);
try {
userConfig = require(soliumrcAbsPath);
} catch (e) {
// Check if soliumrc file exists. If yes, then the file is in an invalid format.
if (fs.existsSync(soliumrcAbsPath)) {
errorReporter.reportFatal(`An invalid ${SOLIUMRC_FILENAME} was provided. ${e.message}`);
} else {
errorReporter.reportFatal(`Couldn't find ${SOLIUMRC_FILENAME} in the current directory.`);
if (cli.config) {
errorReporter.reportFatal(`${soliumrcAbsPath} does not exist.`);
} else {
errorReporter.reportFatal(`Couldn't find ${SOLIUMRC_FILENAME} in the current directory.`);
}
}
process.exit(errorCodes.NO_SOLIUMRC);
}
process.exit(errorCodes.NO_SOLIUMRC);
}

@@ -309,9 +330,35 @@

userConfig.plugins = userConfig.plugins || [];
userConfig.rules = userConfig.rules || {};
for (const plugin of cli.plugin) {
userConfig.plugins.push(plugin);
}
for (const rule of cli.rule) {
// If no ":" was found, it means only the rule's name was specified.
// Treat it as an error and adopt its default configuration options.
if (!rule.includes(":")) {
userConfig.rules[rule] = "error";
continue;
}
let [key, value] = rule.split(":").map(i => i.trim());
try {
value = JSON.parse(value);
} catch (e) {
errorReporter.reportFatal(`There was an error trying to parse '${rule}': ${e.message}`);
process.exit(errorCodes.INVALID_PARAMS);
}
userConfig.rules[key] = value;
}
//get all files & folders to ignore from .soliumignore
try {
ignore = fs.readFileSync(SOLIUMIGNORE_FILENAME_ABSOLUTE, "utf8").split("\n");
} catch (e) {
errorReporter.reportInternal(
`There was an error trying to read '${SOLIUMIGNORE_FILENAME_ABSOLUTE}': ${e.message}`
);
if (cli.soliumignore) {
try {
ignore = fs.readFileSync(SOLIUMIGNORE_FILENAME_ABSOLUTE, "utf8").split("\n");
} catch (e) {
errorReporter.reportInternal(
`There was an error trying to read '${SOLIUMIGNORE_FILENAME_ABSOLUTE}': ${e.message}`);
}
}

@@ -318,0 +365,0 @@

@@ -10,15 +10,15 @@ /**

reportFatal: function(message) {
console.log("[Fatal Error] " + message);
reportFatal(message) {
process.stderr.write(`[Fatal error] ${message}\n`);
},
reportInternal: function(message) {
console.log("[Warning] " + message);
reportInternal(message) {
process.stdout.write(`[Warning] ${message}\n`);
},
report: function(filename, sourceCode, lintErrors, fixesApplied) {
report(filename, sourceCode, lintErrors, fixesApplied) {
let internalIssuesExist = false;
// Examine internal issues first
lintErrors.forEach(function(issue, index) {
lintErrors.forEach((issue, index) => {
if (!issue.internal) {

@@ -28,3 +28,3 @@ return;

console.log(issue.message);
process.stdout.write(`${issue.message}\n`);

@@ -35,16 +35,12 @@ delete lintErrors [index];

internalIssuesExist && console.log("\n");
internalIssuesExist && process.stdout.write("\n");
lintErrors.forEach(function(error) {
console.log(
filename + ":" + error.line + ":" + error.column + ": "
+ error.type + ": " + error.message
);
lintErrors.forEach(error => {
const { line, column, type, message, ruleName } = error;
process.stdout.write(`${filename}:${line}:${column}: ${type}: ${message} [${ruleName}]\n`);
});
Array.isArray(fixesApplied) && console.log("\nNumber of fixes applied: " + fixesApplied.length);
Array.isArray(fixesApplied) && process.stdout.write(`\nNumber of fixes applied: ${fixesApplied.length}\n`);
}
};

@@ -28,9 +28,7 @@ /**

reportInternal(message) {
process.stdout.write(
(`[Warning] ${message}\n`)[colorInternalIssue("warning")]);
process.stdout.write((`[Warning] ${message}\n`)[colorInternalIssue("warning")]);
},
reportFatal(message) {
process.stdout.write(
(`\u2716 [Fatal error] ${message}\n`)[colorInternalIssue("error")]);
process.stderr.write((`\u2716 [Fatal error] ${message}\n`)[colorInternalIssue("error")]);
},

@@ -119,2 +117,2 @@

};
};

@@ -49,2 +49,2 @@ /**

};
};
{
"name": "solium",
"version": "1.1.7",
"version": "1.1.8",
"description": "Linter to identify and fix Style & Security issues in Solidity",

@@ -40,2 +40,3 @@ "main": "./lib/solium.js",

"commander": "^2.9.0",
"eol": "^0.9.1",
"js-string-escape": "^1.0.1",

@@ -42,0 +43,0 @@ "lodash": "^4.14.2",

@@ -71,3 +71,3 @@ <p align="center">

function() {
var bar = 'Hello world'; // solium-disable-line quotes
bytes32 bar = 'Hello world'; // solium-disable-line quotes

@@ -105,3 +105,3 @@ // solium-disable-next-line security/no-throw, indentation

## Our backers
## Our supporters
<p align="left">

@@ -111,4 +111,13 @@ <a href="https://blog.ethereum.org/2018/03/07/announcing-beneficiaries-ethereum-foundation-grants/">

</a>
<a href="https://medium.com/@AugurProject/announcing-the-augur-bounty-program-bf11b1e1b7cf">
<img src="./art/augur.png" width="70" alt="Augur">
</a>
&nbsp;&nbsp;
<a href="https://gitcoin.co/universe?sort=None&direction=-&page=1&q=solium">
<img src="./art/gitcoin.png" width="80" alt="Gitcoin">
</a>
</p>
#### [IDE and Editor Integrations](http://solium.readthedocs.io/en/latest/user-guide.html#index-9) | [Complete Documentation](http://solium.readthedocs.io/) | [Demo Video](https://www.youtube.com/watch?v=MlQ6fzwixpI)
If Solium helped make your life simpler, please consider donating ETH to `0xacc661A56af9793a4437876a52F4Ad3fc3C443d6`
#### [IDE and Editor Integrations](http://solium.readthedocs.io/en/latest/user-guide.html#index-9) | [Complete Documentation](http://solium.readthedocs.io/) | [Demo Video](https://www.youtube.com/watch?v=MlQ6fzwixpI)

@@ -215,3 +215,3 @@ /**

// The below count will keep changing with every change in the number of core rules that exist in solium.
Object.keys(ruleDescriptions).length.should.equal(25);
Object.keys(ruleDescriptions).length.should.equal(28);

@@ -218,0 +218,0 @@ done();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc