Skip to content

Commit

Permalink
feat: json serialize severity as string
Browse files Browse the repository at this point in the history
commit e488880
Author: Kevin Tarhan <kevin.tarhan@thetradedesk.com>
Date:   Wed Aug 9 15:01:19 2023 -0700

    Pass linting check

commit 997e7ef
Author: Kevin Tarhan <kevin.tarhan@thetradedesk.com>
Date:   Wed Aug 9 10:26:16 2023 -0700

    Overrides severity Marshalling

commit 5086d2c
Author: Adam <adam.mills@thetradedesk.com>
Date:   Mon Jul 10 08:53:17 2023 +1000

    Revert "ci: testing push"

    This reverts commit b0f9860.

commit b0f9860
Author: Adam <adam.mills@thetradedesk.com>
Date:   Mon Jul 10 08:49:40 2023 +1000

    ci: testing push

commit f69aa5b
Merge: e3d60bc 8b33e69
Author: Adam Mills <adam@koalasafe.com>
Date:   Mon Jul 10 07:51:54 2023 +1000

    Merge branch 'cloudflare:main' into main

commit e3d60bc
Merge: 9bf8f28 1873dac
Author: Adam Mills <adam@koalasafe.com>
Date:   Mon Jul 10 07:51:06 2023 +1000

    Merge pull request #1 from thetradedesk/feature/aam-json-reporter

    feat: JSON Reporter

commit 1873dac
Author: Adam <adam.mills@thetradedesk.com>
Date:   Fri Jul 7 11:59:29 2023 +1000

    PR Fixes

commit fea883d
Author: Adam Mills <adam@koalasafe.com>
Date:   Fri Jul 7 11:51:33 2023 +1000

    Apply suggestions from code review

    Co-authored-by: Mohak Kataria <mohakkataria@outlook.com>

commit 8b33e69
Merge: 9bf8f28 5342d45
Author: Łukasz Mierzwa <lukasz@cloudflare.com>
Date:   Wed Jul 5 17:51:48 2023 +0100

    Merge pull request cloudflare#669 from cloudflare/dependabot/docker/debian-stable-20230703

    Bump debian from stable-20230612 to stable-20230703

commit 5342d45
Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Date:   Wed Jul 5 16:15:08 2023 +0000

    Bump debian from stable-20230612 to stable-20230703

    Bumps debian from stable-20230612 to stable-20230703.

    ---
    updated-dependencies:
    - dependency-name: debian
      dependency-type: direct:production
    ...

    Signed-off-by: dependabot[bot] <support@github.com>

commit 5d249c7
Author: Adam Mills <adam.mills@thetradedesk.com>
Date:   Wed Jul 5 12:35:17 2023 +1000

    re-disabling code coverage failing build

commit 43b226e
Author: Adam Mills <adam.mills@thetradedesk.com>
Date:   Wed Jul 5 12:22:12 2023 +1000

    undo ci cahnge

commit 9b8cf7e
Author: Adam Mills <adam.mills@thetradedesk.com>
Date:   Wed Jul 5 12:04:42 2023 +1000

    ignoring code-coverage failure

commit 5e17eb1
Author: Adam Mills <adam.mills@thetradedesk.com>
Date:   Wed Jul 5 11:41:24 2023 +1000

    fixing nil check

commit d11d707
Author: Adam Mills <adam.mills@thetradedesk.com>
Date:   Wed Jul 5 11:32:54 2023 +1000

    lint

commit aae8df0
Author: adam.mills <adam.mills@thetradedesk.com>
Date:   Wed Jul 5 11:14:03 2023 +1000

    lint

commit 1340dfc
Author: adam.mills <adam.mills@thetradedesk.com>
Date:   Wed Jul 5 10:28:00 2023 +1000

    added tests

commit 6d27461
Author: adam.mills <adam.mills@thetradedesk.com>
Date:   Wed Jul 5 09:09:50 2023 +1000

    stash: need to do json marshalling
  • Loading branch information
Adam Mills committed Aug 22, 2023
1 parent 660db91 commit 085d62e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR /src
RUN apk add make git
RUN make

FROM debian:stable-20230612
FROM debian:stable-20230703
RUN apt-get update --yes && \
apt-get install --no-install-recommends --yes git ca-certificates && \
rm -rf /var/lib/apt/lists/*
Expand Down
5 changes: 5 additions & 0 deletions internal/checks/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package checks

import (
"context"
"encoding/json"
"errors"
"fmt"

Expand Down Expand Up @@ -78,6 +79,10 @@ func ParseSeverity(s string) (Severity, error) {
}
}

func (s Severity) MarshalJSON() ([]byte, error) {
return json.Marshal(s.String())
}

const (
// Information doesn't count as a problem, it's a comment
Information Severity = iota
Expand Down
2 changes: 1 addition & 1 deletion internal/reporter/json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ func TestJSONReporter(t *testing.T) {
defer jsonFile.Close()
byteValue, err := io.ReadAll(jsonFile)
require.NoError(t, err, "Error reading json")
expected := "[{\"reportedPath\":\"\",\"sourcePath\":\"foo.txt\",\"rule\":{\"name\":\"sum errors\",\"type\":\"recording\"},\"problem\":{\"Fragment\":\"syntax error\",\"Lines\":[2],\"Reporter\":\"mock\",\"Text\":\"syntax error\",\"Severity\":3},\"owner\":\"\"}]"
expected := "[{\"reportedPath\":\"\",\"sourcePath\":\"foo.txt\",\"rule\":{\"name\":\"sum errors\",\"type\":\"recording\"},\"problem\":{\"Fragment\":\"syntax error\",\"Lines\":[2],\"Reporter\":\"mock\",\"Text\":\"syntax error\",\"Severity\":\"Fatal\"},\"owner\":\"\"}]"
require.Equal(t, expected, string(byteValue))
}

0 comments on commit 085d62e

Please # to comment.