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

Copyright dotnet #13522

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open

Copyright dotnet #13522

wants to merge 2 commits into from

Conversation

titusfortner
Copy link
Member

Status

I did not see any files that had other copyright info at the top or anything that should be excluded from these changes.

Description

  • Update copyright script to work for cs files:
    • Add file name and copyright tags at top and bottom (requires turning properties into methods to pass file name)
    • Change encoding to prevent "Zero Width No-Break Space" characters
    • Makes sure there is a '\n' after the copyright if one does not exist
    • Removes trailing white space on lines while we're at it
  • Fixes .cs files
    • None of the test files and a few of the recently added files did not include copyright at all
    • Several files were missing the closing copyright tag
    • Several files were misnamed (copy/paste errors)

Motivation and Context

Bring .NET in line with all the other languages

@nvborisenko
Copy link
Member

I would prefer using .editorconfig file. Then everybody (not only you equipped with py script), can write some code satisfying project rules.

Moreover, then we can include dotnet format command as a part of CI Format script.

@titusfortner
Copy link
Member Author

There is a bazel command for it, too! 😜

It's been added into the format script, so it will fail RBE test like everything else that isn't properly formatted, and the fix, like other things in the project will be to run ./scripts/format.sh and commit the changes.

I'm not opposed to having editorconfig, but someone has to write it. 😄

@nvborisenko nvborisenko self-requested a review March 13, 2024 22:38
Copy link
Member

@nvborisenko nvborisenko left a comment

Choose a reason for hiding this comment

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

Go ahead, please don't forget to resolve conflicts and verify newly added files with old copyright notice.

@nvborisenko
Copy link
Member

nvborisenko commented Mar 15, 2024

Ah, we already have .editorconfig file.

I have added the following there:

[*.cs]
indent_style = space
indent_size = 4
end_of_line = crlf
charset = utf-8
file_header_template = <copyright file="{fileName}" company="Selenium Committers">\nLicensed to the Software Freedom Conservancy (SFC) under one\nor more contributor license agreements.  See the NOTICE file\ndistributed with this work for additional information\nregarding copyright ownership.  The SFC licenses this file\nto you under the Apache License, Version 2.0 (the\n"License"); you may not use this file except in compliance\nwith the License.  You may obtain a copy of the License at\n\n  http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing,\nsoftware distributed under the License is distributed on an\n"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, either express or implied.  See the License for the\nspecific language governing permissions and limitations\nunder the License.\n</copyright>

Works good, but ; symbol breaks everything. I tried escaping it in many ways - no results.

image

Copy link

@A1exKH A1exKH left a comment

Choose a reason for hiding this comment

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

LGTM.

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.

None yet

3 participants