Skip to content

Commit

Permalink
test.yaml: Add misspell checker in lint/test jobs.
Browse files Browse the repository at this point in the history
Fix typos across project.
  • Loading branch information
hjpotter92 committed Oct 13, 2022
1 parent 27945ea commit 12358f5
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 23 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ jobs:
version: v1.39.0
args: '--disable-all --enable=gofmt --enable=vet --enable=golint --deadline=4m pm verification'

- name: Run Revive Action by building from repository
uses: docker://morphy/revive-action:v2
with:
config: config.toml

- name: misspell
uses: reviewdog/action-misspell@v1

- name: Run tests with coverage
run: |
export PKG_CONFIG_PATH=~/compiled/lib/pkgconfig
Expand Down
5 changes: 1 addition & 4 deletions cmd/devtool/devtool/devtool_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,7 @@ func (d *Devtool) InitializeOrchestrator(cfg DevtoolConfig) error {
if err := d.InitializeRound(); err != nil {
return err
}
if err := d.RegisterOrchestrator(cfg); err != nil {
return err
}
return nil
return d.RegisterOrchestrator(cfg)
}

func (d *Devtool) RequestTokens() error {
Expand Down
6 changes: 1 addition & 5 deletions cmd/livepeer/starter/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -1351,11 +1351,7 @@ func checkOrStoreChainID(dbh *common.DB, chainID *big.Int) error {
if expectedChainID == nil {
// No chainID stored yet
// Store the provided chainID and skip the check
if err := dbh.SetChainID(chainID); err != nil {
return err
}

return nil
return dbh.SetChainID(chainID)
}

if expectedChainID.Cmp(chainID) != 0 {
Expand Down
34 changes: 34 additions & 0 deletions config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ignoreGeneratedHeader = false
severity = "warning"
confidence = 0.8
errorCode = 1
warningCode = 0

[rule.exported]
Disabled = true

[rule.package-comments]
Disabled = true

[rule.blank-imports]
[rule.context-as-argument]
[rule.context-keys-type]
[rule.dot-imports]
[rule.error-return]
[rule.error-strings]
[rule.error-naming]
[rule.if-return]
[rule.increment-decrement]
[rule.var-naming]
[rule.var-declaration]
[rule.range]
[rule.receiver-naming]
[rule.time-naming]
[rule.unexported-return]
[rule.indent-error-flow]
[rule.errorf]
[rule.empty-block]
[rule.superfluous-else]
[rule.unused-parameter]
[rule.unreachable-code]
[rule.redefines-builtin-id]
4 changes: 2 additions & 2 deletions core/accounting.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (a *AddressBalances) Credit(addr ethcommon.Address, id ManifestID, amount *
a.balancesForAddr(addr).Credit(id, amount)
}

// Debit substracts an amount from the balance for an address' ManifestID
// Debit subtracts an amount from the balance for an address' ManifestID
func (a *AddressBalances) Debit(addr ethcommon.Address, id ManifestID, amount *big.Rat) {
a.balancesForAddr(addr).Debit(id, amount)
}
Expand Down Expand Up @@ -146,7 +146,7 @@ func (b *Balances) Credit(id ManifestID, amount *big.Rat) {
b.balances[id].lastUpdate = time.Now()
}

// Debit substracts an amount from the balance for a ManifestID
// Debit subtracts an amount from the balance for a ManifestID
func (b *Balances) Debit(id ManifestID, amount *big.Rat) {
b.mtx.Lock()
defer b.mtx.Unlock()
Expand Down
9 changes: 2 additions & 7 deletions eth/types/merkletree.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,8 @@ func buildMerkleTree(hashes []common.Hash) ([]*MerkleTreeNode, *MerkleTreeNode)
func combinedHash(first common.Hash, second common.Hash) common.Hash {
if hashCmp(first, second) == -1 {
return common.BytesToHash(crypto.Keccak256(first.Bytes(), second.Bytes()))
} else {
return common.BytesToHash(crypto.Keccak256(second.Bytes(), first.Bytes()))
}
return common.BytesToHash(crypto.Keccak256(second.Bytes(), first.Bytes()))
}

func checkHashDups(hashes []common.Hash) bool {
Expand Down Expand Up @@ -134,9 +133,5 @@ func VerifyProof(rootHash common.Hash, hash common.Hash, proof *MerkleProof) boo
}
}

if currHash == rootHash {
return true
} else {
return false
}
return currHash == rootHash
}
2 changes: 1 addition & 1 deletion eth/watchers/senderwatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func (sw *SenderWatcher) handleLog(log types.Log) error {
// Draw from reserve
diff := new(big.Int).Sub(amount, info.Deposit)
info.Deposit = big.NewInt(0)
// Substract the difference from the remaining reserve
// Subtract the difference from the remaining reserve
info.Reserve.FundsRemaining.Sub(info.Reserve.FundsRemaining, diff)
// Add the difference to the amount claimed from the reserve in the current round
info.Reserve.ClaimedInCurrentRound.Add(info.Reserve.ClaimedInCurrentRound, diff)
Expand Down
2 changes: 1 addition & 1 deletion monitor/census.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func InitCensus(nodeType NodeType, version string) {
census.mTicketsSent = stats.Int64("tickets_sent", "TicketsSent", "tot")
census.mPaymentCreateError = stats.Int64("payment_create_errors", "PaymentCreateError", "tot")
census.mDeposit = stats.Float64("broadcaster_deposit", "Current remaining deposit for the broadcaster node", "gwei")
census.mReserve = stats.Float64("broadcaster_reserve", "Current remaing reserve for the broadcaster node", "gwei")
census.mReserve = stats.Float64("broadcaster_reserve", "Current remaining reserve for the broadcaster node", "gwei")

// Metrics for receiving payments
census.mTicketValueRecv = stats.Float64("ticket_value_recv", "TicketValueRecv", "gwei")
Expand Down
2 changes: 1 addition & 1 deletion pm/sendermonitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func (sm *LocalSenderMonitor) redeemWinningTicket(ticket *SignedTicket) (*types.
//
// TODO(yondonfu): Should ultimately add back only the amount that
// was actually successfully redeemed in order to take into account
// the case where the ticket was not redeemd for its full face value
// the case where the ticket was not redeemed for its full face value
// because the reserve was insufficient
if err := sm.addFloat(ticket.Ticket.Sender, ticket.Ticket.FaceValue); err != nil {
glog.Error(err)
Expand Down
2 changes: 1 addition & 1 deletion server/cliserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func TestActivateOrchestrator(t *testing.T) {
assert.Equal(strings.TrimSpace(string(body)), "strconv.ParseFloat: parsing \"foo\": invalid syntax")
form["feeShare"] = []string{"10"}

// setOrchestratorPriceInfo is tested in webserver_test.go seperately
// setOrchestratorPriceInfo is tested in webserver_test.go separately

// Test no serviceURI
form["serviceURI"] = []string{""}
Expand Down
2 changes: 1 addition & 1 deletion server/mediaserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func (s *LivepeerServer) StartMediaServer(ctx context.Context, httpAddr string)
s.LPMS.HandleRTMPPublish(createRTMPStreamIDHandler(ctx, s, nil), gotRTMPStreamHandler(s), endRTMPStreamHandler(s))
s.LPMS.HandleRTMPPlay(getRTMPStreamHandler(s))

//LPMS hanlder for handling HLS video play
//LPMS handler for handling HLS video play
s.LPMS.HandleHLSPlay(getHLSMasterPlaylistHandler(s), getHLSMediaPlaylistHandler(s), getHLSSegmentHandler(s))

//Start the LPMS server
Expand Down

0 comments on commit 12358f5

Please sign in to comment.