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

Add new advance checker: blank-import #45

Merged
merged 5 commits into from
Jan 23, 2024

Conversation

hendrywiranto
Copy link
Contributor

@hendrywiranto hendrywiranto commented Dec 20, 2023

Summary

Add new advance checker: blank-import

Motivation

As stated in the issue:

Import of testify packages (assert, require, suite, mock, http) as _ is useless: those package don't do init magic.

Related issues

Closes #37
Closes #38

Testing

https://github.com/gophersbd/ormpb/blob/master/doc.go

$ testifylint .
/tmp/ormpb/doc.go:28:2: blank-import: avoid blank import of github.com/stretchr/testify as it does nothing

https://github.com/Scalingo/grafana-scalingo

$ testifylint ./pkg/extensions/...
/tmp/grafana-scalingo/pkg/extensions/main.go:26:2: blank-import: avoid blank import of github.com/stretchr/testify/require as it does nothing

@hendrywiranto
Copy link
Contributor Author

hendrywiranto commented Dec 20, 2023

Hi @Antonboom , please kindly review the PR

Also I have some questions that I think you can give inputs:

  1. checker name
  2. default enabled/not (edit: from issue comment this should be default enabled)
  3. did I use the golden template correctly?
  4. I cant seem to run the unit test locally, can you help?

output from task test

Generate analyzer tests...
2023/12/20 22:44:15 [WARN] No golden file in "analyzer/testdata/src/error-as-target"
2023/12/20 22:44:15 [WARN] No golden file in "analyzer/testdata/src/require-error-fn-pattern"
2023/12/20 22:44:15 [WARN] No golden file in "analyzer/testdata/src/checkers-default/float-compare"
2023/12/20 22:44:15 [WARN] No golden file in "analyzer/testdata/src/checkers-default/go-require"
2023/12/20 22:44:15 [WARN] No golden file in "analyzer/testdata/src/checkers-default/require-error"
Test...
?       github.com/Antonboom/testifylint        [no test files]
?       github.com/Antonboom/testifylint/internal/testify       [no test files]
signal: killed
FAIL    github.com/Antonboom/testifylint/analyzer       6.041s
ok      github.com/Antonboom/testifylint/internal/analysisutil  (cached)
ok      github.com/Antonboom/testifylint/internal/checkers      (cached)
ok      github.com/Antonboom/testifylint/internal/config        (cached)
ok      github.com/Antonboom/testifylint/internal/testgen       (cached)
FAIL
task: Failed to run task "test": exit status 1

thank you so much!

@hendrywiranto
Copy link
Contributor Author

hi @Antonboom have you got any chance to look at the PR? thankyou 🙇

@Antonboom
Copy link
Owner

@hendrywiranto, hi!
thank u for your job, yes, this is in my todo list

the end of the year is time of Christmas holidays, sorry 🙂 ☃️ 🎄

@hendrywiranto
Copy link
Contributor Author

hendrywiranto commented Jan 6, 2024

Okay Anton, sorry for nudging and enjoy your holiday ! 🎅

@coveralls
Copy link

coveralls commented Jan 9, 2024

Pull Request Test Coverage Report for Build 7629719802

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.009%) to 94.342%

Totals Coverage Status
Change from base Build 7626531867: -0.009%
Covered Lines: 1584
Relevant Lines: 1679

💛 - Coveralls

@Antonboom
Copy link
Owner

@hendrywiranto, hi!

Please review changes from me.

I cant seem to run the unit test locally, can you help?

Because no such packages in testdata/src/vendor:

$ task          
Tidy...
go: downloading golang.org/x/sync v0.5.0
Fmt...
Lint...
Generate analyzer tests...
2024/01/09 08:43:48 [WARN] No golden file in "analyzer/testdata/src/error-as-target"
2024/01/09 08:43:48 [WARN] No golden file in "analyzer/testdata/src/require-error-fn-pattern"
2024/01/09 08:43:49 [WARN] No golden file in "analyzer/testdata/src/checkers-default/float-compare"
2024/01/09 08:43:49 [WARN] No golden file in "analyzer/testdata/src/checkers-default/go-require"
2024/01/09 08:43:49 [WARN] No golden file in "analyzer/testdata/src/checkers-default/require-error"
Test...
?       github.com/Antonboom/testifylint        [no test files]
?       github.com/Antonboom/testifylint/internal/testify       [no test files]
src/checkers-default/useless-import/useless_import_test.go:9:2: cannot find package "github.com/stretchr/testify/http" in any of:
        /private/tmp/testifylint/analyzer/testdata/src/vendor/github.com/stretchr/testify/http (vendor tree)
        /usr/local/go/src/github.com/stretchr/testify/http (from $GOROOT)
        /private/tmp/testifylint/analyzer/testdata/src/github.com/stretchr/testify/http (from $GOPATH)
src/checkers-default/useless-import/useless_import_test.go:10:2: cannot find package "github.com/stretchr/testify/mock" in any of:
        /private/tmp/testifylint/analyzer/testdata/src/vendor/github.com/stretchr/testify/mock (vendor tree)
        /usr/local/go/src/github.com/stretchr/testify/mock (from $GOROOT)
        /private/tmp/testifylint/analyzer/testdata/src/github.com/stretchr/testify/mock (from $GOPATH)
