-
Notifications
You must be signed in to change notification settings - Fork 656
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
lint silently ignores content outside current directory even when passed as argument #3284
Comments
While it looks like a bug, it appears to be just a side effect of current logic. In absence of a config file or git repository, which do defined the location of the This means that if your are inside user home and try to lint a file from outside like The logic about ignoring any files outside the current project makes sense as we never wanted to lint code that the user cannot fix. Still passing a single folder to linter might make people think that this should only chdir to it and run from there. What if user is passing more than one argument, As a safety measure, we should probably make the linter return an error code if it did finish without linting any files (everything was skipped). At least it should prevent accidents. Still, this will not fix this issue. I could add some code that would detect if only one argument was given that is a folder outside current directory and assume that this is a project_dir and chdir to it. I should mention that we already have a Any suggestions? |
lint
only lints if in directory ancestoryThis change will make the linter return a special exit code when no files are analyzed. This should prevent accidents related to misconfiguration via config file excludes or wrong arguments being passed to it. The returned exit code is unique and returned only for this special case. Related: #3284
This change will make the linter return a special exit code when no files are analyzed. This should prevent accidents related to misconfiguration via config file excludes or wrong arguments being passed to it. The returned exit code is unique and returned only for this special case. Related: #3284
Given the following dir structure
Running ansible-lint from
other_dir
reports no errorsRunning from /tmp reports no errors
Running from $HOME is fine (in a parent of the dest to linted)
Tested with volume mounts in creator ee as well
The text was updated successfully, but these errors were encountered: