Skip to content

Commit

Permalink
remove the validation rule for python path
Browse files Browse the repository at this point in the history
  • Loading branch information
karakanb committed Nov 6, 2024
1 parent d1cf92a commit 6852639
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 27 deletions.
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func VersionCmd(commit string) *cli.Command {
version := c.App.Version

res, err := http.Get("https://github.com/bruin-data/bruin/releases/latest") //nolint
defer res.Body.Close() //nolint
defer res.Body.Close() //nolint:all
if err != nil {
return errors.Wrap(err, "failed to check the latest version")
}
Expand Down
8 changes: 0 additions & 8 deletions pkg/lint/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,6 @@ func GetRules(fs afero.Fs, finder repoFinder, excludeWarnings bool) ([]Rule, err
AssetValidator: ValidateDuplicateColumnNames,
ApplicableLevels: []Level{LevelPipeline, LevelAsset},
},
&SimpleRule{
Identifier: "invalid-python-module-name",
Fast: true,
Severity: ValidatorSeverityCritical,
Validator: CallFuncForEveryAsset(ValidateInvalidPythonModuleName),
AssetValidator: ValidateInvalidPythonModuleName,
ApplicableLevels: []Level{LevelPipeline, LevelAsset},
},
&SimpleRule{
Identifier: "assets-directory-exist",
Fast: true,
Expand Down
18 changes: 0 additions & 18 deletions pkg/lint/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,24 +375,6 @@ func ValidateDuplicateColumnNames(ctx context.Context, p *pipeline.Pipeline, ass
return issues, nil
}

func ValidateInvalidPythonModuleName(ctx context.Context, p *pipeline.Pipeline, asset *pipeline.Asset) ([]*Issue, error) {
var issues []*Issue

if asset.Type == "python" {
parentDirs := strings.Split(filepath.Dir(asset.DefinitionFile.Path), "/")
lastDir := parentDirs[len(parentDirs)-1]

// Check if the last directory contains a hyphen and is not in the 'assets' directory
if strings.Contains(lastDir, "-") && lastDir != "assets" {
issues = append(issues, &Issue{
Task: asset,
Description: fmt.Sprintf("Invalid Python module name '%s' for asset '%s'. Directory names cannot contain hyphens ('-') as they cannot be imported in Python.", lastDir, asset.Name),
})
}
}
return issues, nil
}

func ValidateAssetDirectoryExist(p *pipeline.Pipeline) ([]*Issue, error) {
var issues []*Issue

Expand Down

0 comments on commit 6852639

Please sign in to comment.