Skip to content

Conversation

@hust-nj
Copy link

@hust-nj hust-nj commented Apr 27, 2023

I think there are 2 main problems in current clean_copyright_comments function

def clean_copyright_comments(content: str):
.

First, It cannot remove the copyright successfully in the following C-style code because of the early return in

// Copyright

int main() {
    return 0;
    
    /* comment */
}

Second, I find that, when the file is large, the regex sometimes costs much time in my experiment, I think we only need to find the copyright in the first 100 lines.

@mauriceweber
Copy link
Contributor

Hi @hust-nj ! Thanks for bringing this to our attention! I will review your PR asap.

@mauriceweber mauriceweber self-requested a review May 2, 2023 15:12
@mauriceweber
Copy link
Contributor

Hi @hust-nj , I had a look at your PR. Here's some feedback:

  • I would prefer not to limit the search for copyright to the first 100 lines; based on what are you proposing 100 lines?
  • Your current implementation also gets rid of comments in the beginning of any file, which we would like to keep. For example, this:
// A comment

int main() {
    return 0;
    
    /* comment */
}

yields

int main() {
    return 0;
    
    /* comment */
}

@mauriceweber mauriceweber marked this pull request as draft May 9, 2023 06:50
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