Let’s read the analysis result

How to see the analysis results

The result of Sider’s original method of “pattern analysis” has a file name with “-ss-” in the identification number. Let’s open that file in your browser.

The left and right codes are a duplicate code pair. As you can see the file path name at the top of each code, these duplicate code exists in different files.

The three words highlighted in green in the right hand side code are WindowStoreBuilder. However, you look at the same locations in the left hand side code, and find that two of them are TimeOrderedWindowStoreBuilders, but the word highlighted in red is a different, WindowStoreBuilder.

As we confirmed it to the maintainer of this project in this ticket, this red part should also be a TimeOrderedWindowStoreBuilder.

Run analysis for your repository

Now it’s time to analyze your repository with Sider Scan. You can run the analysis on any repository by placing the configuration file .siderscan.json and creating a reports folder to store the report files.

It is easy to copy the configuration file in the hello_sider folder. Execute as follows

$ cp hello_sider/.siderscan.json your_repository/
$ mkdir your_repository/reports
$ cd your_repository
$ docker run -v "$(pwd)":/builds -w /builds --rm sider/sider_scan_runner:latest sider run /builds

Run the analysis again

If you run Sider Scan again, the following error message will appear in the console:

$ docker run -v "$(pwd)":/builds -w /builds --rm sider/sider_scan_runner:latest sider run /builds
[2022-05-18T08:17:35.054] [WARN] default - Contact email address is not specified. Please set `enableSiderScanTracing.userEmail` on your configration file (e.g.: .siderscan.json).

To continue using the Free version, you must enter your e-mail address in the configuration file (.siderscan.json) as follows. Once you enter your email address, you can enjoy the Sider Scan for free forever.

{
  "enableSiderScanTracing": {
    "userEmail": "yourname@example.com"
  },
  "report": {
    "method": "file",
    "file": {
      "outputDirectory": "reports"
    }
  }
}

Ok. Let’s type the docker command again.

$ docker run -v "$(pwd)":/builds -w /builds --rm sider/sider_scan_runner:latest sider run /builds

How is the result? Do you come up with any useful suggestions? If no problematic code was reported, congratulations! Your project is healthy. However, even if no issues were reported this time, please keep using Sider Scan regularly for a while. As your code base grows daily, the number of problems caused by duplicate code will also increase.