-
Notifications
You must be signed in to change notification settings - Fork 4.8k
HIVE-29245: Normalize Java license headers, part 1 - indent #6122
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
Closed
Conversation
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
git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^(\s*\*)(?! {5}http://)\s*http://www\.apache\.org/licenses/LICENSE-2\.0$|\1 http://www.apache.org/licenses/LICENSE-2.0|'
git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* Licensed to the Apache Software Foundation \(ASF\) under one$| * Licensed to the Apache Software Foundation (ASF) under one|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* or more contributor license agreements\. See the NOTICE file$| * or more contributor license agreements. See the NOTICE file|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* distributed with this work for additional information$| * distributed with this work for additional information|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* regarding copyright ownership\. The ASF licenses this file$| * regarding copyright ownership. The ASF licenses this file|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* to you under the Apache License, Version 2\.0 \(the$| * to you under the Apache License, Version 2.0 (the|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* "License"\); you may not use this file except in compliance$| * "License"); you may not use this file except in compliance|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* with the License. You may obtain a copy of the License at$| * with the License. You may obtain a copy of the License at|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* Unless required by applicable law or agreed to in writing, software$| * Unless required by applicable law or agreed to in writing, software|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* distributed under the License is distributed on an "AS IS" BASIS,$| * distributed under the License is distributed on an "AS IS" BASIS,|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.$| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* See the License for the specific language governing permissions and$| * See the License for the specific language governing permissions and|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* limitations under the License\.$| * limitations under the License.|'
git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -0777 -pi -e 's/\A(?:\x{FEFF})?[ \t]+\/\*\s*(\r?\n)/\/\*$1/'
git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* \* Licensed to the Apache Software Foundation \(ASF\) under one$| * * Licensed to the Apache Software Foundation (ASF) under one|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* \* or more contributor license agreements\. See the NOTICE file$| * * or more contributor license agreements. See the NOTICE file|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* \* distributed with this work for additional information$| * * distributed with this work for additional information|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* \* regarding copyright ownership\. The ASF licenses this file$| * * regarding copyright ownership. The ASF licenses this file|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* \* to you under the Apache License, Version 2\.0 \(the$| * * to you under the Apache License, Version 2.0 (the|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* \* "License"\); you may not use this file except in compliance$| * * "License"); you may not use this file except in compliance|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* \* with the License. You may obtain a copy of the License at$| * * with the License. You may obtain a copy of the License at|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* \* Unless required by applicable law or agreed to in writing, software$| * * Unless required by applicable law or agreed to in writing, software|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* \* distributed under the License is distributed on an "AS IS" BASIS,$| * * distributed under the License is distributed on an "AS IS" BASIS,|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.$| * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* \* See the License for the specific language governing permissions and$| * * See the License for the specific language governing permissions and|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* \* limitations under the License\.$| * * limitations under the License.|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* \*$| * *|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* \* http://www.apache.org/licenses/LICENSE-2.0$| * * http://www.apache.org/licenses/LICENSE-2.0|'
git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* you may not use this file except in compliance with the License\.$| * you may not use this file except in compliance with the License.|' git ls-files '*.java' | grep -v 'src/gen/thrift' | grep -v '^iceberg/' \ | xargs perl -pi -e 's|^ \* You may obtain a copy of the License at$| * You may obtain a copy of the License at|'
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.
What changes were proposed in this pull request?
Normalize the license headers. This pull request aligns the depth of indents.
This PR affects numerous files, but most changes are whitespace-only. So, I recommend checking the diff with the w=1 option or
git diff master...HIVE-29245-regex-indent -w
.Originally, I attempted to update all at once in #6115, but it is likely to be difficult to review. So, I created a separate pull request focusing on whitespace changes.
Why are the changes needed?
Our CI checks the license header format of new files. Some (or most) people copy and paste the header from existing Java files. Unfortunately, existing files don't share the same format, and SonarQube often reports a license issue. A reviewer has to say "you must not copy and paste the header from existing files, you must pick it up from checkstyle/asf.header.
Does this PR introduce any user-facing change?
No
How was this patch tested?
I put the following configuration on
checkstyle/checkstyle.xml
,standalone-metastore/checkstyle/checkstyle.xml
, andstorage-api/checkstyle/checkstyle.xml. After that, I ran
mvn checkstyle:check`.