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

.editorconfig and .gitattributes to centralize formatting #3766

Closed

Conversation

prabhask5
Copy link
Contributor

@prabhask5 prabhask5 commented Nov 24, 2023

Description

Added .editorconfig and .gitattributes to centralize formatting and git committing

  • Category (Enhancement, New feature, Bug fix, Test fix, Refactoring, Maintenance, Documentation)
    Enhancement

  • Why these changes are required?
    These files are in the main opensearch repository, and it's useful to have these files to have an additional formatting/git commit source of truth

  • What is the old behavior before changes and new behavior after changes?
    N/A

Issues Resolved

Is this a backport? If so, please add backport PR # and/or commits #
No

Testing

N/A

Check List

  • New functionality includes testing
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Prabhas Kurapati <[email protected]>
@prabhask5
Copy link
Contributor Author

@peternied @scrawfor99 @cwperks I wasn't too sure what these files should contain so to start I copied over the editorconfig from the OpenSearch repository and used a java template online for the gitattributes file. I assume these files are comprehensive since the formats of the OpenSearch repository and the opensearch-security repository are the same/similar. Let me know if there's anything I need to include, ty!

Copy link

codecov bot commented Nov 24, 2023

Codecov Report

Merging #3766 (017bfff) into main (5114bb7) will decrease coverage by 0.01%.
Report is 4 commits behind head on main.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3766      +/-   ##
==========================================
- Coverage   65.24%   65.24%   -0.01%     
==========================================
  Files         297      297              
  Lines       21129    21132       +3     
  Branches     3451     3452       +1     
==========================================
+ Hits        13786    13787       +1     
- Misses       5643     5646       +3     
+ Partials     1700     1699       -1     
Files Coverage Δ
...earch/security/resolver/IndexResolverReplacer.java 69.35% <100.00%> (+0.24%) ⬆️

... and 3 files with indirect coverage changes

Copy link
Member

@DarshitChanpura DarshitChanpura left a comment

Choose a reason for hiding this comment

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

ty @prabhask5 . QQ, how will this be different than checkstyle formatting that is already in place? Can we also ensure that checkstyle formatting and the format provided here are in sync to avoid checkstyle failures.


# Common build-tool wrapper scripts ('.cmd' versions are handled by 'Common.gitattributes')
mvnw text eol=lf
gradlew text eol=lf
Copy link
Member

Choose a reason for hiding this comment

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

nit: new line

*.tagx text
*.xml text

# These files are binary and should be left untouched
Copy link
Contributor

Choose a reason for hiding this comment

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

do you expect any such binary files to ever be checked into the repository? if not i'd leave them away

*.war binary
*.jks binary

# Common build-tool wrapper scripts ('.cmd' versions are handled by 'Common.gitattributes')
Copy link
Contributor

Choose a reason for hiding this comment

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

what is Common.gitattributes?

@@ -0,0 +1,38 @@
# Java sources
Copy link
Contributor

Choose a reason for hiding this comment

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

are these settings actually needed? i'd have expected them to be the default (text and the correct diff setting for these common languages). i certainly never had the need to specify them


# Common build-tool wrapper scripts ('.cmd' versions are handled by 'Common.gitattributes')
mvnw text eol=lf
gradlew text eol=lf
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't you also have an entry to flag *.bat or at least gradlew.bat as text eol=crlf?

@peternied peternied changed the title [Enhancement-1547] add .editorconfig .editorconfig and .gitattributes to centralize formatting Dec 7, 2023
@stephen-crawford
Copy link
Contributor

Closing this for inaction. Please open a new PR if you choose to pursue this change further.

@prabhask5 prabhask5 deleted the pk-add-editorconfig branch July 10, 2024 17:14
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.

4 participants