open-index/open-npm huggingface dataset:
npm package: @hexpayday/solidity-code-metrics
Description: Solidity Code Metrics
Author: tintinweb
Latest version: 0.0.26

[<img width="200" alt="get in touch with Consensys Diligence" src="https://user-images.githubusercontent.com/2865694/56826101-91dcf380-685b-11e9-937c-af49c2510aa0.png">](https://diligence.consensys.net)<br/>
<sup>
[[  🌐  ](https://diligence.consensys.net)  [  📩  ](https://github.com/ConsenSys/vscode-solidity-metrics/blob/master/mailto:diligence@consensys.net)  [  🔥  ](https://consensys.github.io/diligence/)]
</sup><br/><br/>


# Solidity Code Metrics

[🌐](https://www.npmjs.com/package/solidity-code-metrics) `npm install solidity-code-metrics` 

The number-crunching enginge behind 📊[tintinweb.solidity-metrics](https://marketplace.visualstudio.com/items?itemName=tintinweb.solidity-metrics).

![vscode-solidity-metrics3](https://user-images.githubusercontent.com/2865694/78451004-0252de00-7683-11ea-93d7-4c5dc436a14b.gif)

## Example

### CLI

To use the CLI from the compiled sources you can do:

```sh
node ./src/cli.js <path to solidity file(s)>
``` 

It is however more useful to install solidity-metrics globally and call it from any directory:

```sh
npm install -g solidity-code-metrics
solidity-code-metrics myfile1.sol myfile2.sol
```

By default, the cli outputs to the console, you can however store the output in a file rather easily (both markdown and html are supported):

```sh
solidity-code-metrics myfile.sol > metrics.md
solidity-code-metrics myfile.sol --html > metrics.html
```


### Library

```js

const {SolidityMetricsContainer} = require('solidity-metrics');

let options = {
    basePath:"",
    inputFileGlobExclusions:undefined,
    inputFileGlob: undefined,
    inputFileGlobLimit: undefined,
    debug:false,
    repoInfo: {
        branch: undefined,
        commit: undefined,
        remote: undefined
    }    
}

let metrics = new SolidityMetricsContainer("metricsContainerName", options);


// analyze files
metrics.analyze(path_to_solidity_file);
// ...
metrics.analyze(path_to_solidity_file_N);

// output
console.log(metrics.totals());
metrics.generateReportMarkdown().then(text => console.log(text));
// or let text = await metrics.generateReportMarkdown();
```
npm package: @hexput/blockly
Description: A Blockly module for the Hexput programming language.
Author: Erdem Göksel
Latest version: 1.0.10

# Hexput Blockly

This project provides a Blockly integration for the Hexput programming language. It allows visual programming through custom blocks that generate Hexput code, making it easier to create Hexput programs without writing code directly.

## Installation

To install the module, use npm:

```bash
npm install hexput-blockly
```

## Usage

To use Hexput Blockly in your project, import it and initialize the Blockly environment:

```typescript
import Blockly from 'blockly';
import { initBlockly } from 'hexput-blockly';

// Initialize Blockly with your container ID and optional toolbox
initBlockly(Blockly, 'blocklyDiv', yourToolboxDefinition);
```

## Generating Hexput Code

After creating blocks in the Blockly workspace, you can generate Hexput code:

```typescript
import Blockly from 'blockly';

// Get the workspace
const workspace = Blockly.getMainWorkspace();

// Generate Hexput code
const code = Blockly.Hexput.workspaceToCode(workspace);
console.log(code);
```

## Custom Blocks

Hexput Blockly provides many custom blocks for the Hexput language:

### Variables and Literals
- Variable declaration (`vl varName = value`)
- Number, string, and boolean literals
- Variable references

### Arrays and Objects
- Array creation with items
- Object creation with properties
- Array and object property access (dot and bracket notation)

### Operators
- Mathematical operations (addition, subtraction, multiplication, division)
- Comparison operators (equals, not equals, greater than, less than, etc.)
- Logical operators (and, or, not)

### Control Flow
- If statements
- Loop statements

### Functions
- Function calls with parameters

### Example

Here's an example of using blocks to define a variable and perform operations:

```typescript
// In Blockly this would be visual blocks generating:
vl myNumber = 42;
vl myString = "Hello, world!";
vl myResult = myNumber + 10;

if myResult > 50 {
  vl message = myString + " The result is greater than 50!";
}

loop item in [1, 2, 3] {
  vl doubled = item * 2;
}
```

## Custom Block Definition

To define new blocks for Hexput Blockly, you can extend the module with your own block definitions:

```typescript
import Blockly from 'blockly';
import { initBlockly, generateHexputBlockly } from 'hexput-blockly';

// Define your custom block
Blockly.Blocks['my_custom_block'] = {
  init: function() {
    // Block definition logic
  }
};

// Define the generator for your custom block
const hexputGenerator = generateHexputBlockly(Blockly);
hexputGenerator.forBlock['my_custom_block'] = function(block) {
  // Code generation logic
  return 'my custom hexput code';
};
```

## Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue for any suggestions or improvements.

## License

This project is licensed under the MIT License. See the LICENSE file for more details.