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

feat: add Rust parser #31

Merged
merged 2 commits into from
Mar 1, 2024
Merged

feat: add Rust parser #31

merged 2 commits into from
Mar 1, 2024

Conversation

yijunyu
Copy link
Contributor

@yijunyu yijunyu commented Feb 19, 2024

Adapted DFG_csharp to DFG_rust in order to parse Rust code using the tree-sitter-rust parser.

Copy link
Owner

@k4black k4black left a comment

Choose a reason for hiding this comment

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

Hi! Thank you so much for your great efforts!
Could you please fix couple of issues I mention in the review comment?

Additionally, could you please tests for rust in tests/test_codebleu.py file test_simple_cases_work_for_all_langs test case to be sure it is working on all devices.

reference = "fn sum ( first , second )->i8 {\n second + first}"
result = calc_codebleu([reference], [prediction], lang="rust", weights=(0.25, 0.25, 0.25, 0.25), tokenizer=None)
print(result)

Copy link
Owner

Choose a reason for hiding this comment

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

Could you please delete this file?

@@ -7,7 +7,7 @@
from . import bleu, dataflow_match, syntax_match, weighted_ngram_match

PACKAGE_DIR = Path(__file__).parent
AVAILABLE_LANGS = ["java", "javascript", "c_sharp", "php", "c", "cpp", "python", "go", "ruby"] # keywords available
AVAILABLE_LANGS = ["java", "javascript", "c_sharp", "php", "c", "cpp", "python", "go", "ruby", "rust"] # keywords available
Copy link
Owner

@k4black k4black Feb 20, 2024

Choose a reason for hiding this comment

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

Please also add "rust" to

  1. README.md
  2. evaluate_app/README.md
  3. evaluate_app/codebleu.py - description

@@ -1213,3 +1213,176 @@ def DFG_javascript(root_node, index_to_code, states):
DFG += temp

return sorted(DFG, key=lambda x: x[1]), states


def DFG_rust(root_node, index_to_code, states):
Copy link
Owner

Choose a reason for hiding this comment

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

Please check pipeline failed, you need to apply black formatter (python -m black .)
Also pipeline if checking isort/ruff/mypy

Copy link

codecov bot commented Feb 20, 2024

Codecov Report

Attention: Patch coverage is 19.49686% with 128 lines in your changes are missing coverage. Please review.

Project coverage is 41.27%. Comparing base (8fe0915) to head (3b8d2c9).

Files Patch % Lines
codebleu/parser/DFG.py 18.98% 128 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #31      +/-   ##
==========================================
- Coverage   43.56%   41.27%   -2.29%     
==========================================
  Files          11       11              
  Lines        1538     1696     +158     
==========================================
+ Hits          670      700      +30     
- Misses        868      996     +128     

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

@k4black k4black changed the title adding Rust parser feat: adding Rust parser Feb 21, 2024
@k4black k4black changed the title feat: adding Rust parser feat: add Rust parser Feb 21, 2024
@yijunyu
Copy link
Contributor Author

yijunyu commented Feb 27, 2024

Could you take a look at the format fixes? Thanks -- Yijun

@k4black
Copy link
Owner

k4black commented Feb 27, 2024

@yijunyu Thanks for fixes!
Regarding formatting im happy if it passes the lining pipeline (it does) thanks!

Could you please fix other issues i mentioned? Add README info about rust, remove extra file, add test case?
Or i can make it myself, please let me know!

@yijunyu
Copy link
Contributor Author

yijunyu commented Feb 27, 2024

Please do so.

I am a bit tied up recently.

The Readme won't be significantly different to those for existing languages. If you need help I can start with a similar document.

I have a test case which I may add to the report for this, which fine shall I put it ? Or maybe I just paste it here.

@k4black k4black merged commit a30cb9f into k4black:main Mar 1, 2024
21 of 26 checks passed
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.

2 participants