Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

vet : add check for tabs in text files #7678

Merged
merged 9 commits into from
Oct 4, 2024

Conversation

eshitachandwani
Copy link
Member

  • Added check for tabs in text files
  • Replaced tabs with spaces in the following file :
    • Documentation/benchmark.md

RELEASE NOTES: None

@eshitachandwani eshitachandwani added Type: Testing Area: Tooling Includes anything related to Go builds, modules etc and includes Releases & Github Workflows. labels Sep 28, 2024
@eshitachandwani eshitachandwani added this to the 1.68 Release milestone Sep 28, 2024
Copy link

codecov bot commented Sep 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.86%. Comparing base (941102b) to head (3d1fb1a).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7678      +/-   ##
==========================================
- Coverage   82.01%   81.86%   -0.16%     
==========================================
  Files         361      361              
  Lines       27829    27822       -7     
==========================================
- Hits        22825    22777      -48     
- Misses       3821     3850      +29     
- Partials     1183     1195      +12     

see 33 files with indirect coverage changes

scripts/vet.sh Outdated
@@ -70,6 +70,9 @@ not git grep "\(import \|^\s*\)\"google.golang.org/grpc/interop/grpc_testing" --
# - Ensure that no trailing spaces are found.
not git grep '[[:blank:]]$'

# - Check for tabs in Markdown files
git grep $'\t' -- '*.md' | fail_on_output || echo "No tabs found in Markdown files."
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 we be echoing only for failures?

Copy link
Contributor

Choose a reason for hiding this comment

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

this might be enough not git grep $'\t' -- '*.md' because command and comment is self explanatory

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@eshitachandwani eshitachandwani added Area: Tooling Includes anything related to Go builds, modules etc and includes Releases & Github Workflows. Type: Testing and removed Area: Tooling Includes anything related to Go builds, modules etc and includes Releases & Github Workflows. Type: Testing labels Sep 30, 2024
scripts/vet.sh Outdated
@@ -70,6 +70,9 @@ not git grep "\(import \|^\s*\)\"google.golang.org/grpc/interop/grpc_testing" --
# - Ensure that no trailing spaces are found.
not git grep '[[:blank:]]$'

# - Check for tabs in Markdown files
not git grep $'\t' -- '*.md' | fail_on_output
Copy link
Member

Choose a reason for hiding this comment

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

Why pipe to fail_on_output? Inverting the result of grep should be sufficient? I.e. grep exits with 0 if there is a match and 1 if there is not.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@purnesh42H purnesh42H left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -70,6 +70,9 @@ not git grep "\(import \|^\s*\)\"google.golang.org/grpc/interop/grpc_testing" --
# - Ensure that no trailing spaces are found.
not git grep '[[:blank:]]$'

# - Ensure that no tabs are found in markdown files.
not git grep $'\t' -- '*.md'
Copy link
Contributor

Choose a reason for hiding this comment

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

Can/Should we do this for all files?

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 mean prohibit tab code files? I think the IDE might be doing that already.

Copy link
Contributor

Choose a reason for hiding this comment

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

I could be using an editor that doesn't do that. But looks like gofmt uses tabs for indentation. See: https://pkg.go.dev/cmd/gofmt. And we run gofmt in our vet script. So, we should be good.

Copy link
Member

Choose a reason for hiding this comment

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

Go pretty famously uses tabs instead of spaces. Limiting to *.md SGTM.

@purnesh42H purnesh42H merged commit 859602c into grpc:master Oct 4, 2024
14 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Area: Tooling Includes anything related to Go builds, modules etc and includes Releases & Github Workflows. Type: Testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants