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 0.0.1 to 0.0.2

6

lib/rule-context.js

@@ -45,5 +45,5 @@ /**

/**
* wrapper around Solium.report () which adds some additional information to the error object
* @param {Object} error An object describing the lint error, sent by the rule currently running
*/
* wrapper around Solium.report () which adds some additional information to the error object
* @param {Object} error An object describing the lint error, sent by the rule currently running
*/
contextObject.report = function (error) {

@@ -50,0 +50,0 @@

@@ -19,6 +19,6 @@ /**

/**
* load the user-specified rules from the rules/ directory
* @param {Object} userRules object whose keys specify the rule name and boolean values specify whether to include it
* @returns {Object} Definitions of all user-requested rules. Throws error if a rule in userRules is not amongst available rules
*/
* load the user-specified rules from the rules/ directory
* @param {Object} userRules object whose keys specify the rule name and boolean values specify whether to include it
* @returns {Object} Definitions of all user-requested rules. Throws error if a rule in userRules is not amongst available rules
*/
load: function (userRules) {

@@ -55,5 +55,5 @@ var ruleFiles = fs.readdirSync (RULES_DIR),

/**
* context object Constructor to set read-only properties and provide additional functionality to the rules using it
* @returns {Object} Rule object containing function to execute rule, exported by the rule's file
*/
* context object Constructor to set read-only properties and provide additional functionality to the rules using it
* @returns {Object} Rule object containing function to execute rule, exported by the rule's file
*/
get: function (name) {

@@ -60,0 +60,0 @@ return rules [name];

@@ -12,3 +12,3 @@ /**

var camelCaseRegEx = /^[A-Z]([A-Z0-9]*[a-z][a-z0-9]*[A-Z]|[a-z0-9]*[A-Z][A-Z0-9]*[a-z])[A-Za-z0-9]*$/;
var camelCaseRegEx = /^[A-Z][a-z]+[a-zA-Z]*[a-z]$/;

@@ -15,0 +15,0 @@ var eventsToWatch = [

@@ -25,10 +25,11 @@ /**

/**
* Function called for linting the code by external application(s) using the Solium object
* @param {String} sourceCode The Source Code to lint
* @param {Object} config An object whose keys specify the rules to use
* @returns {Array} Array of objects, each containing lint error messages and supporting info, empty if no errors
*/
* Function called for linting the code by external application(s) using the Solium object
* @param {String} sourceCode The Source Code to lint
* @param {Object} config An object whose keys specify the rules to use
* @returns {Array} Array of objects, each containing lint error messages and supporting info, empty if no errors
*/
Solium.lint = function lint (sourceCode, config) {
var nodeEventGenerator = new EventGenerator (Solium),
AST = {};
AST = {},
errorObjects;

@@ -80,4 +81,7 @@ this.removeAllListeners ();

});
errorObjects = messages;
messages = []; //reset messages array to avoid carry-forward of error objects to other files
return messages;
return errorObjects;

@@ -87,5 +91,5 @@ };

/**
* Function called by any rule that wishes to send error message upon violation in source code
* @param {Object} error An object that contains sufficient information to describe the lint error
*/
* Function called by any rule that wishes to send error message upon violation in source code
* @param {Object} error An object that contains sufficient information to describe the lint error
*/
Solium.report = function report (error) {

@@ -115,5 +119,5 @@ if (!astUtils.isASTNode (error.node)) {

/**
* Function that returns the complete source code being linted
* @returns {String} The Source Code being linted
*/
* Function that returns the complete source code being linted
* @returns {String} The Source Code being linted
*/
Solium.getSourceCode = function getSourceCode () {

@@ -120,0 +124,0 @@ return new SourceCode (sourceCodeText);

@@ -9,6 +9,6 @@ /**

/**
* Check if given argument is a non-null, non-Array javascript object
* @param {Object} possibleObject Argument to check for validity
* @returns {Boolean} true if given argument is object, false otherwise
*/
* Check if given argument is a non-null, non-Array javascript object
* @param {Object} possibleObject Argument to check for validity
* @returns {Boolean} true if given argument is object, false otherwise
*/
isStrictlyObject: function (possibleObject) {

@@ -15,0 +15,0 @@ return (

@@ -21,5 +21,5 @@ /**

/**
* emit event that the node with type = node.type is being entered
* @param {Object} node The AST node being entered
*/
* emit event that the node with type = node.type is being entered
* @param {Object} node The AST node being entered
*/
enterNode: function (node) {

@@ -33,5 +33,5 @@ this.emitter.emit (node.type, {

/**
* emit event that the node with type = node.type is being left
* @param {Object} node The AST node being left
*/
* emit event that the node with type = node.type is being left
* @param {Object} node The AST node being left
*/
leaveNode: function (node) {

@@ -38,0 +38,0 @@ this.emitter.emit (node.type, {

@@ -23,8 +23,8 @@ /**

/**
* Function to retrieve the source code text being linted. Returns the complete source code if no node specified
* @param {Object} node The AST node whose source code (specifically) is needed
* @param {Integer} beforeCount Include beforeCount number of characters prior to the node's code
* @param {Integer} afterCount Include afterCount number of characters following the node's code
* @returns {String} source code of the specified node plus extra characters specified by beforeCount & afterCount
*/
* Function to retrieve the source code text being linted. Returns the complete source code if no node specified
* @param {Object} node The AST node whose source code (specifically) is needed
* @param {Integer} beforeCount Include beforeCount number of characters prior to the node's code
* @param {Integer} afterCount Include afterCount number of characters following the node's code
* @returns {String} source code of the specified node plus extra characters specified by beforeCount & afterCount
*/
getText: function (node, beforeCount, afterCount) {

@@ -31,0 +31,0 @@ var sourceCodeText = this.text; console.log (node);

{
"name": "solium",
"version": "0.0.1",
"version": "0.0.2",
"description": "A flexible, stand-alone linter for Ethereum Solidity",
"main": "./lib/solium.js",
"bin": {
"solium": "./bin/solium.js"
"solium": "./bin/solium.js"
},

@@ -9,0 +9,0 @@ "scripts": {

@@ -6,3 +6,3 @@ # Solium

```bash
npm install solium
npm install -g solium
```

@@ -29,1 +29,26 @@

```
#Integrate Solium in your app
To access Solium's API, first install it:
```bash
npm install --save solium
```
##Usage
```js
let Solium = require ('solium'),
sourceCode = 'contract fOO_bar { function HELLO_WORLD () {} }';
let errorObjects = Solium.lint (sourceCode, {
rules: {
camelcase: true,
mixedcase: true
}
});
errorObjects.forEach ( (err) => {
console.log (err);
});
```
For a list of all available rules, see [solium.json](https://github.com/duaraghav8/Solium/blob/master/config/solium.json).
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