/private/tmp/testifylint/analyzer/testdata/src/checkers-default/useless-import/useless_import_test.go:9:4: could not import github.com/stretchr/testify/http (invalid package name: "")
/private/tmp/testifylint/analyzer/testdata/src/checkers-default/useless-import/useless_import_test.go:10:4: could not import github.com/stretchr/testify/mock (invalid package name: "")
--- FAIL: TestTestifyLint_CheckersDefault (0.00s)
    --- FAIL: TestTestifyLint_CheckersDefault/useless-import (8.41s)
        analysistest.go:332: error analyzing testifylint@checkers-default/useless-import: analysis skipped due to errors in package
        analysistest.go:332: error analyzing testifylint@checkers-default/useless-import.test: analysis skipped due to errors in package
FAIL
FAIL    github.com/Antonboom/testifylint/analyzer       22.311s
ok      github.com/Antonboom/testifylint/internal/analysisutil  0.578s
ok      github.com/Antonboom/testifylint/internal/checkers      0.381s
ok      github.com/Antonboom/testifylint/internal/config        1.104s
ok      github.com/Antonboom/testifylint/internal/testgen       0.742s
FAIL
task: Failed to run task "default": exit status 1

@hendrywiranto hendrywiranto force-pushed the useless-import-checker branch from 7ab4272 to 7664183 Compare January 12, 2024 16:45
@hendrywiranto
Copy link
Contributor Author

The change looks good! made me wonder if it's better to rename the checker into black-import instead? wdyt?

also thanks for checking for the unit test, but I still can't run it successfully from local with the same error 😢
the frustrating part is there is no useful log on my side that shows what goes wrong

@Antonboom
Copy link
Owner

Antonboom commented Jan 14, 2024

it's better to rename the checker into black-import instead

Great idea, could I ask you to do renaming? Thanks.
But not blackblank-import

there is no useful log on my side that shows what goes wrong

Please, try

go test -v ./...

directly, without task

P.S. signal: killed – looks very strange, what is your OS?

@Antonboom
Copy link
Owner

Antonboom commented Jan 14, 2024

@hendrywiranto

But from other side we have https://github.com/Antonboom/testifylint/blob/master/CONTRIBUTING.md#inefficient-assert.

And looks more consistent to have

  • useless-import
  • useless-assert

instead of

  • blank-import
  • inefficient-assert

🤷‍♂️ 🤔 😭

@hendrywiranto
Copy link
Contributor Author

But not black – blank-import

Lol sorry this is a typo on my end, didn't realize I typed black there 😆

And looks more consistent to have
useless-import
useless-assert

I see, just realized that.. Then I think it's okay to keep the existing name 👍

@hendrywiranto
Copy link
Contributor Author

hendrywiranto commented Jan 15, 2024

@Antonboom

go test -v ./...
directly, without task

I tried that too, still kinda the same minimum details

go test -v ./...
?       github.com/Antonboom/testifylint        [no test files]
?       github.com/Antonboom/testifylint/internal/testify       [no test files]
=== RUN   Test_newCheckers
=== RUN   Test_newCheckers/no_config
=== RUN   Test_newCheckers/default_config
=== RUN   Test_newCheckers/enable_two_checkers_only
=== RUN   Test_newCheckers/disable_two_checkers_only
=== RUN   Test_newCheckers/enable_one_checker_in_addition_to_enabled_by_default_checkers
=== RUN   Test_newCheckers/disable_three_checkers_from_enabled_by_default_checkers
=== RUN   Test_newCheckers/expected-actual_pattern_defined
=== RUN   Test_newCheckers/require-equal_fn_pattern_defined
=== RUN   Test_newCheckers/suite-extra-assert-call_mode_defined
--- PASS: Test_newCheckers (0.00s)
    --- PASS: Test_newCheckers/no_config (0.00s)
    --- PASS: Test_newCheckers/default_config (0.00s)
    --- PASS: Test_newCheckers/enable_two_checkers_only (0.00s)
    --- PASS: Test_newCheckers/disable_two_checkers_only (0.00s)
    --- PASS: Test_newCheckers/enable_one_checker_in_addition_to_enabled_by_default_checkers (0.00s)
    --- PASS: Test_newCheckers/disable_three_checkers_from_enabled_by_default_checkers (0.00s)
    --- PASS: Test_newCheckers/expected-actual_pattern_defined (0.00s)
    --- PASS: Test_newCheckers/require-equal_fn_pattern_defined (0.00s)
    --- PASS: Test_newCheckers/suite-extra-assert-call_mode_defined (0.00s)
