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

new checker contains #152

Merged
merged 2 commits into from
Jun 26, 2024
Merged

new checker contains #152

merged 2 commits into from
Jun 26, 2024

Conversation

mmorel-35
Copy link
Contributor

Closes #54

@coveralls
Copy link

coveralls commented Jun 23, 2024

Pull Request Test Coverage Report for Build 9632081552

Details

  • 40 of 50 (80.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.2%) to 93.46%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/checkers/contains.go 37 47 78.72%
Totals Coverage Status
Change from base Build 9608177733: -0.2%
Covered Lines: 2215
Relevant Lines: 2370

💛 - Coveralls

@mmorel-35
Copy link
Contributor Author

mmorel-35 commented Jun 23, 2024

I believe #47

could be a subcase of contains but I'm not so confident with providing it in a error-compare rule

@ccoVeille
Copy link
Contributor

I beli if #47

Shall be a subcase of contains or in a error-compare rule

Because of the strange use cases I reported here, I'm unsure.

https://github.com/Antonboom/testifylint/issues/47#issuecomment-2047862514github.com/Antonboom/testifylint/issues/47#issuecomment-2047862514

But they are definitely close yes

Copy link
Contributor

@ccoVeille ccoVeille left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, a few remarks

README.md Outdated Show resolved Hide resolved
internal/checkers/contains.go Outdated Show resolved Hide resolved
internal/testgen/main.go Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Jun 23, 2024

Pull Request Test Coverage Report for Build 9635529714

Details

  • 38 of 50 (76.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.3%) to 93.376%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/checkers/contains.go 35 47 74.47%
Totals Coverage Status
Change from base Build 9608177733: -0.3%
Covered Lines: 2213
Relevant Lines: 2370

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 23, 2024

Pull Request Test Coverage Report for Build 9635616469

Details

  • 38 of 50 (76.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.3%) to 93.376%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/checkers/contains.go 35 47 74.47%
Totals Coverage Status
Change from base Build 9608177733: -0.3%
Covered Lines: 2213
Relevant Lines: 2370

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 23, 2024

Pull Request Test Coverage Report for Build 9635658244

