Repository: protofire/solhint
Pull request #621 (2025-01-01 14:19:27)

fix: update compiler version


Patch:
diff --git a/conf/rulesets/solhint-all.js b/conf/rulesets/solhint-all.js
index 5c0629e..0c51314 100644
--- a/conf/rulesets/solhint-all.js
+++ b/conf/rulesets/solhint-all.js
@@ -71,7 +71,7 @@ module.exports = Object.freeze({
     'avoid-throw': 'warn',
     'avoid-tx-origin': 'warn',
     'check-send-result': 'warn',
-    'compiler-version': ['error', '^0.8.0'],
+    'compiler-version': ['error', '^0.8.24'],
     'func-visibility': [
       'warn',
       {
diff --git a/conf/rulesets/solhint-recommended.js b/conf/rulesets/solhint-recommended.js
index da7f609..9e68908 100644
--- a/conf/rulesets/solhint-recommended.js
+++ b/conf/rulesets/solhint-recommended.js
@@ -43,7 +43,7 @@ module.exports = Object.freeze({
     'avoid-throw': 'warn',
     'avoid-tx-origin': 'warn',
     'check-send-result': 'warn',
-    'compiler-version': ['error', '^0.8.0'],
+    'compiler-version': ['error', '^0.8.24'],
     'func-visibility': [
       'warn',
       {
diff --git a/docs/rules/security/compiler-version.md b/docs/rules/security/compiler-version.md
index 5bb37df..6082b57 100644
--- a/docs/rules/security/compiler-version.md
+++ b/docs/rules/security/compiler-version.md
@@ -20,14 +20,14 @@ This rule accepts an array of options:
 | Index | Description                                           | Default Value |
 | ----- | ----------------------------------------------------- | ------------- |
 | 0     | Rule severity. Must be one of "error", "warn", "off". | error         |
-| 1     | Semver requirement                                    | ^0.8.0        |
+| 1     | Semver requirement                                    | ^0.8.24       |
 
 
 ### Example Config
 ```json
 {
   "rules": {
-    "compiler-version": ["error","^0.8.0"]
+    "compiler-version": ["error","^0.8.24"]
   }
 }
 ```
diff --git a/lib/rules/security/compiler-version.js b/lib/rules/security/compiler-version.js
index 955a53b..c7e4ef3 100644
--- a/lib/rules/security/compiler-version.js
+++ b/lib/rules/security/compiler-version.js
@@ -4,7 +4,7 @@ const { severityDescription } = require('../../doc/utils')
 
 const ruleId = 'compiler-version'
 const DEFAULT_SEVERITY = 'error'
-const DEFAULT_SEMVER = '^0.8.0'
+const DEFAULT_SEMVER = '^0.8.24'
 const meta = {
   type: 'security',
 
diff --git a/package-lock.json b/package-lock.json
index fef8f0d..678f151 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
 {
   "name": "solhint",
-  "version": "5.0.3",
+  "version": "5.0.4",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {


Test patch:
diff --git a/e2e/03-no-empty-blocks/.solhint.json b/e2e/03-no-empty-blocks/.solhint.json
index a64b9a2..6a0c26c 100644
--- a/e2e/03-no-empty-blocks/.solhint.json
+++ b/e2e/03-no-empty-blocks/.solhint.json
@@ -1,5 +1,6 @@
 {
   "rules": {
-    "no-empty-blocks": "error"
+    "no-empty-blocks": "error",
+    "compiler-version": "off"
   }
 }
diff --git a/e2e/04-dotSol-on-path/.solhint.json b/e2e/04-dotSol-on-path/.solhint.json
index 1ee2c69..97d9efe 100644
--- a/e2e/04-dotSol-on-path/.solhint.json
+++ b/e2e/04-dotSol-on-path/.solhint.json
@@ -1,5 +1,6 @@
 {
   "rules": {
-    "no-empty-blocks": "off"
+    "no-empty-blocks": "off",
+    "compiler-version": "off"
   }
 }
diff --git a/e2e/05-max-warnings/contracts/Foo.sol b/e2e/05-max-warnings/contracts/Foo.sol
index 1c04574..e97cea3 100644
--- a/e2e/05-max-warnings/contracts/Foo.sol
+++ b/e2e/05-max-warnings/contracts/Foo.sol
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: MIT
-pragma solidity >=0.8.0;
+pragma solidity >=0.8.24;
 
 contract Foo {
     uint256 public constant test1 = 1;
diff --git a/e2e/06-formatters/contracts/Foo2.sol b/e2e/06-formatters/contracts/Foo2.sol
index 4a5c2af..9e0b71c 100644
--- a/e2e/06-formatters/contracts/Foo2.sol
+++ b/e2e/06-formatters/contracts/Foo2.sol
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: MIT
-pragma solidity >=0.8.0;
+pragma solidity >=0.8.24;
 
 contract Foo {
     uint256 public constant test1 = 1;
diff --git a/e2e/06-formatters/contracts/Foo3.sol b/e2e/06-formatters/contracts/Foo3.sol
index 8c1c1e0..e9ea729 100644
--- a/e2e/06-formatters/contracts/Foo3.sol
+++ b/e2e/06-formatters/contracts/Foo3.sol
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: MIT
-pragma solidity >=0.8.0;
+pragma solidity >=0.8.24;
 
 contract Foo {
     uint256 public constant TEST1 = 1;
diff --git a/e2e/06-formatters/helpers/helpers.js b/e2e/06-formatters/helpers/helpers.js
index 8376310..e23b568 100644
--- a/e2e/06-formatters/helpers/helpers.js
+++ b/e2e/06-formatters/helpers/helpers.js
@@ -3,7 +3,7 @@ const foo1Output = [
     line: 2,
     column: 1,
     severity: 'Error',
-    message: 'Compiler version >=0.6.0 does not satisfy the ^0.8.0 semver requirement',
+    message: 'Compiler version >=0.6.0 does not satisfy the ^0.8.24 semver requirement',
     ruleId: 'compiler-version',
     fix: null,
     filePath: 'contracts/Foo.sol',
diff --git a/e2e/08-autofix/_commands/Foo1.sol b/e2e/08-autofix/_commands/Foo1.sol
index 78bcaec..f5b6b3c 100644
--- a/e2e/08-autofix/_commands/Foo1.sol
+++ b/e2e/08-autofix/_commands/Foo1.sol
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: Apache-2.0
-pragma solidity ^0.8.4;
+pragma solidity ^0.8.24;
 
 import {ERC20Burnable} from '@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol';
 
diff --git a/e2e/08-autofix/_commands/Foo1AfterFix.sol b/e2e/08-autofix/_commands/Foo1AfterFix.sol
index ca900d6..b45f2be 100644
--- a/e2e/08-autofix/_commands/Foo1AfterFix.sol
+++ b/e2e/08-autofix/_commands/Foo1AfterFix.sol
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: Apache-2.0
-pragma solidity ^0.8.4;
+pragma solidity ^0.8.24;
 
 import {ERC20Burnable} from '@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol';
 
diff --git a/e2e/08-autofix/_commands/Foo1BeforeFix.sol b/e2e/08-autofix/_commands/Foo1BeforeFix.sol
index 78bcaec..f5b6b3c 100644
--- a/e2e/08-autofix/_commands/Foo1BeforeFix.sol
+++ b/e2e/08-autofix/_commands/Foo1BeforeFix.sol
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: Apache-2.0
-pragma solidity ^0.8.4;
+pragma solidity ^0.8.24;
 
 import {ERC20Burnable} from '@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol';
 
diff --git a/e2e/08-autofix/avoid-suicide/.solhint.json b/e2e/08-autofix/avoid-suicide/.solhint.json
index 7f54d63..99c16ec 100644
--- a/e2e/08-autofix/avoid-suicide/.solhint.json
+++ b/e2e/08-autofix/avoid-suicide/.solhint.json
@@ -1,5 +1,6 @@
 {
   "rules": {
-    "avoid-suicide": "error"
+    "avoid-suicide": "error",
+    "compiler-version": "off"
   }
 }
diff --git a/e2e/08-autofix/contract-name-capwords/.solhint.json b/e2e/08-autofix/contract-name-capwords/.solhint.json
index e1789ab..d80e50f 100644
--- a/e2e/08-autofix/contract-name-capwords/.solhint.json
+++ b/e2e/08-autofix/contract-name-capwords/.solhint.json
@@ -1,5 +1,6 @@
 {
   "rules": {
-    "contract-name-capwords": "error"
+    "contract-name-capwords": "error",
+    "compiler-version": "off"
   }
 }
diff --git a/e2e/08-autofix/event-name-capwords/.solhint.json b/e2e/08-autofix/event-name-capwords/.solhint.json
index 22cb73d..9fc6a6b 100644
--- a/e2e/08-autofix/event-name-capwords/.solhint.json
+++ b/e2e/08-autofix/event-name-capwords/.solhint.json
@@ -1,5 +1,6 @@
 {
   "rules": {
-    "event-name-capwords": "error"
+    "event-name-capwords": "error",
+    "compiler-version": "off"
   }
 }
diff --git a/e2e/08-autofix/explicit-types/.solhint.json b/e2e/08-autofix/explicit-types/.solhint.json
index 7bd7c6a..f46aa77 100644
--- a/e2e/08-autofix/explicit-types/.solhint.json
+++ b/e2e/08-autofix/explicit-types/.solhint.json
@@ -1,5 +1,6 @@
 {
   "rules": {
-    "explicit-types": ["error", "explicit"]
+    "explicit-types": ["error", "explicit"],
+    "compiler-version": "off"
   }
 }
diff --git a/e2e/08-autofix/imports-order/.solhint.json b/e2e/08-autofix/imports-order/.solhint.json
index b17afc5..13709f7 100644
--- a/e2e/08-autofix/imports-order/.solhint.json
+++ b/e2e/08-autofix/imports-order/.solhint.json
@@ -1,5 +1,6 @@
 {
   "rules": {
-    "imports-order": "error"
+    "imports-order": "error",
+    "compiler-version": "off"
   }
 }
diff --git a/e2e/08-autofix/no-console/.solhint.json b/e2e/08-autofix/no-console/.solhint.json
index 2ff50f9..f5e0eb1 100644
--- a/e2e/08-autofix/no-console/.solhint.json
+++ b/e2e/08-autofix/no-console/.solhint.json
@@ -1,5 +1,6 @@
 {
   "rules": {
-    "no-console": "error"
+    "no-console": "error",
+    "compiler-version": "off"
   }
 }
diff --git a/e2e/08-autofix/payable-fallback/.solhint.json b/e2e/08-autofix/payable-fallback/.solhint.json
index aa02d3b..c6939a0 100644
--- a/e2e/08-autofix/payable-fallback/.solhint.json
+++ b/e2e/08-autofix/payable-fallback/.solhint.json
@@ -1,5 +1,6 @@
 {
   "rules": {
-    "payable-fallback": "error"
+    "payable-fallback": "error",
+    "compiler-version": "off"
   }
 }
diff --git a/e2e/08-autofix/private-vars-underscore/.solhint.json b/e2e/08-autofix/private-vars-underscore/.solhint.json
index 47ff676..a4b8eef 100644
--- a/e2e/08-autofix/private-vars-underscore/.solhint.json
+++ b/e2e/08-autofix/private-vars-underscore/.solhint.json
@@ -1,5 +1,6 @@
 {
   "rules": {
-    "private-vars-leading-underscore": ["error",{"strict":false}]
+    "private-vars-leading-underscore": ["error",{"strict":false}],
+    "compiler-version": "off"
   }
 }
diff --git a/e2e/08-autofix/quotes/.doubleQuotes.json b/e2e/08-autofix/quotes/.doubleQuotes.json
index bd5e47b..21faf61 100644
--- a/e2e/08-autofix/quotes/.doubleQuotes.json
+++ b/e2e/08-autofix/quotes/.doubleQuotes.json
@@ -1,5 +1,6 @@
 {
   "rules": {
-    "quotes": ["error", "double"]
+    "quotes": ["error", "double"],
+    "compiler-version": "off"
   }
 }
diff --git a/e2e/08-autofix/quotes/.singleQuotes.json b/e2e/08-autofix/quotes/.singleQuotes.json
index 1cd619b..cde7326 100644
--- a/e2e/08-autofix/quotes/.singleQuotes.json
+++ b/e2e/08-autofix/quotes/.singleQuotes.json
@@ -1,5 +1,6 @@
 {
   "rules": {
-    "quotes": ["error", "single"]
+    "quotes": ["error", "single"],
+    "compiler-version": "off"
   }
 }
diff --git a/e2e/formatters-test.js b/e2e/formatters-test.js
index 0b95558..f903f24 100644
--- a/e2e/formatters-test.js
+++ b/e2e/formatters-test.js
@@ -507,7 +507,7 @@ describe('e2e', function () {
           {
             level: 'error',
             message: {
-              text: 'Compiler version >=0.6.0 does not satisfy the ^0.8.0 semver requirement',
+              text: 'Compiler version >=0.6.0 does not satisfy the ^0.8.24 semver requirement',
             },
             locations: [
               {
diff --git a/test/rules/best-practices/no-global-import.js b/test/rules/best-practices/no-global-import.js
index 7a357e1..c163085 100644
--- a/test/rules/best-practices/no-global-import.js
+++ b/test/rules/best-practices/no-global-import.js
@@ -28,7 +28,7 @@ describe('Linter - no-global-import', () => {
     assertErrorMessage(report, 'Specify names to import individually')
   })
   it('should raise warning when using solhint:recommended', () => {
-    const code = `pragma solidity ^0.8.0; import "./A.sol";`
+    const code = `pragma solidity ^0.8.24; import "./A.sol";`
 
     const report = linter.processStr(code, {
       extends: 'solhint:recommended',
diff --git a/test/rules/best-practices/no-unused-import.js b/test/rules/best-practices/no-unused-import.js
index f366689..32c18ce 100644
--- a/test/rules/best-practices/no-unused-import.js
+++ b/test/rules/best-practices/no-unused-import.js
@@ -48,7 +48,7 @@ describe('Linter - no-unused-import', () => {
   })
 
   it('should raise error when using solhint:recommended', () => {
-    const code = `pragma solidity ^0.8.0; import {A} from "./A.sol";`
+    const code = `pragma solidity ^0.8.24; import {A} from "./A.sol";`
 
     const report = linter.processStr(code, {
       extends: 'solhint:recommended',
diff --git a/test/rules/security/compiler-version.js b/test/rules/security/compiler-version.js
index b3c51fe..6257856 100644
--- a/test/rules/security/compiler-version.js
+++ b/test/rules/security/compiler-version.js
@@ -2,7 +2,7 @@ const assert = require('assert')
 const { assertNoErrors, assertErrorCount, assertErrorMessage } = require('../../common/asserts')
 const linter = require('../../../lib/index')
 
-const DEFAULT_SEMVER = '^0.8.0'
+const DEFAULT_SEMVER = '^0.8.24'
 
 describe('Linter - compiler-version', () => {
   it('should disable only one compiler error on next line', () => {
@@ -123,15 +123,15 @@ describe('Linter - compiler-version', () => {
   })
 
   it('should not report compiler version error on exact match', () => {
-    const report = linter.processStr('pragma solidity 0.8.0;', {
-      rules: { 'compiler-version': ['error', '0.8.0'] },
+    const report = linter.processStr('pragma solidity 0.8.24;', {
+      rules: { 'compiler-version': ['error', '0.8.24'] },
     })
 
     assert.equal(report.errorCount, 0)
   })
 
   it('should not report compiler version error on range match', () => {
-    const report = linter.processStr('pragma solidity ^0.8.0;', {
+    const report = linter.processStr('pragma solidity ^0.8.24;', {
       rules: { 'compiler-version': ['error', DEFAULT_SEMVER] },
     })
 
@@ -139,7 +139,7 @@ describe('Linter - compiler-version', () => {
   })
 
   it('should not report compiler version error on patch bump', () => {
-    const report = linter.processStr('pragma solidity 0.8.1;', {
+    const report = linter.processStr('pragma solidity 0.8.25;', {
       rules: { 'compiler-version': ['error', DEFAULT_SEMVER] },
     })
 
@@ -147,7 +147,7 @@ describe('Linter - compiler-version', () => {
   })
 
   it('should not report compiler version error on range match', () => {
-    const report = linter.processStr('pragma solidity ^0.8.2;', {
+    const report = linter.processStr('pragma solidity ^0.8.25;', {
       rules: { 'compiler-version': ['error', DEFAULT_SEMVER] },
     })
 
@@ -207,7 +207,7 @@ describe('Linter - compiler-version', () => {
 
   it(`should not report compiler version error using default and correct pragma`, () => {
     const report = linter.processStr(
-      `pragma solidity ^0.8.1;
+      `pragma solidity ^0.8.25;
        pragma experimental ABIEncoderV2;
        
        contract Main {
@@ -237,7 +237,7 @@ describe('Linter - compiler-version', () => {
 
   it(`should not report compiler version error using >= and default and correct pragma`, () => {
     const report = linter.processStr(
-      `pragma solidity >=0.8.0;
+      `pragma solidity >=0.8.24;
        
        contract Main {
        }`,