=== RUN   Test_newCheckers_invalidConfig
--- PASS: Test_newCheckers_invalidConfig (0.00s)
=== RUN   Test_newCheckers_unknownChecker
--- PASS: Test_newCheckers_unknownChecker (0.00s)
=== RUN   TestTestifyLint
=== PAUSE TestTestifyLint
=== RUN   TestTestifyLint_CheckersDefault
=== PAUSE TestTestifyLint_CheckersDefault
=== CONT  TestTestifyLint
=== RUN   TestTestifyLint/base-test
=== PAUSE TestTestifyLint/base-test
=== RUN   TestTestifyLint/checkers-priority
=== PAUSE TestTestifyLint/checkers-priority
=== CONT  TestTestifyLint_CheckersDefault
=== RUN   TestTestifyLint_CheckersDefault/float-compare
=== PAUSE TestTestifyLint_CheckersDefault/float-compare
=== RUN   TestTestifyLint_CheckersDefault/bool-compare
=== PAUSE TestTestifyLint_CheckersDefault/bool-compare
=== RUN   TestTestifyLint_CheckersDefault/empty
=== RUN   TestTestifyLint/error-as-target
=== PAUSE TestTestifyLint/error-as-target
=== RUN   TestTestifyLint/expected-var-custom-pattern
=== PAUSE TestTestifyLint/expected-var-custom-pattern
=== RUN   TestTestifyLint/ginkgo
=== PAUSE TestTestifyLint/ginkgo
=== RUN   TestTestifyLint/not-std-funcs
=== PAUSE TestTestifyLint/not-std-funcs
=== RUN   TestTestifyLint/not-test-file
=== PAUSE TestTestifyLint/not-test-file
=== PAUSE TestTestifyLint_CheckersDefault/empty
=== RUN   TestTestifyLint_CheckersDefault/len
=== RUN   TestTestifyLint/not-true-testify
=== PAUSE TestTestifyLint_CheckersDefault/len
=== RUN   TestTestifyLint_CheckersDefault/compares
=== PAUSE TestTestifyLint/not-true-testify
=== PAUSE TestTestifyLint_CheckersDefault/compares
=== RUN   TestTestifyLint/pkg-alias
=== PAUSE TestTestifyLint/pkg-alias
=== RUN   TestTestifyLint/require-error-fn-pattern
=== PAUSE TestTestifyLint/require-error-fn-pattern
=== RUN   TestTestifyLint/require-error-skip-logic
=== PAUSE TestTestifyLint/require-error-skip-logic
=== RUN   TestTestifyLint_CheckersDefault/error-nil
=== PAUSE TestTestifyLint_CheckersDefault/error-nil
=== RUN   TestTestifyLint_CheckersDefault/nil-compare
=== PAUSE TestTestifyLint_CheckersDefault/nil-compare
=== RUN   TestTestifyLint_CheckersDefault/error-is-as
=== PAUSE TestTestifyLint_CheckersDefault/error-is-as
=== RUN   TestTestifyLint_CheckersDefault/expected-actual
=== PAUSE TestTestifyLint_CheckersDefault/expected-actual
=== RUN   TestTestifyLint_CheckersDefault/suite-extra-assert-call
=== PAUSE TestTestifyLint_CheckersDefault/suite-extra-assert-call
=== RUN   TestTestifyLint_CheckersDefault/suite-dont-use-pkg
=== PAUSE TestTestifyLint_CheckersDefault/suite-dont-use-pkg
=== RUN   TestTestifyLint_CheckersDefault/go-require
=== PAUSE TestTestifyLint_CheckersDefault/go-require
=== RUN   TestTestifyLint_CheckersDefault/require-error
=== RUN   TestTestifyLint/suite-require-extra-assert-call
=== PAUSE TestTestifyLint/suite-require-extra-assert-call
=== CONT  TestTestifyLint/base-test
=== CONT  TestTestifyLint/not-true-testify
=== CONT  TestTestifyLint/ginkgo
=== CONT  TestTestifyLint/require-error-skip-logic
=== CONT  TestTestifyLint/require-error-fn-pattern
=== CONT  TestTestifyLint/error-as-target
=== CONT  TestTestifyLint/pkg-alias
=== CONT  TestTestifyLint/not-test-file
=== CONT  TestTestifyLint/checkers-priority
=== CONT  TestTestifyLint/not-std-funcs
=== CONT  TestTestifyLint/suite-require-extra-assert-call
=== CONT  TestTestifyLint/expected-var-custom-pattern
=== PAUSE TestTestifyLint_CheckersDefault/require-error
=== RUN   TestTestifyLint_CheckersDefault/suite-thelper
=== PAUSE TestTestifyLint_CheckersDefault/suite-thelper
=== CONT  TestTestifyLint_CheckersDefault/float-compare
=== CONT  TestTestifyLint_CheckersDefault/suite-thelper
=== CONT  TestTestifyLint_CheckersDefault/error-is-as
=== CONT  TestTestifyLint_CheckersDefault/suite-dont-use-pkg
signal: killed
FAIL    github.com/Antonboom/testifylint/analyzer       7.918s
=== RUN   TestImports
--- PASS: TestImports (0.00s)
=== RUN   TestNodeFormatting
=== RUN   TestNodeFormatting/NodeBytes
=== RUN   TestNodeFormatting/NodeString
--- PASS: TestNodeFormatting (0.00s)
    --- PASS: TestNodeFormatting/NodeBytes (0.00s)
    --- PASS: TestNodeFormatting/NodeString (0.00s)
