Skip to content

Commit

Permalink
Merge pull request #612 from protofire/fix/remove-husky
Browse files Browse the repository at this point in the history
Removed husky
  • Loading branch information
dbale-altoros authored Dec 19, 2024
2 parents 4187878 + 7a0084f commit ded13a1
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 51 deletions.
4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

11 changes: 11 additions & 0 deletions DEV-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Setting up Git Hooks

After cloning the repository, set up the pre-commit hook by running the following commands:

`git config --unset core.hooksPath`
To reset the hooks config to git default

```sh
touch .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
echo '#!/bin/sh\nnode scripts/check-changes.js' > .git/hooks/pre-commit
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ Or disable all validations for a group of lines:
### Style Guide Rules
[Full list with all supported Style Guide Rules](docs/rules.md#style-guide-rules)
### Best Practices Rules
[Full list with all supported Best Practices Rules](docs/rules.md#best-practise-rules)
[Full list with all supported Best Practices Rules](docs/rules.md#best-practices-rules)

## Docker
### Solhint has an official Docker Image
Expand Down Expand Up @@ -269,7 +269,7 @@ Related documentation you may find [here](https://protofire.github.io/solhint/).
The Solidity parser used is [`@solidity-parser/parser`](https://github.com/solidity-parser/parser).

## Licence
## License

MIT

Expand Down
40 changes: 9 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@
"/solhint.js"
],
"author": "Ilya Drabenia <[email protected]>",
"contributors": ["Diego Bale <[email protected]>"],
"contributors": [
"Diego Bale <[email protected]>"
],
"license": "MIT",
"dependencies": {
"@solidity-parser/parser": "^0.18.0",
"@solidity-parser/parser": "^0.19.0",
"ajv": "^6.12.6",
"antlr4": "^4.13.1-patch-1",
"ast-parents": "^0.0.1",
Expand All @@ -64,7 +66,6 @@
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.3",
"markdown-table": "^2.0.0",
"mocha": "^10.2.0",
"mocha-lcov-reporter": "^1.3.0",
Expand Down
28 changes: 28 additions & 0 deletions scripts/check-changes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const { execSync } = require('child_process');

function changed() {
try {
// Run Git commands to check for changes in the lib/rules directory
const diffIndex = execSync('git diff-index --name-only -B -R -M -C HEAD lib/rules').toString().trim();
const lsFiles = execSync('git ls-files -t -o -m lib/rules').toString().trim();

// Return true if there are changes
return diffIndex !== '' || lsFiles !== '';
} catch (error) {
console.error('Error checking for changes:', error);
return false;
}
}

if (changed()) {
try {
// Run npm commands if there are changes
execSync('npm run generate-rulesets', { stdio: 'inherit' });
execSync('npm run docs', { stdio: 'inherit' });
} catch (error) {
console.error('Error running npm commands:', error);
process.exit(1);
}
} else {
console.log('No changes detected in lib/rules.');
}
11 changes: 0 additions & 11 deletions scripts/generate-changed.sh

This file was deleted.

0 comments on commit ded13a1

Please sign in to comment.