Skip to content

Scancode incorrectly classifies a file with MIT license as under a properitary license too #3532

Description

@omajid

Description

I have a file that begins like this:

$ head CreateTokenTests.cs 
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System.Security.Claims;
using BenchmarkDotNet.Attributes;
using Microsoft.IdentityModel.JsonWebTokens;
using Microsoft.IdentityModel.TestUtils;
using Microsoft.IdentityModel.Tokens;

Scanning this via scancode flags this file as being under mit (which is correct) also against proprietary-license (which is wrong) matching proprietary-license_709.RULE.

How To Reproduce

$ wget https://raw.githubusercontent.com/dotnet/dotnet/main/src/source-build-externals/src/azure-activedirectory-identitymodel-extensions-for-dotnet/benchmark/Microsoft.IdentityModel.Benchmarks/CreateTokenTests.cs
$ ./scancode --json-pp - --license --unknown-licenses --license-references  CreateTokenTests.cs
Setup plugins...                 
Collect file inventory...                                                      
Scan files for: licenses with 1 process(es)...                                                                                                                
[####################] 2                                                                                                                                      
{                                                                                                                                                             
  "headers": [                                                                                                                                                
    {                                                                                                                                                         
      "tool_name": "scancode-toolkit",                                                                                                                        
      "tool_version": "32.0.7",
      "options": {                                                                                                                                            
        "input": [                                                                                                                                            
          "CreateTokenTests.cs"                                                                                                                               
        ],                                                                                                                                                    
        "--json-pp": "-",                                                                                                                                     
        "--license": true,                                                                                                                                    
        "--license-references": true,                                                                                                                         
        "--unknown-licenses": true                                                                                                                            
      },          
...
...
  "files": [                                                                                                                                                  
    {                                                                                                                                                         
      "path": "CreateTokenTests.cs",                                                                                                                          
      "type": "file",                                                                                                                                         
      "detected_license_expression": "mit AND proprietary-license",                                                                                           
      "detected_license_expression_spdx": "MIT AND LicenseRef-scancode-proprietary-license",                                                                  
      "license_detections": [                                                                                                                                 
        {                                                                                                                                                     
          "license_expression": "mit AND proprietary-license",                                                                                                
          "matches": [                                                                                                                                        
            {                                                                                                                                                 
              "score": 100.0,                                                  
              "start_line": 2,                                                                                                                                
              "end_line": 2,                                                                                                                                  
              "matched_length": 5,                                                                                                                            
              "match_coverage": 100.0,                                         
              "matcher": "2-aho",                                                                                                                             
              "license_expression": "mit",                                                                                                                    
              "rule_identifier": "mit_12.RULE",                                                                                                               
              "rule_relevance": 100,                                                                                                                          
              "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_12.RULE"
            },                                                                 
            {                                                                                                                                                 
              "score": 4.04,                                                                                                                                  
              "start_line": 2,                                                                                                                                
              "end_line": 4,                                                   
              "matched_length": 4,                                                                                                                            
              "match_coverage": 4.04,
              "matcher": "3-seq",                                              
              "license_expression": "proprietary-license",                                                                                                    
              "rule_identifier": "proprietary-license_709.RULE",                                                                                              
              "rule_relevance": 100,                                                                                                                          
              "rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/proprietary-license_709.RULE"                    
            }                                                                                                                                                 
          ],                                                                                                                                                  
          "identifier": "mit_and_proprietary_license-3ada3869-ed0a-2a77-e11b-1422d5133430"
        }                                                                                                                                                     
      ],

System configuration

For bug reports, it really helps us to know:

  • What OS are you running on? Linux
  • What version of scancode-toolkit was used to generate the scan file? 32.0.7
  • What installation method was used to install/run scancode? pip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions