arrow-up icon
Image

Omission of modification

Siderscan analyzes the duplicate code that exists in the project. In addition, when modifications were made to the code, it confirms if same or similar modifications have been applied to other duplicate code blocks in the project. We will notify you if any modifications have been omitted.

deco-blob-1 decoration
graphical divider
copy from
if (horz_.IsArgInput()) {  auto &horz_view = horz_.get();
  assert(horz_view.is_contiguous());
  assert(horz_view.shape.num_elements() == nsamples);
  horz_gpu_.Resize({nsamples});
copy to
if (vert_.IsArgInput()) {  auto &vert_view = horz_.get();
  assert(vert_view.is_contiguous());
  assert(vert_view.shape.num_elements() == nsamples);
  vert_gpu_.Resize({nsamples});

What is the omission of modification?

Source code that contains a lot of duplication is considered vulnerable to modification and extension. For example, when a duplicate code block is modified, it is necessary to search not only the target code but also all similar duplicate codes to ensure the same modification is required for all of them. As the size of the software increases, the difficulty of this task increases exponentially, and inevitably, there will be errors in modification.

When the source code is modified, Siderscan checks that all other duplicate codes are also modified. If no modifications are found in a duplicate code pair, it will be detected as an "omission of modification".

Examples of "omission of modification"

The following are examples of actual “omission of modification” errors detected in well-known open-source software projects. In the code on the left, request is modified to context, but similar code on the right, which is part of the same duplicate code group, is not modified in the same way. The modification must have been omitted for some reason.

When Siderscan detects such omission of modification errors, it will email a report to the designated user.


    KeyedFilter until;

    int numberOfKeys = -1;
    List<KeyedFilter> queries = new ArrayList<>(ctx.joinTerm().size());

    for (JoinTermContext joinTermCtx : ctx.joinTerm()) {
 -    KeyedFilter joinTerm = visitJoinTerm(joinTermCtx, parentJoinKeys);
 +    KeyedFilter joinTerm = visitJoinTerm(joinTermCtx, parentJoinKeys , fieldTimestamp(), fieldTiebreaker());
        int keySize = joinTerm.keys().size();
        if (numberOfKeys < 0) {
            numberOfKeys = keySize;
        } else {
            if (numberOfKeys != keySize) {
                Source src = source(joinTermCtx.by != null ? joinTermCtx.by : joinTermCtx);
                int expected = numberOfKeys - parentJoinKeys.size();
                int found = keySize - parentJoinKeys.size();
                throw new ParsingException(
                    src,
                    "Inconsistent number of join keys specified; expected [{}] but found [{}]",
                    expected,
                    found

    KeyedFilter until;
    int numberOfKeys = -1;
    List queries = new ArrayList<>(ctx.sequenceTerm().size());

    // TODO: unify this with the code from Join if the grammar gets aligned
    for (SequenceTermContext sequenceTermCtx : ctx.sequenceTerm()) {
      KeyedFilter sequenceTerm = visitSequenceTerm(sequenceTermCtx, parentJoinKeys);
        int keySize = sequenceTerm.keys().size();
        if (numberOfKeys < 0) {
            numberOfKeys = keySize;
        } else {
            if (numberOfKeys != keySize) {
                Source src = source(sequenceTermCtx.by != null ? sequenceTermCtx.by : sequenceTermCtx);
                int expected = numberOfKeys - parentJoinKeys.size();
                int found = keySize - parentJoinKeys.size();
                throw new ParsingException(
                    src,
                    "Inconsistent number of join keys specified; expected [{}] but found [{}]",
                    expected,
                    found
                  

*Source code of Elasticsearch (https://github.com/elastic/elasticsearch) analyzed by Siderscan on 2022.11.30

Code viewer for detailed analysis

Siderscan's omission of modification detection is constantly being improved, but it is still evolving and includes false positives. Even if it is a true “omission of modification”, it does not necessarily mean a bug. Some projects may adopt a different coding style for similar code.

Siderscan, therefore, provides a code viewer for a detailed review of each reported omission of modification. Siderscan's code viewer displays each pair of duplicate code side by side, highlighting the areas of omission. Use this feature to determine whether or not you should take action on a reported omission of modification.

Management of omission of modification

Not all of the omissions of modification detected by Siderscan need to be fixed immediately. After detailed analysis, various actions may be taken, depending on the importance of the issue and the status of the project, such as "ignore due to false positives", "suspicious but put on hold", or "immediately fix with the highest priority".

Siderscan provides management functions to categorize each of omission of modification and share them with your team members.

siderscan-bottle decoration

Start duplicate analysis for free

You can analyze one project for free.