Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect programming language reported for a config.h.in file #605

Open
pombredanne opened this issue Apr 21, 2017 · 5 comments
Open

Incorrect programming language reported for a config.h.in file #605

pombredanne opened this issue Apr 21, 2017 · 5 comments

Comments

@pombredanne
Copy link
Member

FileName: ./config.h.in
IsSource: True
IsScript: False
ProgLanguage: JavaScript+Lasso

From https://raw.githubusercontent.com/vysheng/tg/master/config.h.in
if I upgrade pygments to 2.2.0 the programming language is "Rexx"
We need to supplement this with a file name and extension registry: after all config.h.in is kinda well known autotools pattern

This is also closely related to #426

Reported by tglx

@pombredanne
Copy link
Member Author

pombredanne commented Nov 5, 2018

This is now reported as "ASCII text" which is quite acceptable given that this is a generated file.

@D-lang14
Copy link

Hey!! @pombredanne I want to help you with this issue. May I know what I should do about that? Give me a chance that I could understand the system and the issue.

@pombredanne
Copy link
Member Author

@D-lang14 sorry for the late reply.
The key issue is that we are putting too much emphasis on using Pygments and libmagic to detect programming langauges.
A config.h should ALWAYS be reported as C/C++
So this would consists in:

  1. study the way we detect and report types in typecode
  2. in particular check out our we use a registry of extensions
  3. evolve the way we report programming languages to work first (and only?) from the registry for some cases

@Mitrajit
Copy link

Hello @pombredanne
I have studied the typecode library thoroughly and made some changes in pygments_lexers_mapping.py in site-packages and I am getting the desired results but it seems Lib\site-packages are git ignored. So where would I make the changes such that after configuring, the package changes would be reflected?
I aspire to join AboutCode in GSoC-21.

@Mitrajit
Copy link

@pombredanne A slight change in typecode can give the correct results by changing
'CLexer': ('typecode._vendor.pygments.lexers.c_cpp', 'C', ('c',), ('*.c', '*.h', '*.idc'), ('text/x-chdr', 'text/x-csrc')), to
'CLexer': ('typecode._vendor.pygments.lexers.c_cpp', 'C', ('c',), ('*.c', '*.h', '*.idc','config.h.in'), ('text/x-chdr', 'text/x-csrc')),

@pombredanne pombredanne removed this from the v3.3 milestone Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants