<@UB89GSWCF> for this issue <https://linear.app/cl...
# atmos-dev
s
@Andriy Knysh (Cloud Posse) for this issue https://linear.app/cloudposse/issue/DEV-2362/atmos-validate-should-not-error-on-empty-files
Running
atmos validate
on an empty YAML file does not validate
what file it refers by the empty yaml? is this atmos.yaml file or the stacks files? I tried with empty yaml having on the stacks folder's files but it seems validate with success for those!
a
this is already fixed, the issue can be closed
๐Ÿ‘ 1
s
I see, okay will make it closed/done (else it will create confusions) and switch to other one!
e
If we run atmos validate on and empty stack directory it should also not error
Does that work?
๐Ÿ‘€ 1
s
no for empty stack directory it shows error
a
i explained you in DM how to fix it
s
I'm checking the current imple of the validate_stacks code
a
also please add the check for an empty directory, and donโ€™t show any errors if itโ€™s empty
๐Ÿ‘ 1
s
in the current codebase it's hardcodedly using all the paths in the stacks folder but excluding nothing:
Copy code
// Include (process and validate) all YAML files in the `stacks` folder in all subfolders
	includedPaths := []string{"**/*"}
	// Don't exclude any YAML files for validation
	excludedPaths := []string{}
	includeStackAbsPaths, err := u.JoinAbsolutePathWithPaths(cliConfig.StacksBaseAbsolutePath, includedPaths)
	if err != nil {
		return err
	}
but in the atmos.yaml it requires to provide
stacks.included_paths
if we're not using those values why to take?
a
please provide more context, that code is from what file and function?
// Don't exclude any YAML files for validation
this means we validate ALL YAML files in
stacks
s
a
in
atmos.yaml
, we can exclude the file that are NOT top-level stacks so Atmos does not try to process them as stacks (those can be catalog files, or mixins, or other YAML manifests, but they are not topo-level stacks)
in short, we validate ALL YAML files in
stacks
s
okay, that means for our problem we just need to check whether the
stacks.base_path
is empty or not?
a
yes
if it's empty, just show the Atmos logo and exit w/o any errors
๐Ÿ‘ 1
or maybe show a warning message after the logo: "The path pointed to by 'stacks.base_path' is empty, there are no stacks defined"
s
yes I thought so, need to show a message that the stack path is empty nothing to validate, like this
a
image.png
we already have that ^
try to delete/rename the
stacks
directory and you should have the message above
๐Ÿ‘€ 1
s
thanks for the infos, I'll make update of this!