codersrank-org / repo_info_extractor

Use this script to extract data from your private repo. This data is used to calculate your score. https://codersrank.io
MIT License
143 stars 70 forks source link

`.cls` File Extension mapped to APEX language? #222

Open jimbrig opened 1 year ago

jimbrig commented 1 year ago

In the languagedetection module's analyzer.go script line 116, the file extension .cls is currently mapped to the APEX Language by SalesForce which I do not believe is the optimal choice.

Speaking for myself, I have used the .cls file extension for Visual Basic Class Definitions with VBA applications.

However, I did look into the languages.yml file extensions configuration for linguist and it does apply "apex" for .cls also...


References:

peti2001 commented 1 year ago

Thanks for the detailed explanation. In some cases, an extension belongs to multiple languages. That is why we introduced content-based language detection. Currently, it is used for .m, .pl, and .sql. If you can send me an example content for a .cls file for Visual Basic I can implement the content-based detection for .cls files.

peti2001 commented 1 year ago

I tried the language detection package we use github.com/src-d/enry/v2 but it couldn't recognize the code I added as an example: MyClass.cls:

Public Class Person
    Private m_Name As String
    Private m_Age As Integer

    Public Property Name() As String
        Get
            Return m_Name
        End Get
        Set(ByVal value As String)
            m_Name = value
        End Set
    End Property

    Public Property Age() As Integer
        Get
            Return m_Age
        End Get
        Set(ByVal value As Integer)
            m_Age = value
        End Set
    End Property

    Public Sub SayHello()
        MsgBox("Hello, my name is " & m_Name & " and I am " & m_Age & " years old.")
    End Sub
End Class

Is this code incorrect or maybe the package is outdated?