We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
**/*
I have a project structure that looks like:
app |_ components |_ folder |_ some_file.html.erb |_ some_other_file.html.erb
I want to prevent a linter from analysing any file in the app/components folder. What I would do is:
app/components
HardCodedString: exclude: - '**/app/components/**/*'
The app/components/folder/some_file.html.erb is properly excluded, but the app/components/some_other_file.html.erb is not.
app/components/folder/some_file.html.erb
app/components/some_other_file.html.erb
Is this expected?
The text was updated successfully, but these errors were encountered:
This seems like a bug to me. How Rubocop works for those files?
Sorry, something went wrong.
@rafaelfranca As an example, I have a rule in RuboCop that looks like
Lint/MissingSuper: Exclude: - "**/app/components/**/*"
and all my files in the app/components folder, nested in sub-folders or not, are properly excluded.
I would expect the same behaviour to work with erb-lint:
but my "non-nested" files are not properly excluded with that setup. My current workaround is:
HardCodedString: exclude: - '**/app/components/**/*' - '**/app/components/*'
which is very cheap, but feels a little off.
This bug relates https://github.com/Shopify/erb-lint/blob/9e53328bc5df06ebaa0d2a56706641b6d349c08f/lib/erb_lint/cli.rb#L258
Per File.fnmatch documentation : https://apidock.com/ruby/v2_6_3/File/fnmatch%3F/class
pattern = '**/app/components/**/*' File.fnmatch(pattern, '/a/app/components/foo') #=> false File.fnmatch(pattern, '/a/app/components/foo/bar') #=> true File.fnmatch(pattern, '/a/app/components/foo', File::FNM_PATHNAME) #=> true File.fnmatch(pattern, '/a/app/components/foo/bar', File::FNM_PATHNAME) #=> true
So, if we don't change the code, the correct exclude pattern should be:
exclude: - '*/app/components/*'
pattern = '*/app/components/*' File.fnmatch(pattern, '/a/app/components/foo') #=> false File.fnmatch(pattern, '/a/app/components/foo/bar') #=> true
No branches or pull requests
I have a project structure that looks like:
I want to prevent a linter from analysing any file in the
app/components
folder. What I would do is:The
app/components/folder/some_file.html.erb
is properly excluded, but theapp/components/some_other_file.html.erb
is not.Is this expected?
The text was updated successfully, but these errors were encountered: