Skip to content

Commit

Permalink
updatet qodana scan
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenvechain committed Dec 21, 2023
1 parent 194594f commit 284a575
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 31 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/qodana_code_quality.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
name: Qodana
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
- static-code-analysis

jobs:
qodana:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v3

- name: Install Go
uses: actions/setup-go@v4
with:
fetch-depth: 0
go-version: 1.21.x

- name: Make all
run: make all

- name: Make Coverage
run: make test-coverage

- name: 'Qodana Scan'
uses: JetBrains/[email protected]
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
with:
pr-mode: true
73 changes: 51 additions & 22 deletions .idea/workspace.xml

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

5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ all: thor disco
clean:
-rm -rf \
$(CURDIR)/bin/thor \
$(CURDIR)/bin/disco
$(CURDIR)/bin/disco

test:| go_version_check
@go test -cover $(PACKAGES)


test-coverage:| go_version_check
@go test -race -coverprofile=.qodana/code-coverage/coverage.out -covermode=atomic $(PACKAGES)
17 changes: 17 additions & 0 deletions api/accounts/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,22 @@ func (a *Accounts) handleGetAccount(w http.ResponseWriter, req *http.Request) er
return utils.WriteJSON(w, acc)
}

func (a *Accounts) handleGetAccountDuplicate(w http.ResponseWriter, req *http.Request) error {
addr, err := thor.ParseAddress(mux.Vars(req)["address"])
if err != nil {
return utils.BadRequest(errors.WithMessage(err, "address"))
}
summary, err := a.handleRevision(req.URL.Query().Get("revision"))
if err != nil {
return err
}
acc, err := a.getAccount(addr, summary)
if err != nil {
return err
}
return utils.WriteJSON(w, acc)
}

func (a *Accounts) handleGetStorage(w http.ResponseWriter, req *http.Request) error {
addr, err := thor.ParseAddress(mux.Vars(req)["address"])
if err != nil {
Expand Down Expand Up @@ -351,6 +367,7 @@ func (a *Accounts) Mount(root *mux.Router, pathPrefix string) {

sub.Path("/*").Methods("POST").HandlerFunc(utils.WrapHandlerFunc(a.handleCallBatchCode))
sub.Path("/{address}").Methods(http.MethodGet).HandlerFunc(utils.WrapHandlerFunc(a.handleGetAccount))
sub.Path("/{address}/duplicate").Methods(http.MethodGet).HandlerFunc(utils.WrapHandlerFunc(a.handleGetAccountDuplicate))
sub.Path("/{address}/code").Methods(http.MethodGet).HandlerFunc(utils.WrapHandlerFunc(a.handleGetCode))
sub.Path("/{address}/storage/{key}").Methods("GET").HandlerFunc(utils.WrapHandlerFunc(a.handleGetStorage))
sub.Path("").Methods("POST").HandlerFunc(utils.WrapHandlerFunc(a.handleCallContract))
Expand Down
Loading

0 comments on commit 284a575

Please sign in to comment.