Skip to content
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

ScssLint not using config file #351

Closed
ericgross opened this issue Mar 1, 2016 · 19 comments
Closed

ScssLint not using config file #351

ericgross opened this issue Mar 1, 2016 · 19 comments

Comments

@ericgross
Copy link

I have a .scss-lint.yml file that is being ignored by my PreCommit hook.

.scss-lint.yml:
scss_files: 'app/assets/stylesheets/**/*.scss'

.overcommit.yml:

PreCommit:
  RuboCop:
    enabled: true
    on_warn: fail # Treat all warnings as failures
  Reek:
    enabled: true
  ScssLint:
    enabled: true
PrePush:
  RSpec:
    enabled: true

And the output has a ton of errors from files such as:
/Users/eric/Development/proj/web/vendor/assets/stylesheets/bourbon/_bourbon.scss:72 StringQuotes: Prefer single quoted strings

@ericgross
Copy link
Author

One more thing - when I run scss-lint from the command line in the root of the project, it does work properly (ignoring all those issues in the vendor directory).

@trotzig
Copy link
Contributor

trotzig commented Mar 1, 2016

Is the .scss-lint.yml file tracked by git? I seem to remember a similar issue where a file was ignored because it wasn't in the git index.

@ericgross
Copy link
Author

I can confirm that .scss-lint.yml is committed to the repo and is not in .gitignore, with the contents:

scss_files: 'app/assets/stylesheets/**/*.scss'

I confirmed this by checking the proper branch on github.

@sds
Copy link
Owner

sds commented Mar 1, 2016

Which version of Overcommit are you running, @ericgross?

How are you invoking the pre-commit hook? Is it via git commit, or are you running overcommit --run?

@ericgross
Copy link
Author

overcommit 0.32.0

I have been running overcommit --run but if we think that might be related, I could just do a git commit.

@ericgross
Copy link
Author

It does seem to work properly when run via a git commit but not when run via overcommit --run.

@sds
Copy link
Owner

sds commented Mar 1, 2016

What happens if you run with bundle exec overcommit --run?

@ericgross
Copy link
Author

Here you go:

Erics-MacBook-Pro:web eric$ bundle exec overcommit --run
Running pre-commit hooks
Analyze with scss-lint.....................................[ScssLint] FAILED
Unable to parse JSON returned by SCSS-Lint: A JSON text must at least contain two octets!
STDOUT: 
STDERR: Bundler is using a binstub that was created for a different gem.
This is deprecated, in future versions you may need to `bundle binstub scss_lint` to work around a system/bundle conflict.
/Users/eric/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/scss-lint-0.30.0/bin/scss-lint:7:in `block in <top (required)>': undefined method `parse_arguments' for #<SCSSLint::CLI:0x007f9bd99c46f0> (NoMethodError)
    from /Users/eric/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/scss-lint-0.30.0/bin/scss-lint:6:in `tap'
    from /Users/eric/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/scss-lint-0.30.0/bin/scss-lint:6:in `<top (required)>'
    from /Users/eric/.rbenv/versions/2.3.0/bin/scss-lint:23:in `load'
    from /Users/eric/.rbenv/versions/2.3.0/bin/scss-lint:23:in `<main>'

Analyze with RuboCop........................................[RuboCop] OK
Analyze with Reek..............................................[Reek] OK

✗ One or more pre-commit hooks failed

Erics-MacBook-Pro:web eric$ 

Also, I am trying to do a git commit now and I am getting this:

Erics-MacBook-Pro:web eric$ git commit -m '[#114570237] Improve survey styling'
Running pre-commit hooks
Analyze with scss-lint.....................................[ScssLint] FAILED
Warnings on lines you didn't modify:
/Users/eric/Development/proj/web/vendor/assets/stylesheets/bourbon/addons/_buttons.scss:1 StringQuotes: Prefer single quoted strings

Analyze with Reek..............................................[Reek] OK
Analyze with RuboCop........................................[RuboCop] OK

✗ One or more pre-commit hooks failed

even though that file should be ignored based on my .scss-lint.yml file - so I guess it's not really working in the git commit case either.

@sds
Copy link
Owner

sds commented Mar 2, 2016

Notice from the stack trace that scss-lint-0.30.0 is the version being run. It should be scss_lint (with an underscore) and a much newer version. Please upgrade to the latest version.

@sds
Copy link
Owner

sds commented Mar 6, 2016

Closing. Feel free to reopen if upgrading doesn't fix the issue, but I'm pretty sure that's the issue here.

@sds sds closed this as completed Mar 6, 2016
@vill
Copy link
Contributor

vill commented Jan 5, 2017

default.yml contains install_command: 'gem install scss-lint' instead of install_command: 'gem install scss_lint'

@trotzig
Copy link
Contributor

trotzig commented Jan 5, 2017

Good catch @vill, would you be willing to submit a PR for that?

vill added a commit to vill/overcommit that referenced this issue Jan 5, 2017
@vill
Copy link
Contributor

vill commented Jan 5, 2017

@trotzig, please check #457

trotzig pushed a commit that referenced this issue Jan 5, 2017
@miukki
Copy link

miukki commented Mar 8, 2017

i still have this error after all updates

@miukki
Copy link

miukki commented Mar 8, 2017

please help me to resolve it

@miukki
Copy link

miukki commented Mar 8, 2017

image

@miukki
Copy link

miukki commented Mar 8, 2017

overcommit 0.38.0

@vill
Copy link
Contributor

vill commented Mar 8, 2017

@miukki, I have such versions all works fine:

# Gemfile
gem 'scss_lint', '~> 0.52.0', require: false
gem 'overcommit', '~> 0.38.0', require: false

What is the output of this commands gem list scss-lint and which scss-lint?

@vill
Copy link
Contributor

vill commented Mar 8, 2017

Maybe this:

@trotzig commented on Mar 1, 2016
Is the .scss-lint.yml file tracked by git? I seem to remember a similar issue where a file was ignored because it wasn't in the git index.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants