Repository: jedib0t/go-pretty
Pull request #288 (2024-01-04 16:07:08)

table: SupressTrailingSpaces -> SuppressTrailingSpaces

sonarcloud[bot]: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=jedib0t_go-pretty&pullRequest=288) **Quality Gate passed**  
The SonarCloud Quality Gate passed, but some issues were introduced.

[1 New issue](https://sonarcloud.io/project/issues?id=jedib0t_go-pretty&pullRequest=288&resolved=false&inNewCodePeriod=true)  
[0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=jedib0t_go-pretty&pullRequest=288&resolved=false&inNewCodePeriod=true)  
No data about Coverage  
[0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=jedib0t_go-pretty&pullRequest=288&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=jedib0t_go-pretty&pullRequest=288)


coveralls: ## Pull Request Test Coverage Report for [Build 7411912404](https://coveralls.io/builds/64880805)


* **0** of **0**   changed or added relevant lines in **0** files are covered.
* No unchanged relevant lines lost coverage.
* Overall coverage remained the same at **100.0%**

---



|  Totals | [![Coverage Status](https://coveralls.io/builds/64880805/badge)](https://coveralls.io/builds/64880805) |
| :-- | --: |
| Change from base [Build 7411760563](https://coveralls.io/builds/64880452): |  0.0% |
| Covered Lines: | 3368 |
| Relevant Lines: | 3368 |

---
##### 💛  - [Coveralls](https://coveralls.io)


Patch:
diff --git a/table/table.go b/table/table.go
index 42e7129..4b3f21d 100644
--- a/table/table.go
+++ b/table/table.go
@@ -300,9 +300,8 @@ func (t *Table) SuppressEmptyColumns() {
 	t.suppressEmptyColumns = true
 }
 
-// SupressTrailingSpaces removes all trailing spaces from the end of the last column
-// this is useful when OptionsNoBordersAndSeparators is used
-func (t *Table) SupressTrailingSpaces() {
+// SuppressTrailingSpaces removes all trailing spaces from the output.
+func (t *Table) SuppressTrailingSpaces() {
 	t.supressTrailingSpaces = true
 }
 
diff --git a/table/writer.go b/table/writer.go
index 7b57b3e..f993d86 100644
--- a/table/writer.go
+++ b/table/writer.go
@@ -33,7 +33,7 @@ type Writer interface {
 	SortBy(sortBy []SortBy)
 	Style() *Style
 	SuppressEmptyColumns()
-	SupressTrailingSpaces()
+	SuppressTrailingSpaces()
 
 	// deprecated; in favor of Style().HTML.CSSClass
 	SetHTMLCSSClass(cssClass string)


Test patch:
diff --git a/table/render_test.go b/table/render_test.go
index b2400e4..e12f297 100644
--- a/table/render_test.go
+++ b/table/render_test.go
@@ -1176,7 +1176,7 @@ func TestTable_Render_WidthEnforcer(t *testing.T) {
 +------+----------------------+------------------+----------------------------+`)
 }
 
-func TestTable_Render_SupressTrailingSpaces(t *testing.T) {
+func TestTable_Render_SuppressTrailingSpaces(t *testing.T) {
 	tw := NewWriter()
 	tw.AppendHeader(testHeader2)
 	tw.AppendRows([]Row{
@@ -1186,37 +1186,10 @@ func TestTable_Render_SupressTrailingSpaces(t *testing.T) {
 		{"R123", "Some big name here and it's pretty big", "2021-04-19 13:37", "Abcdefghijklmnopqrstuvwxyz"},
 		{"R123", "Small name", "2021-04-19 13:37", "Abcdefghijklmnopqrstuvwxyz"},
 	})
+	tw.SuppressTrailingSpaces()
 
-	t.Run("borders and separators", func(t *testing.T) {
-		tw.Style().Options = OptionsDefault
-		compareOutput(t, tw.Render(), `
-+------+----------------------------------------+------------------+----------------------------+
-| ID   | TEXT1                                  | DATE             | TEXT2                      |
-+------+----------------------------------------+------------------+----------------------------+
-| U2   | Hey                                    | 2021-04-19 13:37 | Yuh yuh yuh                |
-| S12  | Uhhhh                                  | 2021-04-19 13:37 | Some dummy data here       |
-| R123 | Lobsters                               | 2021-04-19 13:37 | I like lobsters            |
-| R123 | Some big name here and it's pretty big | 2021-04-19 13:37 | Abcdefghijklmnopqrstuvwxyz |
-| R123 | Small name                             | 2021-04-19 13:37 | Abcdefghijklmnopqrstuvwxyz |
-+------+----------------------------------------+------------------+----------------------------+`)
-	})
-
-	t.Run("no borders and separators", func(t *testing.T) {
-		tw.Style().Options = OptionsNoBordersAndSeparators
-		compareOutput(t, tw.Render(), `
- ID    TEXT1                                   DATE              TEXT2                      
- U2    Hey                                     2021-04-19 13:37  Yuh yuh yuh                
- S12   Uhhhh                                   2021-04-19 13:37  Some dummy data here       
- R123  Lobsters                                2021-04-19 13:37  I like lobsters            
- R123  Some big name here and it's pretty big  2021-04-19 13:37  Abcdefghijklmnopqrstuvwxyz 
- R123  Small name                              2021-04-19 13:37  Abcdefghijklmnopqrstuvwxyz `)
-	})
-
-	tw.SupressTrailingSpaces()
-
-	t.Run("borders and separators suppressed spaces", func(t *testing.T) {
-		tw.Style().Options = OptionsDefault
-		compareOutput(t, tw.Render(), `
+	tw.Style().Options = OptionsDefault
+	compareOutput(t, tw.Render(), `
 +------+----------------------------------------+------------------+----------------------------+
 | ID   | TEXT1                                  | DATE             | TEXT2                      |
 +------+----------------------------------------+------------------+----------------------------+
@@ -1226,16 +1199,13 @@ func TestTable_Render_SupressTrailingSpaces(t *testing.T) {
 | R123 | Some big name here and it's pretty big | 2021-04-19 13:37 | Abcdefghijklmnopqrstuvwxyz |
 | R123 | Small name                             | 2021-04-19 13:37 | Abcdefghijklmnopqrstuvwxyz |
 +------+----------------------------------------+------------------+----------------------------+`)
-	})
 
-	t.Run("no borders and separators suppressed spaces", func(t *testing.T) {
-		tw.Style().Options = OptionsNoBordersAndSeparators
-		compareOutput(t, tw.Render(), `
+	tw.Style().Options = OptionsNoBordersAndSeparators
+	compareOutput(t, tw.Render(), `
 ID    TEXT1                                   DATE              TEXT2
 U2    Hey                                     2021-04-19 13:37  Yuh yuh yuh
 S12   Uhhhh                                   2021-04-19 13:37  Some dummy data here
 R123  Lobsters                                2021-04-19 13:37  I like lobsters
 R123  Some big name here and it's pretty big  2021-04-19 13:37  Abcdefghijklmnopqrstuvwxyz
 R123  Small name                              2021-04-19 13:37  Abcdefghijklmnopqrstuvwxyz`)
-	})
 }