mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add style checker
Rename files Changes from review Update test/docsCodeStyle.sh Co-Authored-By: chriseth <chris@ethereum.org> Update test/docsCodeStyle.sh Co-Authored-By: chriseth <chris@ethereum.org> Remove extraneous brackets
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "solhint:default",
|
||||
"plugins": [],
|
||||
"rules": {
|
||||
"compiler-fixed": false,
|
||||
"no-inline-assembly": false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
*contributing_rst*
|
||||
@@ -308,6 +308,7 @@ SOLTMPDIR=$(mktemp -d)
|
||||
set -e
|
||||
cd "$SOLTMPDIR"
|
||||
"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/docs/ docs
|
||||
|
||||
for f in *.sol
|
||||
do
|
||||
# The contributors guide uses syntax tests, but we cannot
|
||||
@@ -317,6 +318,7 @@ SOLTMPDIR=$(mktemp -d)
|
||||
continue
|
||||
fi
|
||||
echo "$f"
|
||||
|
||||
opts=''
|
||||
# We expect errors if explicitly stated, or if imports
|
||||
# are used (in the style guide)
|
||||
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
## GLOBAL VARIABLES
|
||||
|
||||
REPO_ROOT=$(cd $(dirname "$0")/.. && pwd)
|
||||
|
||||
## FUNCTIONS
|
||||
|
||||
if [ "$CIRCLECI" ]
|
||||
then
|
||||
function printTask() { echo "$(tput bold)$(tput setaf 2)$1$(tput setaf 7)"; }
|
||||
function printError() { echo "$(tput setaf 1)$1$(tput setaf 7)"; }
|
||||
else
|
||||
function printTask() { echo "$(tput bold)$(tput setaf 2)$1$(tput sgr0)"; }
|
||||
function printError() { echo "$(tput setaf 1)$1$(tput sgr0)"; }
|
||||
fi
|
||||
|
||||
printTask "Checking docs examples style"
|
||||
SOLTMPDIR=$(mktemp -d)
|
||||
(
|
||||
set -e
|
||||
cd "$SOLTMPDIR"
|
||||
"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/docs/ docs
|
||||
|
||||
if npm -v >/dev/null 2>&1; then
|
||||
if npm list -g | grep solhint >/dev/null 2>&1; then
|
||||
echo "node is installed, setting up solhint"
|
||||
cp "$REPO_ROOT"/test/.solhint.json "$SOLTMPDIR"/.solhint.json
|
||||
cp "$REPO_ROOT"/test/.solhintignore "$SOLTMPDIR"/.solhintignore
|
||||
|
||||
for f in *.sol
|
||||
do
|
||||
echo "$f"
|
||||
# Only report errors
|
||||
solhint -f unix "$SOLTMPDIR/$f"
|
||||
done
|
||||
else
|
||||
echo "node is installed, but not solhint"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "node not installed, skipping docs style checker"
|
||||
exit 1
|
||||
fi
|
||||
)
|
||||
rm -rf "$SOLTMPDIR"
|
||||
echo "Done."
|
||||
Reference in New Issue
Block a user