Skip to Content
Softagram
  • Home
  • Services
    • ERP
    • AI Services
    • Security
  • Company
  • Contact
  • Blog
    • News
    • Guides
  • Tech
  • Sign in
  • Contact Us
Softagram
      • Home
      • Services
        • ERP
        • AI Services
        • Security
      • Company
      • Contact
      • Blog
        • News
        • Guides
      • Tech
    • Sign in
    • Contact Us

    Copy paste detector alias finding duplicate code

    Reference
  • All Blogs
  • Oppaat
  • Copy paste detector alias finding duplicate code
  • July 15, 2021 by
    Copy paste detector alias finding duplicate code
    Ville Laitila

    Detecting duplicated code before you merge the code could save you 10x time instead of fixing it later. Now Softagram detects new and existing copy-paste chunks and informs the locations in the code-review phase in our "Impact Report".

    The report could show you e.g. following (example from GitHub discussion flow):
    ​

    Report will show the file or location where the duplicated code is seen, and the beginning of the code including the amount of characters not presented.

    Note: Softagram Impact report will show the duplicate code found only for the files that are modified in that specific Pull/Merge Request (Or Code Review/Patch set).

    Technical details

    Softagram looks for copy paste fragments with minimum tokens approach that acts on tokens instead of exact source code text. This helps detecting duplicate code despite of whitespace differences.

    Hints for Softagram tool admins for on-premise customers:

    Default value for minimum tokens count in duplicate fragment is set to 50, which can be changed with a project level setting analysis.duplicates.min_tokens_in_dupe_fragment
    ​
    Duplicates may exist in the same file or in multiple files. Because the duplicate seeking takes time 5-30 MLOC/h, and the speed decreases when code gets bigger, it is wise to consider disabling the feature for the huge projects with > 5 MLOC, and make several smaller projects for the independent repositories to ensure fast analysis.

    This project level key value pair can be used for disabling it: feature.customization.disabled=duplicates

    Limitations

    TypeScript code (*.tsx, *.ts) is not yet supported by copy paste detector.

    Originally published at help.softagram.com

    in Oppaat
    # Softagram Analyzer

    Designed for companies

    We are a team of passionate people whose goal is to improve everyone's life through disruptive products. We build great products to solve your business problems. Our products are designed for small to medium size companies willing to optimize their performance.

    Ota yhteyttä

    Softagram Oy
    Ketolanperäntie 469 
    90450 ​Kempele 

    • +358504836173
    • info@softagram.com
    Follow us
    Copyright © Softagram Oy
    Powered by Odoo - Create a free website