=== RUN   TestNodeFormatting_Invalid
=== RUN   TestNodeFormatting_Invalid/NodeBytes
=== RUN   TestNodeFormatting_Invalid/NodeString
--- PASS: TestNodeFormatting_Invalid (0.00s)
    --- PASS: TestNodeFormatting_Invalid/NodeBytes (0.00s)
    --- PASS: TestNodeFormatting_Invalid/NodeString (0.00s)
=== RUN   TestObjectOf
=== RUN   TestObjectOf/mycoolapp/service.Timeout
=== RUN   TestObjectOf/testing.T
=== RUN   TestObjectOf/github.com/stretchr/testify/assert.Equal
=== RUN   TestObjectOf/github.com/stretchr/testify/suite.TestingSuite
=== RUN   TestObjectOf/net/http.Timeout
=== RUN   TestObjectOf/testing.TT
=== RUN   TestObjectOf/github.com/stretchr/testify/assert.NotEqual
=== RUN   TestObjectOf/vendor/github.com/stretchr/testify/assert.Equal
--- PASS: TestObjectOf (0.00s)
    --- PASS: TestObjectOf/mycoolapp/service.Timeout (0.00s)
    --- PASS: TestObjectOf/testing.T (0.00s)
    --- PASS: TestObjectOf/github.com/stretchr/testify/assert.Equal (0.00s)
    --- PASS: TestObjectOf/github.com/stretchr/testify/suite.TestingSuite (0.00s)
    --- PASS: TestObjectOf/net/http.Timeout (0.00s)
    --- PASS: TestObjectOf/testing.TT (0.00s)
    --- PASS: TestObjectOf/github.com/stretchr/testify/assert.NotEqual (0.00s)
    --- PASS: TestObjectOf/vendor/github.com/stretchr/testify/assert.Equal (0.00s)
=== RUN   TestIsObj
=== RUN   TestIsObj/#00
=== RUN   TestIsObj/#01
=== RUN   TestIsObj/#02
=== RUN   TestIsObj/#03
=== RUN   TestIsObj/#04
--- PASS: TestIsObj (0.00s)
    --- PASS: TestIsObj/#00 (0.00s)
    --- PASS: TestIsObj/#01 (0.00s)
    --- PASS: TestIsObj/#02 (0.00s)
    --- PASS: TestIsObj/#03 (0.00s)
    --- PASS: TestIsObj/#04 (0.00s)
=== RUN   TestIsObj_NamesakesFromDifferentPackages
--- PASS: TestIsObj_NamesakesFromDifferentPackages (0.00s)
=== RUN   TestIsPkg
=== RUN   TestIsPkg/#00
=== RUN   TestIsPkg/#01
=== RUN   TestIsPkg/#02
=== RUN   TestIsPkg/#03
=== RUN   TestIsPkg/#04
=== RUN   TestIsPkg/#05
=== RUN   TestIsPkg/#06
=== RUN   TestIsPkg/#07
--- PASS: TestIsPkg (0.00s)
    --- PASS: TestIsPkg/#00 (0.00s)
    --- PASS: TestIsPkg/#01 (0.00s)
    --- PASS: TestIsPkg/#02 (0.00s)
    --- PASS: TestIsPkg/#03 (0.00s)
    --- PASS: TestIsPkg/#04 (0.00s)
    --- PASS: TestIsPkg/#05 (0.00s)
    --- PASS: TestIsPkg/#06 (0.00s)
    --- PASS: TestIsPkg/#07 (0.00s)
PASS
ok      github.com/Antonboom/testifylint/internal/analysisutil  (cached)
=== RUN   TestRegistry
--- PASS: TestRegistry (0.00s)
=== RUN   TestAll
--- PASS: TestAll (0.00s)
=== RUN   TestEnabledByDefault
--- PASS: TestEnabledByDefault (0.00s)
=== RUN   TestGet
=== RUN   TestGet/smoke
=== RUN   TestGet/unknown_checker
=== RUN   TestGet/checker_types
--- PASS: TestGet (0.00s)
    --- PASS: TestGet/smoke (0.00s)
    --- PASS: TestGet/unknown_checker (0.00s)
    --- PASS: TestGet/checker_types (0.00s)
=== RUN   TestIsKnown
=== RUN   TestIsKnown/smoke
=== RUN   TestIsKnown/unknown_checker
--- PASS: TestIsKnown (0.00s)
    --- PASS: TestIsKnown/smoke (0.00s)
    --- PASS: TestIsKnown/unknown_checker (0.00s)
