Skip to content

Commit

Permalink
fixed quotes rule and added docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dbale-altoros committed Jul 6, 2023
1 parent 74f6707 commit a18f72e
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 5 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ Commands:
stdin [options] linting of source code data provided to STDIN
```
### Note
`--fix` option currently works only on "avoid-throw" and "avoid-sha3" rules

The `--fix` option currently works only on "avoid-throw" and "avoid-sha3" rules
<br><br>
## Configuration

You can use a `.solhint.json` file to configure Solhint for the whole project.
Expand All @@ -88,6 +88,10 @@ This file has the following format:
"extends": "solhint:default"
}
```
### Note
The `solhint:default` configuration contains only two rules: max-line-length & no-console
<br><br>


### Sample
```json
Expand Down
3 changes: 2 additions & 1 deletion docs/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ title: "Rule Index of Solhint"
| [no-console](./rules/best-practises/no-console.md) | No console.log/logInt/logBytesX/logString/etc & No hardhat and forge-std console.sol import statements | ✔️ |
| [no-empty-blocks](./rules/best-practises/no-empty-blocks.md) | Code contains empty block. | ✔️ |
| [no-global-import](./rules/best-practises/no-global-import.md) | Import statement includes an entire file instead of selected symbols | ✔️ |
| [no-unused-import](./rules/best-practises/no-unused-import.md) | Imported name is not used | ✔️ |
| [no-unused-vars](./rules/best-practises/no-unused-vars.md) | Variable "name" is unused. | ✔️ |
| [payable-fallback](./rules/best-practises/payable-fallback.md) | When fallback is not payable you will not be able to receive ethers. | ✔️ |
| [reason-string](./rules/best-practises/reason-string.md) | Require or revert statement must have a reason string and check that each reason string is at most N characters long. | ✔️ |
Expand All @@ -26,13 +27,13 @@ title: "Rule Index of Solhint"
| Rule Id | Error | Recommended |
| --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| [comprehensive-interface](./rules/miscellaneous/comprehensive-interface.md) | Check that all public or external functions are override. This is iseful to make sure that the whole API is extracted in an interface. | |
| [quotes](./rules/miscellaneous/quotes.md) | Use double quotes for string literals. Values must be 'single' or 'double'. | ✔️ |

## Style Guide Rules

| Rule Id | Error | Recommended |
| ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- | ----------- |
| [quotes](./rules/miscellaneous/quotes.md) | Use double quotes for string literals. Values must be 'single' or 'double'. | ✔️ |
| [const-name-snakecase](./rules/naming/const-name-snakecase.md) | Constant name must be in capitalized SNAKE_CASE. | ✔️ |
| [contract-name-camelcase](./rules/naming/contract-name-camelcase.md) | Contract name must be in CamelCase. | ✔️ |
| [event-name-camelcase](./rules/naming/event-name-camelcase.md) | Event name must be in CamelCase. | ✔️ |
Expand Down
39 changes: 39 additions & 0 deletions docs/rules/best-practises/no-unused-import.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
warning: "This is a dynamically generated file. Do not edit manually."
layout: "default"
title: "no-unused-import | Solhint"
---

# no-unused-import
![Recommended Badge](https://img.shields.io/badge/-Recommended-brightgreen)
![Category Badge](https://img.shields.io/badge/-Best%20Practise%20Rules-informational)
![Default Severity Badge warn](https://img.shields.io/badge/Default%20Severity-warn-yellow)
> The {"extends": "solhint:recommended"} property in a configuration file enables this rule.

## Description
Imported name is not used

## Options
This rule accepts a string option of rule severity. Must be one of "error", "warn", "off". Default to warn.

### Example Config
```json
{
"rules": {
"no-unused-import": "warn"
}
}
```


## Examples
This rule does not have examples.

## Version
This rule is introduced in the latest version.

## Resources
- [Rule source](https://github.com/protofire/solhint/tree/master/lib/rules/best-practises/no-unused-import.js)
- [Document source](https://github.com/protofire/solhint/tree/master/docs/rules/best-practises/no-unused-import.md)
- [Test cases](https://github.com/protofire/solhint/tree/master/test/rules/best-practises/no-unused-import.js)
2 changes: 1 addition & 1 deletion docs/rules/miscellaneous/quotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: "quotes | Solhint"

# quotes
![Recommended Badge](https://img.shields.io/badge/-Recommended-brightgreen)
![Category Badge](https://img.shields.io/badge/-Style%20Guide%20Rules-informational)
![Category Badge](https://img.shields.io/badge/-Miscellaneous-informational)
![Default Severity Badge error](https://img.shields.io/badge/Default%20Severity-error-red)
> The {"extends": "solhint:recommended"} property in a configuration file enables this rule.
Expand Down
2 changes: 1 addition & 1 deletion lib/rules/miscellaneous/quotes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const meta = {

docs: {
description: `Use double quotes for string literals. Values must be 'single' or 'double'.`,
category: 'Style Guide Rules',
category: 'Miscellaneous',
options: [
{
description: severityDescription,
Expand Down

0 comments on commit a18f72e

Please sign in to comment.