Open asteinarson opened 3 years ago
One more related note: I tried excluding these two directories using the Exclude mechanism of .rubocop.yml:
AllCops:
# ...
Exclude:
- src/*/vendor/**/* # Exclude skippy vendor folder
- .git/
- .vscode/
However, SketchupRequirements/FileStructure still scans those directories (and reports the error).
Hi, how have you structured your extension code? Is the root RB and and the support folder at the root of your project?
.gitignore
.rubocop.yml
example.rb
example/main.rb
By default rubocop-sketchup assumes the extension source to be under src
. It also assumes that everything in this folder is the extension.
.gitignore
.rubocop.yml
src/example.rb
src/example/main.rb
So if you configured your project to have the source files directly at the root of where the rubocop.yml file is with .vscode
etc also there then that will currently be flagged. The cop doesn't take the Exclude
list as you say.
I'm not sure if Exclude
is appropriate for FileStructure
to use to ignore files. Exclude
dictates which source files to analyse, but that's different from what files are considered to be part of the extension package.
I think that FileStructure
would need a separate option itself for what files to ignore.
In general I'd recommend keeping the extension sources in a separate sub-directory apart from any tooling. Makes it easier to analyse and package the extension when you don't have to resolve what to ignore.
Hi,
Yes, this was the folder structure of my project:
.git
.vscode
.gitignore
.rubocop.yml
example.rb
example/main.rb
I since rearranged the project and can now have the files under src
.
I can see taking the exclude
directories into account would be some additional work. Maybe a clearer message (in the docs) that the expectation is that all Ruby source files reside under src
(I could see it now, in general parts of docs, that expectations is so).
So, it is not as much an issue for me anymore (I was playing around with various project / playground setups when hitting this).
In my VsCode project folder (for my SU extension) I get a Rubocop error: SketchupRequirements/FileStructure reported. When investigating, it shows this cop is finding the '.git/' and '.vscode/' folders and assuming them to be extension support folders.
I'm a bit confused about getting this error as I think many extension developers should be using git and/or VsCode.
Expected behavior
'.git/' and '.vscode/' do not contain Ruby files, and their existence should not raise errors as being additional extension support directories..
Actual behavior
They generate the error (I tested by modifying what the cop prints and have it print out the dir names it finds).
Steps to reproduce the problem
In a valid extension folder, run rubocop (without errors). Then run 'git init'. Rubocop now gives a Sketchup error.
It is likely enough to create an empty directory and touch a 'file.txt' inside that.
RuboCop version
RuboCop SketchUp version
0.18