=== RUN   TestIsEnabledByDefault
--- PASS: TestIsEnabledByDefault (0.00s)
=== RUN   TestSortByPriority
--- PASS: TestSortByPriority (0.00s)
=== RUN   TestDefaultExpectedVarPattern
=== RUN   TestDefaultExpectedVarPattern/exp
=== RUN   TestDefaultExpectedVarPattern/Exp
=== RUN   TestDefaultExpectedVarPattern/expected
=== RUN   TestDefaultExpectedVarPattern/Expected
=== RUN   TestDefaultExpectedVarPattern/expResult
=== RUN   TestDefaultExpectedVarPattern/expectedResult
=== RUN   TestDefaultExpectedVarPattern/resultExp
=== RUN   TestDefaultExpectedVarPattern/resultExpected
=== RUN   TestDefaultExpectedVarPattern/clientBalanceExpected
=== RUN   TestDefaultExpectedVarPattern/want
=== RUN   TestDefaultExpectedVarPattern/Want
=== RUN   TestDefaultExpectedVarPattern/wanted
=== RUN   TestDefaultExpectedVarPattern/Wanted
=== RUN   TestDefaultExpectedVarPattern/wantError
=== RUN   TestDefaultExpectedVarPattern/wantedError
=== RUN   TestDefaultExpectedVarPattern/errWant
=== RUN   TestDefaultExpectedVarPattern/errWanted
=== RUN   TestDefaultExpectedVarPattern/expired
=== RUN   TestDefaultExpectedVarPattern/expecting
=== RUN   TestDefaultExpectedVarPattern/expresult
=== RUN   TestDefaultExpectedVarPattern/expectedresult
=== RUN   TestDefaultExpectedVarPattern/resultexp
=== RUN   TestDefaultExpectedVarPattern/resultexpected
=== RUN   TestDefaultExpectedVarPattern/resultExpires
=== RUN   TestDefaultExpectedVarPattern/resultExpectation
=== RUN   TestDefaultExpectedVarPattern/wantime
=== RUN   TestDefaultExpectedVarPattern/wanteddy
=== RUN   TestDefaultExpectedVarPattern/wantresult
=== RUN   TestDefaultExpectedVarPattern/wantedresult
=== RUN   TestDefaultExpectedVarPattern/resultwant
=== RUN   TestDefaultExpectedVarPattern/resultwanted
=== RUN   TestDefaultExpectedVarPattern/isClientWantAttention
=== RUN   TestDefaultExpectedVarPattern/isClientWantedAttention
=== RUN   TestDefaultExpectedVarPattern/clientExpBalance
=== RUN   TestDefaultExpectedVarPattern/clientExpectedBalance
--- PASS: TestDefaultExpectedVarPattern (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/exp (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/Exp (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/expected (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/Expected (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/expResult (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/expectedResult (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/resultExp (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/resultExpected (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/clientBalanceExpected (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/want (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/Want (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/wanted (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/Wanted (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/wantError (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/wantedError (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/errWant (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/errWanted (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/expired (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/expecting (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/expresult (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/expectedresult (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/resultexp (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/resultexpected (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/resultExpires (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/resultExpectation (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/wantime (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/wanteddy (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/wantresult (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/wantedresult (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/resultwant (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/resultwanted (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/isClientWantAttention (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/isClientWantedAttention (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/clientExpBalance (0.00s)
    --- PASS: TestDefaultExpectedVarPattern/clientExpectedBalance (0.00s)
PASS
ok      github.com/Antonboom/testifylint/internal/checkers      (cached)
=== RUN   TestNewDefault
--- PASS: TestNewDefault (0.00s)
=== RUN   TestConfig_Validate
=== RUN   TestConfig_Validate/default_config
=== RUN   TestConfig_Validate/enable-all_and_disable_simultaneously
=== RUN   TestConfig_Validate/disable-all_and_enable_simultaneously
=== RUN   TestConfig_Validate/enable_some_checkers
=== RUN   TestConfig_Validate/disable_some_checkers
=== RUN   TestConfig_Validate/enable_and_disable_simultaneously_different_checkers
=== RUN   TestConfig_Validate/enable-all_and_disable-all_simultaneously
=== RUN   TestConfig_Validate/enable-all_and_enable_simultaneously
=== RUN   TestConfig_Validate/disable-all_and_disable_simultaneously
=== RUN   TestConfig_Validate/disable-all_and_no_enable
=== RUN   TestConfig_Validate/enable_and_disable_simultaneously_the_same_checker
--- PASS: TestConfig_Validate (0.00s)
    --- PASS: TestConfig_Validate/default_config (0.00s)
    --- PASS: TestConfig_Validate/enable-all_and_disable_simultaneously (0.00s)
    --- PASS: TestConfig_Validate/disable-all_and_enable_simultaneously (0.00s)
    --- PASS: TestConfig_Validate/enable_some_checkers (0.00s)
    --- PASS: TestConfig_Validate/disable_some_checkers (0.00s)
    --- PASS: TestConfig_Validate/enable_and_disable_simultaneously_different_checkers (0.00s)
    --- PASS: TestConfig_Validate/enable-all_and_disable-all_simultaneously (0.00s)
    --- PASS: TestConfig_Validate/enable-all_and_enable_simultaneously (0.00s)
    --- PASS: TestConfig_Validate/disable-all_and_disable_simultaneously (0.00s)
    --- PASS: TestConfig_Validate/disable-all_and_no_enable (0.00s)
    --- PASS: TestConfig_Validate/enable_and_disable_simultaneously_the_same_checker (0.00s)
=== RUN   TestBindToFlags
=== RUN   TestBindToFlags/enable-all
=== RUN   TestBindToFlags/disable
=== RUN   TestBindToFlags/disable-all
=== RUN   TestBindToFlags/enable
=== RUN   TestBindToFlags/suite-extra-assert-call.mode
=== RUN   TestBindToFlags/expected-actual.pattern
--- PASS: TestBindToFlags (0.00s)
    --- PASS: TestBindToFlags/enable-all (0.00s)
    --- PASS: TestBindToFlags/disable (0.00s)
    --- PASS: TestBindToFlags/disable-all (0.00s)
    --- PASS: TestBindToFlags/enable (0.00s)
    --- PASS: TestBindToFlags/suite-extra-assert-call.mode (0.00s)
    --- PASS: TestBindToFlags/expected-actual.pattern (0.00s)
=== RUN   TestKnownCheckersValue_Set
=== RUN   TestKnownCheckersValue_Set/positive
=== RUN   TestKnownCheckersValue_Set/unknown_checker
=== RUN   TestKnownCheckersValue_Set/malformed_input_1
=== RUN   TestKnownCheckersValue_Set/malformed_input_2
--- PASS: TestKnownCheckersValue_Set (0.00s)
    --- PASS: TestKnownCheckersValue_Set/positive (0.00s)
    --- PASS: TestKnownCheckersValue_Set/unknown_checker (0.00s)
    --- PASS: TestKnownCheckersValue_Set/malformed_input_1 (0.00s)
    --- PASS: TestKnownCheckersValue_Set/malformed_input_2 (0.00s)
=== RUN   TestKnownCheckersValue_String
=== RUN   TestKnownCheckersValue_String/zero_value
=== RUN   TestKnownCheckersValue_String/not_zero_value
--- PASS: TestKnownCheckersValue_String (0.00s)
    --- PASS: TestKnownCheckersValue_String/zero_value (0.00s)
    --- PASS: TestKnownCheckersValue_String/not_zero_value (0.00s)
=== RUN   TestKnownCheckersValue_Contains
--- PASS: TestKnownCheckersValue_Contains (0.00s)
=== RUN   TestRegexp_Set
=== RUN   TestRegexp_Set/valid_regexp
=== RUN   TestRegexp_Set/invalid_regexp
--- PASS: TestRegexp_Set (0.00s)
    --- PASS: TestRegexp_Set/valid_regexp (0.00s)
    --- PASS: TestRegexp_Set/invalid_regexp (0.00s)
=== RUN   TestRegexpValue_String
=== RUN   TestRegexpValue_String/zero_value
=== RUN   TestRegexpValue_String/not_zero_value
--- PASS: TestRegexpValue_String (0.00s)
    --- PASS: TestRegexpValue_String/zero_value (0.00s)
    --- PASS: TestRegexpValue_String/not_zero_value (0.00s)
=== RUN   TestEnumValue
=== RUN   TestEnumValue/no_value
=== RUN   TestEnumValue/set_valid_value
=== RUN   TestEnumValue/set_invalid_value
--- PASS: TestEnumValue (0.00s)
    --- PASS: TestEnumValue/no_value (0.00s)
    --- PASS: TestEnumValue/set_valid_value (0.00s)
    --- PASS: TestEnumValue/set_invalid_value (0.00s)
=== RUN   Test_EnumValue_String
=== RUN   Test_EnumValue_String/zero_value
=== RUN   Test_EnumValue_String/unknown_default
--- PASS: Test_EnumValue_String (0.00s)
    --- PASS: Test_EnumValue_String/zero_value (0.00s)
    --- PASS: Test_EnumValue_String/unknown_default (0.00s)
PASS
ok      github.com/Antonboom/testifylint/internal/config        (cached)
=== RUN   TestNewAssertionExpander
=== RUN   TestNewAssertionExpander/no_report_without_t_param
=== RUN   TestNewAssertionExpander/no_report_without_t_param/errored
=== RUN   TestNewAssertionExpander/no_report_without_t_param/golden
=== RUN   TestNewAssertionExpander/no_report_with_t_param
=== RUN   TestNewAssertionExpander/no_report_with_t_param/errored
=== RUN   TestNewAssertionExpander/no_report_with_t_param/golden
=== RUN   TestNewAssertionExpander/no_report_with_suite_T_param
=== RUN   TestNewAssertionExpander/no_report_with_suite_T_param/errored
=== RUN   TestNewAssertionExpander/no_report_with_suite_T_param/golden
=== RUN   TestNewAssertionExpander/no_report_args_formatting
=== RUN   TestNewAssertionExpander/no_report_args_formatting/errored
=== RUN   TestNewAssertionExpander/no_report_args_formatting/golden
=== RUN   TestNewAssertionExpander/report_without_formatting__proposed_args_only_1
=== RUN   TestNewAssertionExpander/report_without_formatting__proposed_args_only_1/errored
=== RUN   TestNewAssertionExpander/report_without_formatting__proposed_args_only_1/golden
=== RUN   TestNewAssertionExpander/report_without_formatting__proposed_args_only_2
=== RUN   TestNewAssertionExpander/report_without_formatting__proposed_args_only_2/errored
=== RUN   TestNewAssertionExpander/report_without_formatting__proposed_args_only_2/golden
=== RUN   TestNewAssertionExpander/report_without_formatting__proposed_selector_only
=== RUN   TestNewAssertionExpander/report_without_formatting__proposed_selector_only/errored
=== RUN   TestNewAssertionExpander/report_without_formatting__proposed_selector_only/golden
=== RUN   TestNewAssertionExpander/report_without_formatting_and_without_proposals
=== RUN   TestNewAssertionExpander/report_without_formatting_and_without_proposals/errored
=== RUN   TestNewAssertionExpander/report_without_formatting_and_without_proposals/golden
=== RUN   TestNewAssertionExpander/report_with_formatting__proposed_selector_only
=== RUN   TestNewAssertionExpander/report_with_formatting__proposed_selector_only/errored
=== RUN   TestNewAssertionExpander/report_with_formatting__proposed_selector_only/golden
=== RUN   TestNewAssertionExpander/report_with_formatting__proposed_fn_and_args
=== RUN   TestNewAssertionExpander/report_with_formatting__proposed_fn_and_args/errored
=== RUN   TestNewAssertionExpander/report_with_formatting__proposed_fn_and_args/golden
=== RUN   TestNewAssertionExpander/report_with_positional_formatting
=== RUN   TestNewAssertionExpander/report_with_positional_formatting/errored
=== RUN   TestNewAssertionExpander/report_with_positional_formatting/golden
=== RUN   TestNewAssertionExpander/assertion_with_report
=== RUN   TestNewAssertionExpander/assertion_with_report/errored
=== RUN   TestNewAssertionExpander/assertion_with_report/golden
=== RUN   TestNewAssertionExpander/assertion_without_report
=== RUN   TestNewAssertionExpander/assertion_without_report/errored
=== RUN   TestNewAssertionExpander/assertion_without_report/golden
--- PASS: TestNewAssertionExpander (0.00s)
    --- PASS: TestNewAssertionExpander/no_report_without_t_param (0.00s)
        --- PASS: TestNewAssertionExpander/no_report_without_t_param/errored (0.00s)
        --- PASS: TestNewAssertionExpander/no_report_without_t_param/golden (0.00s)
    --- PASS: TestNewAssertionExpander/no_report_with_t_param (0.00s)
        --- PASS: TestNewAssertionExpander/no_report_with_t_param/errored (0.00s)
        --- PASS: TestNewAssertionExpander/no_report_with_t_param/golden (0.00s)
    --- PASS: TestNewAssertionExpander/no_report_with_suite_T_param (0.00s)
        --- PASS: TestNewAssertionExpander/no_report_with_suite_T_param/errored (0.00s)
        --- PASS: TestNewAssertionExpander/no_report_with_suite_T_param/golden (0.00s)
    --- PASS: TestNewAssertionExpander/no_report_args_formatting (0.00s)
        --- PASS: TestNewAssertionExpander/no_report_args_formatting/errored (0.00s)
        --- PASS: TestNewAssertionExpander/no_report_args_formatting/golden (0.00s)
    --- PASS: TestNewAssertionExpander/report_without_formatting__proposed_args_only_1 (0.00s)
        --- PASS: TestNewAssertionExpander/report_without_formatting__proposed_args_only_1/errored (0.00s)
        --- PASS: TestNewAssertionExpander/report_without_formatting__proposed_args_only_1/golden (0.00s)
    --- PASS: TestNewAssertionExpander/report_without_formatting__proposed_args_only_2 (0.00s)
        --- PASS: TestNewAssertionExpander/report_without_formatting__proposed_args_only_2/errored (0.00s)
        --- PASS: TestNewAssertionExpander/report_without_formatting__proposed_args_only_2/golden (0.00s)
    --- PASS: TestNewAssertionExpander/report_without_formatting__proposed_selector_only (0.00s)
        --- PASS: TestNewAssertionExpander/report_without_formatting__proposed_selector_only/errored (0.00s)
        --- PASS: TestNewAssertionExpander/report_without_formatting__proposed_selector_only/golden (0.00s)
    --- PASS: TestNewAssertionExpander/report_without_formatting_and_without_proposals (0.00s)
        --- PASS: TestNewAssertionExpander/report_without_formatting_and_without_proposals/errored (0.00s)
        --- PASS: TestNewAssertionExpander/report_without_formatting_and_without_proposals/golden (0.00s)
    --- PASS: TestNewAssertionExpander/report_with_formatting__proposed_selector_only (0.00s)
        --- PASS: TestNewAssertionExpander/report_with_formatting__proposed_selector_only/errored (0.00s)
        --- PASS: TestNewAssertionExpander/report_with_formatting__proposed_selector_only/golden (0.00s)
    --- PASS: TestNewAssertionExpander/report_with_formatting__proposed_fn_and_args (0.00s)
        --- PASS: TestNewAssertionExpander/report_with_formatting__proposed_fn_and_args/errored (0.00s)
        --- PASS: TestNewAssertionExpander/report_with_formatting__proposed_fn_and_args/golden (0.00s)
    --- PASS: TestNewAssertionExpander/report_with_positional_formatting (0.00s)
        --- PASS: TestNewAssertionExpander/report_with_positional_formatting/errored (0.00s)
        --- PASS: TestNewAssertionExpander/report_with_positional_formatting/golden (0.00s)
    --- PASS: TestNewAssertionExpander/assertion_with_report (0.00s)
        --- PASS: TestNewAssertionExpander/assertion_with_report/errored (0.00s)
        --- PASS: TestNewAssertionExpander/assertion_with_report/golden (0.00s)
    --- PASS: TestNewAssertionExpander/assertion_without_report (0.00s)
        --- PASS: TestNewAssertionExpander/assertion_without_report/errored (0.00s)
        --- PASS: TestNewAssertionExpander/assertion_without_report/golden (0.00s)
=== RUN   TestAssertionExpander_DifferentModes
=== RUN   TestAssertionExpander_DifferentModes/default_extreme_mode
=== RUN   TestAssertionExpander_DifferentModes/default_extreme_mode/errored
=== RUN   TestAssertionExpander_DifferentModes/default_extreme_mode/golden
=== RUN   TestAssertionExpander_DifferentModes/full_mode
=== RUN   TestAssertionExpander_DifferentModes/full_mode/errored
=== RUN   TestAssertionExpander_DifferentModes/full_mode/golden
=== RUN   TestAssertionExpander_DifferentModes/fmt_single_mode
=== RUN   TestAssertionExpander_DifferentModes/fmt_single_mode/errored
=== RUN   TestAssertionExpander_DifferentModes/fmt_single_mode/golden
=== RUN   TestAssertionExpander_DifferentModes/not_fmt_set_mode
=== RUN   TestAssertionExpander_DifferentModes/not_fmt_set_mode/errored
=== RUN   TestAssertionExpander_DifferentModes/not_fmt_set_mode/golden
=== RUN   TestAssertionExpander_DifferentModes/not_fmt_single_mode
=== RUN   TestAssertionExpander_DifferentModes/not_fmt_single_mode/errored
=== RUN   TestAssertionExpander_DifferentModes/not_fmt_single_mode/golden
--- PASS: TestAssertionExpander_DifferentModes (0.00s)
    --- PASS: TestAssertionExpander_DifferentModes/default_extreme_mode (0.00s)
        --- PASS: TestAssertionExpander_DifferentModes/default_extreme_mode/errored (0.00s)
        --- PASS: TestAssertionExpander_DifferentModes/default_extreme_mode/golden (0.00s)
    --- PASS: TestAssertionExpander_DifferentModes/full_mode (0.00s)
        --- PASS: TestAssertionExpander_DifferentModes/full_mode/errored (0.00s)
        --- PASS: TestAssertionExpander_DifferentModes/full_mode/golden (0.00s)
    --- PASS: TestAssertionExpander_DifferentModes/fmt_single_mode (0.00s)
        --- PASS: TestAssertionExpander_DifferentModes/fmt_single_mode/errored (0.00s)
        --- PASS: TestAssertionExpander_DifferentModes/fmt_single_mode/golden (0.00s)
    --- PASS: TestAssertionExpander_DifferentModes/not_fmt_set_mode (0.00s)
        --- PASS: TestAssertionExpander_DifferentModes/not_fmt_set_mode/errored (0.00s)
        --- PASS: TestAssertionExpander_DifferentModes/not_fmt_set_mode/golden (0.00s)
    --- PASS: TestAssertionExpander_DifferentModes/not_fmt_single_mode (0.00s)
        --- PASS: TestAssertionExpander_DifferentModes/not_fmt_single_mode/errored (0.00s)
        --- PASS: TestAssertionExpander_DifferentModes/not_fmt_single_mode/golden (0.00s)
=== RUN   TestCheckerName
=== RUN   TestCheckerName/suite-extra-assert-call
=== RUN   TestCheckerName/suite-dont-use-pkg
=== RUN   TestCheckerName/float-compare
--- PASS: TestCheckerName (0.00s)
    --- PASS: TestCheckerName/suite-extra-assert-call (0.00s)
    --- PASS: TestCheckerName/suite-dont-use-pkg (0.00s)
    --- PASS: TestCheckerName/float-compare (0.00s)
PASS
ok      github.com/Antonboom/testifylint/internal/testgen       (cached)
FAIL

signal: killed – looks very strange, what is your OS?

I'm using ubuntu 20.04 via WSL.
Anyway I think it's okay if it doesn't get solved this time, we can just see the workflow results I guess 😀

@Antonboom Antonboom changed the title Add new advance checker: useless-import Add new advance checker: blank-import Jan 23, 2024
@Antonboom
Copy link
Owner

@hendrywiranto

  1. I tested the checker (did your work) on several code bases from blank-import: forbid import of root package github.com/stretchr/testify #37 and feature: forbid import of testify packages as _ #38 and found some uncovered and difficult to auto-removing imports variations. Auto-fixing was disabled. This is over-engineering for this checker.

  2. Renamed to blank-import. I couldn't think of any other import that might be useless. But this name more strict and clear.

Thanks for you job, but will be more attentive 👍

@Antonboom Antonboom merged commit 6bf3353 into Antonboom:master Jan 23, 2024
2 of 3 checks passed
@hendrywiranto
Copy link
Contributor Author

@Antonboom
really sorry if the work I've done is not perfect and you end up helping a lot, I'll keep in mind to test to the actual codebase when working on the next feature

thanks for the work too ! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants