Skip to content

Commit

Permalink
contracts: Add Solidity Linter to Travis (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
terencechain authored and rauljordan committed Aug 6, 2018
1 parent bfaa248 commit 7a1f586
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 6 deletions.
16 changes: 16 additions & 0 deletions .soliumrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": "solium:recommended",
"plugins": [
"security"
],
"rules": {
"quotes": [
"error",
"double"
],
"indentation": [
"error",
4
]
}
}
21 changes: 17 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ matrix:
install: true # Skip install go packages.

script:
# Ensure everything builds
# Ensure everything builds.
- |
bazel \
--bazelrc=.travis-bazelrc \
Expand All @@ -68,11 +68,24 @@ matrix:
# Check that BUILD files are formatted correctly.
- ./check_gazelle.sh

# Check that target visibility is correct..
# Check that target visibility is correct.
- ./check_visibility.sh

# Shutdown must be last.
- bazel shutdown
- bazel shutdown

notifications:
email: false

- language: node_js
os: linux
env:
- solidity
node_js:
- "lts/*"
before_install:
- npm install -g solium
install: true # Skip npm install.
script:
# Check solidity linter.
- solium -d contracts/
10 changes: 8 additions & 2 deletions contracts/validator_registration.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ contract ValidatorRegistration {
)
public payable
{
require(msg.value == VALIDATOR_DEPOSIT);
require(!usedPubkey[_pubkey]);
require(
msg.value == VALIDATOR_DEPOSIT,
"Incorrect validator deposit"
);
require(
!usedPubkey[_pubkey],
"Public key already used"
);

usedPubkey[_pubkey] = true;

Expand Down

0 comments on commit 7a1f586

Please sign in to comment.