diff --git a/e2e/commands/start/start_test.go b/e2e/commands/start/start_test.go index 71bb34883..7fa0d0aab 100644 --- a/e2e/commands/start/start_test.go +++ b/e2e/commands/start/start_test.go @@ -20,15 +20,15 @@ import ( "os" "path/filepath" + "github.com/ZupIT/horusec-devkit/pkg/enums/severities" + "github.com/ZupIT/horusec-devkit/pkg/enums/vulnerability" + "github.com/ZupIT/horusec-devkit/pkg/utils/logger/enums" "github.com/google/uuid" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/onsi/gomega/gbytes" "github.com/onsi/gomega/gexec" - "github.com/ZupIT/horusec-devkit/pkg/enums/severities" - "github.com/ZupIT/horusec-devkit/pkg/enums/vulnerability" - "github.com/ZupIT/horusec-devkit/pkg/utils/logger/enums" "github.com/ZupIT/horusec/internal/enums/outputtype" "github.com/ZupIT/horusec/internal/utils/testutil" ) @@ -148,7 +148,6 @@ var _ = Describe("running binary Horusec with start parameter", func() { var certificateFileWithPath string BeforeEach(func() { - certificateFileWithPath = testutil.GinkgoCreateTmpFile("*.crt") flags = map[string]string{ @@ -468,7 +467,6 @@ var _ = Describe("running binary Horusec with start parameter", func() { writeJsonFile(customRulesJson) BeforeEach(func() { - flags = map[string]string{ testutil.StartFlagProjectPath: testutil.JavaExample1, testutil.StartFlagCustomRulesPath: customRulesJson, @@ -484,7 +482,6 @@ var _ = Describe("running binary Horusec with start parameter", func() { Eventually(session.Wait(testutil.AverageTimeoutAnalyzeForExamplesFolder).Out).Should(gbytes.Say(`Details: Teste QA`)) Eventually(session.Wait(testutil.AverageTimeoutAnalyzeForExamplesFolder).Out).Should(gbytes.Say(`Teste de description QA`)) Eventually(session.Wait(testutil.AverageTimeoutAnalyzeForExamplesFolder).Out).Should(gbytes.Say(`Type: Vulnerability`)) - }) }) }) @@ -498,7 +495,6 @@ func writeJsonFile(path string) { defer file.Close() customRules := []map[string]interface{}{ - { "id": "HS-JAVA-99999999999", "name": "Teste QA", diff --git a/internal/enums/errors/errors.go b/internal/enums/errors/errors.go index 10bda7c0d..3e9adf6d7 100644 --- a/internal/enums/errors/errors.go +++ b/internal/enums/errors/errors.go @@ -30,7 +30,7 @@ var ErrDockerNotInstalled = errors.New("{HORUSEC_CLI} Error Docker not found. Pl // Occurs when not found rails project -var ErrNotFoundRailsProject = errors.New("{HORUSEC_CLI} Error not found rails project syntax") +var ErrNotFoundRailsProject = errors.New("brakeman only works on Ruby On Rails project") // Occurs when gem lock not found @@ -39,5 +39,3 @@ var ErrGemLockNotFound = errors.New( " it would be a good idea to commit it so horusec can check for vulnerabilities") var ErrImageTagCmdRequired = errors.New("{ERROR_DOCKER_API} required exists Image, Tag and CMD not empty") - -var ErrorBodyIsRequired = errors.New("{ERROR_USE_CASES} body is required") diff --git a/internal/services/formatters/service.go b/internal/services/formatters/service.go index c8bd06627..b4e0d031a 100644 --- a/internal/services/formatters/service.go +++ b/internal/services/formatters/service.go @@ -117,7 +117,7 @@ func (s *Service) SetAnalysisError(err error, tool tools.Tool, output, projectSu if err != nil { s.mutex.Lock() defer s.mutex.Unlock() - s.addAnalysisError(err) + s.addAnalysisError(tool, err) msg := s.GetAnalysisIDErrorMessage(tool, output) if projectSubPath != "" { msg += " | ProjectSubPath -> " + projectSubPath @@ -128,11 +128,11 @@ func (s *Service) SetAnalysisError(err error, tool tools.Tool, output, projectSu } } -func (s *Service) addAnalysisError(err error) { +func (s *Service) addAnalysisError(tool tools.Tool, err error) { if err != nil { toAppend := "" if len(s.analysis.Errors) > 0 { - s.analysis.Errors += "; " + err.Error() + s.analysis.Errors += fmt.Sprintf("; Error while running %s tool: %s", tool.ToString(), err.Error()) return } s.analysis.Errors += toAppend + err.Error() diff --git a/mage.go b/mage.go index 8cc3ccde8..ed0a2d97e 100644 --- a/mage.go +++ b/mage.go @@ -17,8 +17,9 @@ package main import ( - "github.com/magefile/mage/mage" "os" + + "github.com/magefile/mage/mage" ) func main() { os.Exit(mage.Main()) } diff --git a/magefile.go b/magefile.go index 329de5fc0..f94388fe6 100644 --- a/magefile.go +++ b/magefile.go @@ -18,9 +18,10 @@ package main import ( - "github.com/magefile/mage/sh" + // mage:import _ "github.com/ZupIT/horusec-devkit/pkg/utils/mageutils" + "github.com/magefile/mage/sh" ) // GetCurrentDate execute "echo", `::set-output name=date::$(date "+%a %b %d %H:%M:%S %Y")`