Details

  • 42 of 50 (84.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 93.544%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/checkers/contains.go 39 47 82.98%
Totals Coverage Status
Change from base Build 9608177733: -0.1%
Covered Lines: 2217
Relevant Lines: 2370

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 23, 2024

Pull Request Test Coverage Report for Build 9635733489

Details

  • 42 of 50 (84.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 93.544%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/checkers/contains.go 39 47 82.98%
Totals Coverage Status
Change from base Build 9608177733: -0.1%
Covered Lines: 2217
Relevant Lines: 2370

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 23, 2024

Pull Request Test Coverage Report for Build 9636072731

Details

  • 42 of 50 (84.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 93.544%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/checkers/contains.go 39 47 82.98%
Totals Coverage Status
Change from base Build 9608177733: -0.1%
Covered Lines: 2217
Relevant Lines: 2370

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 23, 2024

Pull Request Test Coverage Report for Build 9636090503

Details

  • 42 of 50 (84.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 93.544%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/checkers/contains.go 39 47 82.98%
Totals Coverage Status
Change from base Build 9608177733: -0.1%
Covered Lines: 2217
Relevant Lines: 2370

💛 - Coveralls

@mmorel-35 mmorel-35 force-pushed the contains branch 2 times, most recently from ae198ed to e9699f2 Compare June 24, 2024 04:41
@coveralls
Copy link

coveralls commented Jun 24, 2024

Pull Request Test Coverage Report for Build 9639678060

Details

  • 42 of 50 (84.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 93.544%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/checkers/contains.go 39 47 82.98%
Totals Coverage Status
Change from base Build 9608177733: -0.1%
Covered Lines: 2217
Relevant Lines: 2370

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 24, 2024

Pull Request Test Coverage Report for Build 9639712727

Details

  • 42 of 50 (84.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 93.544%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/checkers/contains.go 39 47 82.98%
Totals Coverage Status
Change from base Build 9608177733: -0.1%
Covered Lines: 2217
Relevant Lines: 2370

💛 - Coveralls

@mmorel-35 mmorel-35 requested a review from ccoVeille June 24, 2024 05:05
internal/testgen/gen_contains.go Outdated Show resolved Hide resolved
internal/testgen/gen_contains.go Outdated Show resolved Hide resolved
@ccoVeille
Copy link
Contributor

LGTM 👍, a few stylistic remarks

@coveralls
Copy link

coveralls commented Jun 24, 2024

Pull Request Test Coverage Report for Build 9639996723

Details

  • 42 of 50 (84.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 93.544%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/checkers/contains.go 39 47 82.98%
Totals Coverage Status
Change from base Build 9608177733: -0.1%
Covered Lines: 2217
Relevant Lines: 2370

💛 - Coveralls

@ccoVeille
Copy link
Contributor

You did the changes but didn't regenerate and commit the test and golden files

@mmorel-35
Copy link
Contributor Author

I did from my phone, so I have no access to a terminal. The CI shall be doing the warning

@ccoVeille
Copy link
Contributor

ccoVeille commented Jun 24, 2024

I did from my phone, so I have no access to a terminal. The CI shall be doing the warning

yes, I agree it should. Something to be added, because it's a common mistake, I did it too.

I don't see something that could catch it right now
https://github.com/Antonboom/testifylint/blob/master/.github/workflows/ci.yml

what are your thoughts @Antonboom ?

Copy link
Contributor

@ccoVeille ccoVeille left a comment

Choose a reason for hiding this comment

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

leaving a comment so we don't forget

Copy link
Owner

@Antonboom Antonboom left a comment

Choose a reason for hiding this comment

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

Nice job! 🔥

internal/testgen/gen_contains.go Outdated Show resolved Hide resolved
internal/checkers/helpers_string.go Outdated Show resolved Hide resolved
internal/checkers/contains.go Outdated Show resolved Hide resolved
@mmorel-35 mmorel-35 force-pushed the contains branch 3 times, most recently from 0ccbcb1 to 30d2666 Compare June 25, 2024 05:24
@coveralls
Copy link

coveralls commented Jun 25, 2024

Pull Request Test Coverage Report for Build 9656918190

Details

  • 42 of 50 (84.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 93.544%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/checkers/contains.go 39 47 82.98%
Totals Coverage Status
Change from base Build 9608177733: -0.1%
Covered Lines: 2217
Relevant Lines: 2370

💛 - Coveralls

Co-authored-by: ccoVeille <[email protected]>
@coveralls
Copy link

coveralls commented Jun 25, 2024

Pull Request Test Coverage Report for Build 9656928741

Details

  • 42 of 50 (84.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 93.544%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/checkers/contains.go 39 47 82.98%
Totals Coverage Status
Change from base Build 9608177733: -0.1%
Covered Lines: 2217
Relevant Lines: 2370

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 25, 2024

Pull Request Test Coverage Report for Build 9656934424

Details

  • 42 of 50 (84.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 93.544%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/checkers/contains.go 39 47 82.98%
Totals Coverage Status
Change from base Build 9608177733: -0.1%
Covered Lines: 2217
Relevant Lines: 2370

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 25, 2024

Pull Request Test Coverage Report for Build 9656951923

Details

  • 42 of 50 (84.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 93.544%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/checkers/contains.go 39 47 82.98%
Totals Coverage Status
Change from base Build 9608177733: -0.1%
Covered Lines: 2217
Relevant Lines: 2370

💛 - Coveralls

@Antonboom Antonboom self-assigned this Jun 25, 2024
@coveralls
Copy link

coveralls commented Jun 25, 2024

Pull Request Test Coverage Report for Build 9666920543

Details

  • 38 of 42 (90.48%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 93.692%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/checkers/contains.go 35 39 89.74%
Totals Coverage Status
Change from base Build 9608177733: 0.03%
Covered Lines: 2213
Relevant Lines: 2362

💛 - Coveralls

Copy link
Owner

@Antonboom Antonboom left a comment

Choose a reason for hiding this comment

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

@mmorel-35 @ccoVeille

I appreciate your work and left comments in purpose of future improvements of your code 👌

please, review it the last time (can check on the large code base) and we merge it

README.md Show resolved Hide resolved
README.md Show resolved Hide resolved
}
}

func TestContainsNotContainsReplacements_Bytes(t *testing.T) {
Copy link
Owner

Choose a reason for hiding this comment

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

added debug tests to be sure that this is not supported

Screenshot 2024-06-25 at 20 27 35

Copy link
Contributor

Choose a reason for hiding this comment

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

How do you prevent these failing tests to fail the go test ./...

I don't get where is the magic?

internal/checkers/contains.go Show resolved Hide resolved
internal/testgen/gen_contains.go Show resolved Hide resolved
internal/testgen/gen_contains.go Show resolved Hide resolved
Copy link
Contributor Author

@mmorel-35 mmorel-35 left a comment

Choose a reason for hiding this comment

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

LGTM

@ccoVeille
Copy link
Contributor

ccoVeille commented Jun 25, 2024

Cannot run on my codebase for the moment, but LGTM 👍

"github.com/stretchr/testify/assert"
)

func TestContainsNotContainsReplacements_String(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I might have missed something but I would expected this here

Suggested change
func TestContainsNotContainsReplacements_String(t *testing.T) {
func TestContainsContainsReplacements_String(t *testing.T) {

Copy link
Owner

Choose a reason for hiding this comment

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

No, Contains + NotContains

consistent with TestSameNotSameReplacements

Copy link
Contributor

Choose a reason for hiding this comment

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

When you know it, you know it 😂🤣

It's obvious now.

Thanks

}
}

func TestContainsNotContainsReplacements_Bytes(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

How do you prevent these failing tests to fail the go test ./...

I don't get where is the magic?

@Antonboom
Copy link
Owner

I don't get where is the magic?

because of testdata directory

@ccoVeille
Copy link
Contributor

ccoVeille commented Jun 25, 2024

Thanks I learned something today.

I had no idea the testdata folder I had on my codebase was not a convention in our codebase but something idiomatic

@Antonboom Antonboom merged commit 8afa731 into Antonboom:master Jun 26, 2024
3 checks passed
@mmorel-35 mmorel-35 deleted the contains branch June 26, 2024 03:41
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.

contains: use Contains instead of strings.Contains
4 participants