Skip to content

Fix language autodetection - #1241

Open
kiritofeng wants to merge 4 commits into
masterfrom
fix-autodetect
Open

Fix language autodetection#1241
kiritofeng wants to merge 4 commits into
masterfrom
fix-autodetect

Conversation

@kiritofeng

@kiritofeng kiritofeng commented Jun 8, 2026

Copy link
Copy Markdown
Member

This PR fixes language auto-detection, supporting sorting by version using the ext_priority parameter set in the executor.

This, however, raises the possibility of generators/interactors/etc also being compiled with clang/clang++. Thus it was necessary to also fix multifile support for those languages.

Fixes #967; fixes #1233.

@kiritofeng
kiritofeng requested review from Xyene and quantum5 June 8, 2026 05:18
@kiritofeng kiritofeng linked an issue Jun 8, 2026 that may be closed by this pull request
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.91667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.12%. Comparing base (c59432f) to head (75852f9).

Files with missing lines Patch % Lines
dmoj/utils/helper_files.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1241      +/-   ##
==========================================
+ Coverage   83.00%   83.12%   +0.11%     
==========================================
  Files         151      151              
  Lines        5732     5760      +28     
==========================================
+ Hits         4758     4788      +30     
+ Misses        974      972       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


for executor in sorted(executors.values(), key=lambda executor: executor.Executor.name):
if executor.Executor.ext == ext:
for executor in sorted(executors.values(), key=lambda executor: executor.Executor.ext_priority, reverse=True):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we specify a fixed order? Like lexicographically increasing by executor name? I don't want any flaky behaviour and dict value order isn't guaranteed...

return cls.autoconfig_find_first(cls.get_find_first_mapping())

@classmethod
def get_valid_exts(cls) -> Sequence[str]:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why this is a method and not just a class variable?

Comment thread dmoj/executors/C.py
class Executor(GCCMixin, CExecutor):
command = 'gcc'
std = 'c99'
ext_priority = 1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a smarter numbering scheme? Like 111 for Clang C11, 10099 for GCC C99, 10111 for C11, 11114 for C++14, etc.? This way, we don't need to shuffle all the numbers to add a new runtime...

return (cls.ext,)

@classmethod
def supports_multifile(cls) -> bool:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, class variable.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Clang++ Signature Grading Auto-detect generator language when not explicitly specified

2 participants