Conversation
lbajolet
reviewed
Sep 18, 2018
Owner
MathieuNls
reviewed
Sep 19, 2018
challenge.py
Outdated
| regex_Del = "^-(?!--).*" | ||
| regex_Add = "^\+(?!\+\+).*" | ||
| regex_region = "^@@ -\d+(?:,\d+)? \+\d+(?:,\d+)?\ @@[ ]?.*" | ||
| regex_functionCall = "([\w]+)(?=\()" |
Owner
There was a problem hiding this comment.
This won't catch functions calls. Something like (?![a-z])[^\:,>,\.]([a-z,A-Z]+[_]*[a-z,A-Z]*)+[(] would.
Author
There was a problem hiding this comment.
Hi Mathieu,
I did a comment of my approach,
I tried to use your Regex, but it took so much time in the script without giving result,
Actually, I used my regex using some example here on the following link: https://regex101.com/r/n7B3ox/5
it is catching statement too, but I filter them in the code.
Kind regards,
Amine
lbajolet
reviewed
Sep 19, 2018
…will be wiped in the writing process
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
I presented here a solution in Python. Where I use Regular expressions to catch (FileName, number of deleted lines, number of added lines, number of regions and the called functions and their occurrence).
The function result takes one diff file path, then it starts reading it line by line, and testing on each line if we found a match with the regular expressions that we are collecting. Even more for optimisation, we are ignoring lines where we are sure that we will not have a match with any of our regular expressions. In the end, this function returns a list of founded files, the number of deleted, added and region lines and a list of functions that were called in the diff file.
In the main function, we are considering files in the repository diffs, and read them one by one and executing result function to collect needed information. Then, combine all results together. For the list of called functions, we used a dictionary to map the occurrence of each function with the function name.
Finally, we report all results in files.
After putting results of python script in files, we used Golang main function to read these files and putting results in the result struct.
Sincerely,
Amine Barrak
Research master in Software Engineering
amine.barrak@polymtl.ca