Uploaded image for project: 'SEBA'
  1. SEBA
  2. SEBA-892

Resolve any SCA violations in Redfish Importer

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Resolved (View Workflow)
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: SEBA-Next
    • Component/s: NEM
    • Labels:
      None

      Description

      Resolve any violations reported by "make sca"

       

      root@ip-10-5-1-11:~/cord/device-management# make sca

      rm -rf ./sca-report

      /root/bin/golangci-lint run --out-format junit-xml ./... 2>&1 | tee ./sca-report/sca-report.xml

      <testsuites>

        <testsuite name="ineffassign">

          <testcase name="ineffectual assignment to `err`" classname="event_subscriber.go:38:16" status="sRequestJson, err := json.Marshal(subscrpt_info)"></testcase>

          <testcase name="ineffectual assignment to `message`" classname="demo_test/cmd_client/cmd_cl.go:24:6" status="var message string = """></testcase>

        </testsuite>

        <testsuite name="deadcode">

          <testcase name="`REDFISH_ROOT` is unused" classname="demo_test/test.go:37:5" status="var REDFISH_ROOT = "/redfish/v1""></testcase>

          <testcase name="`CONTENT_TYPE` is unused" classname="demo_test/test.go:38:5" status="var CONTENT_TYPE = "application/json""></testcase>

          <testcase name="`DataProducer` is unused" classname="main.go:48:5" status="var DataProducer sarama.AsyncProducer"></testcase>

        </testsuite>

        <testsuite name="errcheck">

          <testcase name="Error return value of `connS.Write` is not checked" classname="demo_test/test.go:347:14" status="connS.Write([]byte(newmessage + "\n"))"></testcase>

          <testcase name="Error return value of `(*encoding/json.Decoder).Decode` is not checked" classname="event_subscriber.go:52:36" status="json.NewDecoder(resp.Body).Decode(&result)"></testcase>

          <testcase name="Error return value of `(*encoding/json.Decoder).Decode` is not checked" classname="event_subscriber.go:83:36" status="json.NewDecoder(resp.Body).Decode(&result)"></testcase>

          <testcase name="Error return value of `f.Truncate` is not checked" classname="main.go:213:14" status="f.Truncate(0)"></testcase>

          <testcase name="Error return value of `f.Seek` is not checked" classname="main.go:214:10" status="f.Seek(0, 0)"></testcase>

          <testcase name="Error return value of `http.ListenAndServeTLS` is not checked" classname="main.go:445:24" status="http.ListenAndServeTLS(":8080", "https-server.crt", "https-server.key", nil)"></testcase>

          <testcase name="Error return value of `json.Unmarshal` is not checked" classname="main.go:465:20" status="json.Unmarshal(b, &d)"></testcase>

          <testcase name="Error return value of `s.startgrpcserver` is not checked" classname="main.go:533:22" status="go s.startgrpcserver()"></testcase>

        </testsuite>

        <testsuite name="gosimple">

          <testcase name="S1002: should omit comparison to bool constant, can be simplified to `loop`" classname="demo_test/test.go:153:6" status="for loop == true {"></testcase>

          <testcase name="S1011: should replace loop with `devicelist.Ip = append(devicelist.Ip, s[1:]...)`" classname="demo_test/test.go:201:4" status="for _, ip := range s[1:] {"></testcase>

          <testcase name="S1005: should omit value from range; this loop is equivalent to `for event := range ...`" classname="main.go:83:13" status="for event, _ := range s.devicemap[ip_address].Subscriptions {"></testcase>

          <testcase name="S1005: should omit value from range; this loop is equivalent to `for event := range ...`" classname="main.go:102:13" status="for event, _ := range s.devicemap[info.IpAddress].Subscriptions {"></testcase>

          <testcase name="S1005: should omit value from range; this loop is equivalent to `for event := range ...`" classname="main.go:273:14" status="for event, _ := range s.devicemap[ip].Subscriptions {"></testcase>

          <testcase name="S1031: unnecessary nil check around range" classname="main.go:346:3" status="if eventtypes != nil {"></testcase>

          <testcase name="S1002: should omit comparison to bool constant, can be simplified to `!s.add_subscription(ip_address, event)`" classname="main.go:349:8" status="if s.add_subscription(ip_address, event) == false {"></testcase>

          <testcase name="S1005: should omit value from range; this loop is equivalent to `for ip := range ...`" classname="main.go:513:10" status="for ip, _ := range s.devicemap {"></testcase>

          <testcase name="S1000: should use a simple channel send/receive instead of `select` with a single case" classname="main.go:542:2" status="select {"></testcase>

        </testsuite>

        <testsuite name="staticcheck">

          <testcase name="SA1017: the channel used with signal.Notify should be buffered" classname="main.go:540:15" status="signal.Notify(quit, os.Interrupt)"></testcase>

        </testsuite>

      </testsuites>Makefile:125: recipe for target 'sca' failed

      make: *** [sca] Error 1

      root@ip-10-5-1-11:~/cord/device-management#

       

      root@ip-10-5-1-11:~/cord/device-management# make sca

      rm -rf ./sca-report

      /root/bin/golangci-lint run --out-format junit-xml ./... 2>&1 | tee ./sca-report/sca-report.xml

      <testsuites></testsuites>root@ip-10-5-1-11:~/cord/device-management#

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            belwalkar Dinesh Belwalkar
            Reporter:
            scottb Scott Baker
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes